diff --git a/.cruft.json b/.cruft.json index f535bce4328a34766bf1b8aada8a2255db176c57..47aecf871362832e5aaa8c47aa01911088fbaba2 100644 --- a/.cruft.json +++ b/.cruft.json @@ -35,7 +35,7 @@ "default_topic": "capice-data", "render_backend": "yes", "render_api": "yes", - "include_docker_setup": "yes", + "include_docker_setup": "no", "__ci_build_stage": "no", "_extensions": [ "local_extensions.UnderlinedExtension" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c8a98fc4b12a84fee6f3825a001a3ea5e794b93..04163222c70ab722acf5120a237e655cbe73202e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: python:3.9 +image: python:3.11 variables: PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" @@ -12,41 +12,6 @@ before_script: - apt-get update -y && apt-get install -y pandoc graphviz - python -m pip install -U pip -.dind-setup: &dind-setup - tags: - - dind - image: docker:20.10 - services: - - docker:20.10-dind - variables: - DJANGO_IMAGE_BASE: "${CI_REGISTRY_IMAGE}/django" - DJANGO_IMAGE: "${DJANGO_IMAGE_BASE}:$CI_COMMIT_SHORT_SHA" - DASF_IMAGE_BASE: "${CI_REGISTRY_IMAGE}/dasf" - DASF_IMAGE: "${DASF_IMAGE_BASE}:$CI_COMMIT_SHORT_SHA" - before_script: - - echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY - - docker info - - echo "DJANGO_IMAGE=${DJANGO_IMAGE}" >> .env - - echo "DASF_IMAGE=${DASF_IMAGE}" >> .env - -build-django: - <<: *dind-setup - only: - - pushes - stage: build - script: - - docker compose -f docker-compose.dev.yml build django - - docker compose -f docker-compose.dev.yml push django - -build-dasf: - <<: *dind-setup - only: - - pushes - stage: build - script: - - docker compose -f docker-compose.dev.yml build dasf - - docker compose -f docker-compose.dev.yml push dasf - test-package: stage: test script: @@ -65,6 +30,12 @@ test: - make dev-install - make test coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' + artifacts: + name: pipfile + paths: + - "test.log" + expire_in: 30 days + test-docs: stage: test @@ -76,23 +47,6 @@ test-docs: paths: - docs/_build -test-docker: - <<: *dind-setup - only: - - pushes - stage: test - needs: - - build-django - - build-dasf - script: - # test connecting the dasf backend module to the message broker - - >- - docker compose - -f docker-compose.dev.yml - -f ci/docker-compose.test.yml - up - --exit-code-from dasf-api - deploy-package: stage: deploy @@ -118,28 +72,3 @@ pages: - public only: - main - - -deploy-django: - <<: *dind-setup - only: - - main - needs: - - test-docker - stage: deploy - script: - - docker pull ${DJANGO_IMAGE} - - docker tag ${DJANGO_IMAGE} ${DJANGO_IMAGE_BASE}:latest - - docker push ${DJANGO_IMAGE_BASE}:latest - -deploy-dasf: - <<: *dind-setup - only: - - main - needs: - - test-docker - stage: deploy - script: - - docker pull ${DASF_IMAGE} - - docker tag ${DASF_IMAGE} ${DASF_IMAGE_BASE}:latest - - docker push ${DASF_IMAGE_BASE}:latest diff --git a/Dockerfile b/Dockerfile index 89ac49c1c8cc37337d57d8547ad532236b6172ee..604f83603daed107458c8754750db4b05a9485ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi9/python-39 +FROM registry.access.redhat.com/ubi9/python-311 # Add application sources to a directory that the assemble script expects them # and set permissions so that the container runs without root access diff --git a/capice_data/api.py b/capice_data/api.py index dafa33fcb0341f16fb98e920610cf52e1f5d005c..773df7e3b0d9b9bf5f0443108a3902706d7fe3e3 100644 --- a/capice_data/api.py +++ b/capice_data/api.py @@ -126,4 +126,3 @@ BackendModule = _creator( class_name="BackendModule", members=[version_info, request_file, download_file], ) - diff --git a/ci/docker-compose.test.yml b/ci/docker-compose.test.yml deleted file mode 100644 index 973b46a61bd025113d6a16cfbd9b680056c19d32..0000000000000000000000000000000000000000 --- a/ci/docker-compose.test.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Test setup for the API -services: - dasf-api: - image: "${DASF_IMAGE:-capice-data-backend-dasf}" - hostname: "${DASF_API_HOST:-dasf-api}" - environment: - DE_LOGGING_LEVEL: "10" - DE_BACKEND_WEBSOCKET_URL: ws://${DJANGO_HOST:-django}:8080/ws - networks: - - frontend - depends_on: - dasf: - condition: service_started - command: >- - bash -xc - " - sed -i 's|ws://localhost:8000|ws://${DJANGO_HOST:-django}:8080|' capice_data/api.py; - python -c 'from capice_data.api import version_info; print(version_info())' - " diff --git a/django/Dockerfile b/django/Dockerfile deleted file mode 100644 index b4d3966eaf389d0665139fb3cc1b912b910c2bc2..0000000000000000000000000000000000000000 --- a/django/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM registry.access.redhat.com/ubi9/python-39 - -ENV ENABLE_INIT_WRAPPER=1 - -# Add application sources to a directory that the assemble script expects them -# and set permissions so that the container runs without root access -USER 0 - -ADD . /tmp/src -RUN chmod u+x /tmp/src/app.sh && /usr/bin/fix-permissions /tmp/src - -USER 1001 - -# Install the dependencies -RUN /usr/libexec/s2i/assemble - -# Set the default command for the resulting image -CMD /usr/libexec/s2i/run diff --git a/django/app.sh b/django/app.sh deleted file mode 100644 index ef79a603df108ca98c92244bfe1dfeb907f57f17..0000000000000000000000000000000000000000 --- a/django/app.sh +++ /dev/null @@ -1,5 +0,0 @@ -python manage.py migrate - -python manage.py dasf_topic -n capice-data --anonymous - -python manage.py runserver 0.0.0.0:8080 diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml deleted file mode 100644 index d87db51caf2ce4902dcc20fa1eff0b2febea521c..0000000000000000000000000000000000000000 --- a/docker-compose.dev.yml +++ /dev/null @@ -1,44 +0,0 @@ -# docker-compose setup for running a message broker and the backend module -# -# Run this via:: -# -# docker compose -f docker-compose.dev.yml up --build -version: "3.7" - -networks: - frontend: - backend: - -services: - - django: - # background django process to populate initial xml files - build: django - image: "${DJANGO_IMAGE:-capice-data-backend-django}" - hostname: "${DJANGO_HOST:-django}" - ports: - - "8000:8080" - expose: - - "8080" - healthcheck: - test: curl --fail http://localhost:8080/admin/ - interval: 10s - retries: 5 - start_period: 10s - timeout: 5s - networks: - - backend - - frontend - - dasf: - build: "." - image: "${DASF_IMAGE:-capice-data-backend-dasf}" - hostname: "${DASF_HOST:-dasf}" - environment: - DE_LOGGING_LEVEL: "10" - DE_BACKEND_WEBSOCKET_URL: ws://${DJANGO_HOST:-django}:8080/ws - networks: - - backend - depends_on: - django: - condition: service_healthy diff --git a/docs/installation.md b/docs/installation.md index 00fa33e5f6ad647cae98397c5ff5eb71241167fb..41c5a1c8336f720c1ac3a33ab043edce9af095d2 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -78,25 +78,3 @@ DE_BACKEND_WEBSOCKET_URL=ws://0.0.0.0:8000/ws \ DE_BACKEND_TOPIC=capice-data \ python -c "from capice_data.api import version_info; print(version_info())" ``` - -### DASF setup via docker compose -If you have `docker` or `podman` available, you can also setup a development -environment via the `docker-compose.dev.yml` file in the source code repository. - -1. Build the images - - ```bash - docker compose -f docker-compose.dev.yml build - ``` -2. start the message broker and the backend module - - ```bash - docker compose -f docker-compose.dev.yml up - ``` -3. make request via the autogenerated API - - ```bash - DE_BACKEND_WEBSOCKET_URL=ws://0.0.0.0:8000/ws \ - DE_BACKEND_TOPIC=capice-data \ - python -c "from capice_data.api import version_info; print(version_info())" - ``` diff --git a/tox.ini b/tox.ini index 256ea7c5f1268e5ce2a5cd29b75a036a968563eb..94836fe7448ebe5eef4f40bc4824637b26a7d450 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,10 @@ [testenv] setenv = PYTHONPATH = django/:{env:PYTHONPATH:''} + DE_LOGGING_LEVEL = 10 + ; to be able to capture the logging from subprocesses, we log everything + ; to test.log + DE_LOGGING_LOGFILE = test.log deps = -rrequirements.txt