diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3ca32617826c691b0b5909740e8836ac4cdc242..99edba476747213d5ae434a07b9aaf46d4c882af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,7 +44,15 @@ variables: - docker/* - docker/**/* - if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web" # images are rebuild for scheduled or manually triggered pipelines - + + +#Â kaniko needs some configuration, which is the same for all container building jobs +.kaniko_write_config: + before_script: + - uname -a + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json + #Â We use another stage to produce the pinned dependencies files instead of using a multistage # dockerfile to build a base image because @@ -54,9 +62,10 @@ variables: # (not sure about 2, but somehow dependencies are found yet missing if test build follows dev in same stage) generate_pinned_env_files: stage: GeneratePinnedEnvFiles - extends: .build_dev_test_base_images + extends: + - .build_dev_test_base_images image: - name: mambaorg/micromamba:alpine + name: mambaorg/micromamba:debian-slim script: - uname -a - eval "$(micromamba shell hook --shell bash)" @@ -82,14 +91,13 @@ generate_pinned_env_files: build_docker_dev_image: stage: DockerBuildDevTestBaseImages - extends: .build_dev_test_base_images + extends: + - .build_dev_test_base_images + - .kaniko_write_config image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] # overwrite image entrypoint script: - - uname -a - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json - >- /kaniko/executor --context "${CI_PROJECT_DIR}" @@ -100,14 +108,13 @@ build_docker_dev_image: build_docker_test_images: stage: DockerBuildDevTestBaseImages - extends: .build_dev_test_base_images + extends: + - .build_dev_test_base_images + - .kaniko_write_config image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] # overwrite image entrypoint script: - - uname -a - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json - >- /kaniko/executor --context "${CI_PROJECT_DIR}" @@ -118,14 +125,13 @@ build_docker_test_images: build_docker_base_images: stage: DockerBuildDevTestBaseImages - extends: .build_dev_test_base_images + extends: + - .build_dev_test_base_images + - .kaniko_write_config image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] #Â overwrite image entrypoint script: - - uname -a - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json - >- /kaniko/executor --context "${CI_PROJECT_DIR}" @@ -167,6 +173,7 @@ unit_test: - pytest tests/ --cov=rta_reconstruction + --cov-branch --cov-report html:htmlcov --cov-report xml:coverage.xml --cov-report term-missing:skip-covered @@ -248,13 +255,12 @@ build_docker_image_latest: BUILD_DESTINATION: ${DEFAULT_BRANCH_PROD_IMAGE_PERMANENT_LOCATION} BASE_IMAGE_LOCATION: "${DEFAULT_BRANCH_BASE_IMAGE_PERMANENT_LOCATION}" - if: $CI_PIPELINE_SOURCE != "merge_request_event" # Run in all other cases, avoiding merge request pipelines + extends: + - .kaniko_write_config image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] # overwrite image entrypoint script: - - uname -a - - mkdir -p /kaniko/.docker - - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json - >- /kaniko/executor --context "${CI_PROJECT_DIR}" diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 4dc57876d9573368cfc9761d62c2408248922191..c265eb2d374b52d318d34a791d956b46357d1f9f 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -1,4 +1,4 @@ -FROM mambaorg/micromamba:alpine +FROM mambaorg/micromamba:debian-slim # micromamba dockerfile makes use of SHELL. If it is overwritten #Â the auto-activate might not work @@ -10,7 +10,7 @@ FROM mambaorg/micromamba:alpine #Â We need git for setuptools scm to automatically detect version USER root -RUN apk update && apk upgrade --no-cache && apk add git git-lfs +RUN apt update && apt upgrade -y && apt install -y git git-lfs && apt clean && apt autoremove USER $MAMBA_USER # Copy the pinned dependencies file. It is generated in the first CI stage and made an artifact diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 68834ddeacb16b5c55dfae74db99c46db42c6d36..f1b67b0920ff22f7cffb583ccdf54f66e365597e 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -1,4 +1,4 @@ -FROM mambaorg/micromamba:alpine +FROM mambaorg/micromamba:debian-slim # micromamba dockerfile makes use of SHELL. If it is overwritten #Â the auto-activate might not work @@ -10,7 +10,7 @@ FROM mambaorg/micromamba:alpine #Â We need git for setuptools scm to automatically detect version USER root -RUN apk update && apk upgrade --no-cache && apk add git git-lfs +RUN apt update && apt upgrade -y && apt install -y git git-lfs && apt clean && apt autoremove #Â We need to change the permissions on /opt/conda so that other users will be able to modify the environment #Â this is required to let the developers entering the container with their own "uid" to be able to install/modify #Â dependencies. diff --git a/docker/test/Dockerfile b/docker/test/Dockerfile index 11f0bfd928aea2394f8ddda5fde1dd70e0136095..36610bbd318ea1ed8d52d156cf77a1697bd61693 100644 --- a/docker/test/Dockerfile +++ b/docker/test/Dockerfile @@ -1,4 +1,4 @@ -FROM mambaorg/micromamba:alpine +FROM mambaorg/micromamba:debian-slim # micromamba dockerfile makes use of SHELL. If it is overwritten #Â the auto-activate might not work @@ -10,7 +10,7 @@ FROM mambaorg/micromamba:alpine #Â We need git for setuptools scm to automatically detect version USER root -RUN apk update && apk upgrade --no-cache && apk add git git-lfs +RUN apt update && apt upgrade -y && apt install -y git git-lfs && apt clean && apt autoremove #Â We need to change the permissions on /opt/conda so that other users will be able to modify the environment #Â this is required to let the developers entering the container with their own "uid" to be able to install/modify #Â dependencies.