Commit 8564b673 authored by David Blyth's avatar David Blyth

CI: modeled after latest TOPSiDE CI

parent 8140bd24
Pipeline #402 passed with stages
in 6 seconds
before_script: image: docker:latest
- docker info
stages: stages:
- build - build
- build-cleanup
- deploy - deploy
- cleanup - cleanup
build-image: build-image:
stage: build stage: build
script: script:
- bash -c 'if [ "$(docker images -f reference=argonneeic/base:$CI_COMMIT_SHA --format {{.Tag}})" == "" ]; then docker build -t argonneeic/base:$CI_COMMIT_SHA --build-arg BUILD_THREADS=20 .; fi' - docker info
- docker build -t argonneeic/base:job-$CI_PIPELINE_ID --build-arg BUILD_THREADS=20 .
cleanup-containers: deploy-latest:
stage: build-cleanup stage: deploy
script: script:
- bash -c 'docker rm $(docker ps -qa --no-trunc --filter "status=exited") || :' - sh -c "docker rmi argonneeic/base:latest || :"
when: on_failure - docker tag argonneeic/base:job-$CI_PIPELINE_ID argonneeic/base
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWD
- docker push argonneeic/base:latest
dependencies: []
only:
- master
deploy-to-dockerhub: deploy-tag:
stage: deploy stage: deploy
script: script:
- bash -c 'docker rmi argonneeic/base:latest || :' - sh -c 'docker rmi argonneeic/base:$CI_COMMIT_REF_NAME || :'
- docker tag argonneeic/base:$CI_COMMIT_SHA argonneeic/base - docker tag argonneeic/base:job-$CI_PIPELINE_ID argonneeic/base:$CI_COMMIT_REF_NAME
- bash deploy.sh - docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWD
- docker rmi argonneeic/base:$CI_COMMIT_SHA - docker push argonneeic/base:$CI_COMMIT_REF_NAME
dependencies: []
only: only:
- master - tags
cleanup-image:
stage: cleanup
script:
- docker rmi argonneeic/base:job-$CI_PIPELINE_ID
dependencies: []
when: always
cleanup-containers:
stage: cleanup
script:
- sh -c 'docker rm $(docker ps -qa --no-trunc --filter "status=exited") || :'
dependencies: []
when: on_failure
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment