diff --git a/ci_cd_test/Dockerfile b/ci_cd_test/Dockerfile index 2d1fe73d123832ea1d40e78a4cddb7ab5e369bad..5f2496be9172ff655cfc56759291e4f1e686edf9 100644 --- a/ci_cd_test/Dockerfile +++ b/ci_cd_test/Dockerfile @@ -1,27 +1,27 @@ FROM labs.etsi.org:5050/ocf/capif/python:3-slim-bullseye -RUN apt update +# Update package index and install required tools RUN apt update && apt install -y git nano && \ rm -rf /var/lib/apt/lists/* -ARG BRANCH=main - -RUN echo "Cloning branch: ${BRANCH}" && \ - git clone -b ${BRANCH} https://labs.etsi.org/rep/ocf/sdk.git - WORKDIR /sdk +# Copy project files into the container +COPY .. . + +# Install Python dependencies RUN python -m pip install --upgrade pip RUN pip install -r installation/requirements.txt RUN pip install . +# Define entrypoint: run provider first, then invoker ENTRYPOINT sh -c '\ set -e && \ - echo "πŸš€ Ejecutando provider..." && \ + echo "πŸš€ Starting provider execution..." && \ cd ci_cd_test/testing_samples/testing_provider_sample && \ python testing_provider.py && \ - echo "βœ… Provider finalizado." && \ - echo "πŸš€ Ejecutando invoker..." && \ + echo "βœ… Provider execution finished." && \ + echo "πŸš€ Starting invoker execution..." && \ cd ../testing_invoker_sample && \ python network_app_invoker.py && \ - echo "βœ… Invoker finalizado."' \ No newline at end of file + echo "βœ… Invoker execution finished."' \ No newline at end of file diff --git a/clean_test_sdk.sh b/ci_cd_test/clean_test_sdk.sh similarity index 90% rename from clean_test_sdk.sh rename to ci_cd_test/clean_test_sdk.sh index 382dbbb1d6a14679e9fe4a7e81f28748887999e7..67555f0b91146390636cbd88ff6121510635c04c 100755 --- a/clean_test_sdk.sh +++ b/ci_cd_test/clean_test_sdk.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Nombre del contenedor e imagen +# Name of container image CONTAINER_NAME=capif-sdk-runner IMAGE_NAME=opencapif_sdk diff --git a/test_sdk.sh b/ci_cd_test/test_sdk.sh similarity index 52% rename from test_sdk.sh rename to ci_cd_test/test_sdk.sh index 3452e076089abcd6efad65d973712ed46f8f9aff..860a8699c39aa0ab1f7dfc2eb4398944a47851c8 100755 --- a/test_sdk.sh +++ b/ci_cd_test/test_sdk.sh @@ -1,19 +1,22 @@ #!/bin/bash -# Nombre del contenedor e imagen +# Name of container image CONTAINER_NAME=capif-sdk-runner IMAGE_NAME=opencapif_sdk -BRANCH_NAME=SDK15-create-dockerfile-image-with-sdk +BRANCH_NAME=${CI_COMMIT_REF_NAME} NETWORK_NAME=capif-network +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" + echo "πŸ› οΈ Building image: $IMAGE_NAME from branch: $BRANCH_NAME with no cache..." -docker build --no-cache . -t $IMAGE_NAME -f ci_cd_test/Dockerfile --build-arg BRANCH=$BRANCH_NAME +docker build --no-cache "$PROJECT_ROOT" -t $IMAGE_NAME -f "$SCRIPT_DIR/Dockerfile" --build-arg BRANCH=$BRANCH_NAME echo "πŸš€ Running container: $CONTAINER_NAME in network: $NETWORK_NAME..." docker run \ + --rm \ --name $CONTAINER_NAME \ --network $NETWORK_NAME \ $IMAGE_NAME -echo "End" - +echo "βœ… End of script" \ No newline at end of file diff --git a/cicd/exclusions b/cicd/exclusions new file mode 100644 index 0000000000000000000000000000000000000000..78753ab4c5eb4bde5e6b8da499c229d81780c587 --- /dev/null +++ b/cicd/exclusions @@ -0,0 +1,4 @@ +doc/ +.git/ +network_app_samples/ +ci_cd_test/ \ No newline at end of file diff --git a/cicd/ruff.toml b/cicd/ruff.toml new file mode 100644 index 0000000000000000000000000000000000000000..a75ab1273cc0453c0eb60da23f839e213510ae0f --- /dev/null +++ b/cicd/ruff.toml @@ -0,0 +1,3 @@ +line-length = 120 +target-version = "py39" +lint.select = ["E", "W"] \ No newline at end of file diff --git a/installation/requirements.txt b/installation/requirements.txt index 416b0d8a86ea9611aa47aa177d13eabe0d77ff34..2459d4b96c38267180475e859a3a4ea33e0bf564 100644 --- a/installation/requirements.txt +++ b/installation/requirements.txt @@ -1,17 +1,17 @@ -requests==2.32.3 +requests>=2.32.3,<3 PyYAML==6.0.1 -cryptography==38.0.4 -pyOpenSSL==22.1.0 -urllib3==2.2.2 +cryptography>=43.0.1,<46 +pyOpenSSL>=25.1.0,<26 +requests>=2.32.3,<3 certifi==2024.7.4 idna==3.7 Flask==3.0.3 Flask-JWT-Extended==4.6.0 -Jinja2==3.1.4 +Jinja2>=3.1.6,<4 MarkupSafe==2.1.5 six==1.16.0 typing-extensions==3.10.0.2 -Werkzeug==3.0.4 +Werkzeug>=3.1.2,<4 pytest==8.3.2 flake8==3.9.2 coverage==4.5.4 diff --git a/setup.py b/setup.py index fe14cdf2867a9acd527c6e1f23d229c23092f04e..01a20e6401abc73f1587d69912253d5ed04069f5 100644 --- a/setup.py +++ b/setup.py @@ -28,20 +28,20 @@ setup( ], packages=find_packages(include=["opencapif_sdk", "opencapif_sdk.*"]), # Ajusta segΓΊn tus necesidades install_requires=[ - "requests==2.32.3", + "requests>=2.32.3,<3", "PyYAML==6.0.1", - "cryptography==38.0.4", - "pyOpenSSL==22.1.0", - "urllib3==2.2.2", + "cryptography>=43.0.1,<46", + "pyOpenSSL>=25.1.0,<26", + "urllib3>=2.2.2,<3", "certifi==2024.7.4", "idna==3.7", "Flask==3.0.3", "Flask-JWT-Extended==4.6.0", - "Jinja2==3.1.4", + "Jinja2>=3.1.6,<4", "MarkupSafe==2.1.5", "six==1.16.0", "typing-extensions>=4.8.0", - "Werkzeug==3.0.4", + "Werkzeug>=3.1.2,<4", "pytest==8.3.2", "flake8==3.9.2", "coverage==4.5.4",