diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c9f2906bdd3d2b0080ab70c6502b1701a0486d5..4e3c6135b9c9dc25286fa21a5bc3232739fdf77f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,13 +9,52 @@ cache: - .cache/pip - /var/lib/docker stages: + - remote_images # - building # - linting # - static-analysis # - unit-tests # - integration-tests # - packaging - - images +# - images +.base_docker_store_images: + stage: remote_images + image: docker:latest + tags: + - privileged + services: + - name: docker:dind + variables: + DOCKER_TLS_CERTDIR: "/certs" + before_script: + - apk add --update make bash + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + script: + - touch /root/.Xauthority + # Hack BASH_SOURCE into sourced files, docker its sh shell won't set this + - export BASH_SOURCE=$(pwd)/bootstrap/etc/lofar20rc.sh + # source the lofarrc file and mask its non zero exit code + - . bootstrap/etc/lofar20rc.sh || true + # Allow docker image script test to execute + - chmod u+x $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh + # Do not remove 'bash' or statement will be ignored by primitive docker shell + - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh +docker_store_images_master_tag: + extends: .base_docker_store_images + only: + - tags + except: +# Anything not master branch is an exception to the only tags rule + - /^(?!master).+@/ +docker_store_images_changes: + extends: .base_docker_store_images + only: + changes: + - docker-compose/.env + except: + refs: + - tags + - master #newline_at_eof: # stage: linting # before_script: @@ -97,26 +136,3 @@ stages: # script: # - cd tangostationcontrol # - python setup.py bdist_wheel -docker_store_images: - stage: images - image: docker:latest - tags: - - privileged - services: - - name: docker:dind - variables: - DOCKER_TLS_CERTDIR: "/certs" - before_script: - - apk add --update make bash docker-compose - - apk add --update bind-tools - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - script: - - touch /root/.Xauthority -# Hack BASH_SOURCE into sourced files, docker its sh shell won't set this - - export BASH_SOURCE=$(pwd)/bootstrap/etc/lofar20rc.sh -# source the lofarrc file and mask its non zero exit code - - . bootstrap/etc/lofar20rc.sh || true -# Allow docker image script test to execute - - chmod u+x $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh -# Do not remove 'bash' or statement will be ignored by primitive docker shell - - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh