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:
- docker info
image: docker:latest
stages:
- build
- build-cleanup
- deploy
- cleanup
build-image:
stage: build
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:
stage: build-cleanup
deploy-latest:
stage: deploy
script:
- bash -c 'docker rm $(docker ps -qa --no-trunc --filter "status=exited") || :'
when: on_failure
- sh -c "docker rmi argonneeic/base:latest || :"
- 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
script:
- bash -c 'docker rmi argonneeic/base:latest || :'
- docker tag argonneeic/base:$CI_COMMIT_SHA argonneeic/base
- bash deploy.sh
- docker rmi argonneeic/base:$CI_COMMIT_SHA
- sh -c 'docker rmi argonneeic/base:$CI_COMMIT_REF_NAME || :'
- docker tag argonneeic/base:job-$CI_PIPELINE_ID argonneeic/base:$CI_COMMIT_REF_NAME
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWD
- docker push argonneeic/base:$CI_COMMIT_REF_NAME
dependencies: []
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