From ed3aea6c0189414f4a44dc34a3054e7612100fae Mon Sep 17 00:00:00 2001 From: Sylvester Joosten <sjoosten@anl.gov> Date: Tue, 29 Sep 2020 17:07:08 +0000 Subject: [PATCH] Split CI build into separate develop(unstable)/staging(testing)/release(latest) --- .gitlab-ci.yml | 48 +++++++++++++++++++++---- containers/builder/Makefile | 10 ++++++ containers/release/Dockerfile.in | 2 +- containers/release/configure_release.sh | 5 ++- 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e650e4a08..2a93f0ee5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,12 +13,22 @@ builder:stable: only: - tags - master - - staging script: - cd containers/builder - head Dockerfile - make login - make release-cached +builder:testing: + stage: builder + tags: + - silicon + only: + - staging + script: + - cd containers/builder + - head Dockerfile + - make login + - make staging-cached builder:unstable: stage: builder tags: @@ -43,10 +53,24 @@ config:stable: only: - tags - master - - staging needs: ["builder:stable"] script: - - bash containers/release/configure_release.sh + - bash containers/release/configure_release.sh latest + artifacts: + paths: + - config/spack-env.sh + - config/eic-env.sh + - config/Dockerfile +config:testing: + image: eicweb.phy.anl.gov:4567/containers/eic_container/eic_builder:testing + stage: config + tags: + - silicon + only: + - staging + needs: ["builder:testing"] + script: + - bash containers/release/configure_release.sh testing artifacts: paths: - config/spack-env.sh @@ -63,7 +87,7 @@ config:unstable: - staging needs: ["builder:unstable"] script: - - bash containers/release/configure_release.sh + - bash containers/release/configure_release.sh unstable artifacts: paths: - config/spack-env.sh @@ -77,7 +101,6 @@ release:stable: only: - tags - master - - staging needs: ["config:stable"] script: - cp config/Dockerfile containers/release/Dockerfile @@ -85,6 +108,19 @@ release:stable: - cd containers/release - make login - make release-cached +release:testing: + stage: main + tags: + - silicon + only: + - staging + needs: ["config:testing"] + script: + - cp config/Dockerfile containers/release/Dockerfile + - cp config/eic-env.sh containers/release/eic-env.sh + - cd containers/release + - make login + - make staging-cached release:unstable: stage: main tags: @@ -106,7 +142,6 @@ builder:singularity: tags: - singularity only: - - staging - tags needs: ["builder:stable"] when: manual @@ -127,7 +162,6 @@ release:singularity: tags: - singularity only: - - staging - tags needs: ["release:stable"] script: diff --git a/containers/builder/Makefile b/containers/builder/Makefile index a59ed20bf..208ea6f2e 100644 --- a/containers/builder/Makefile +++ b/containers/builder/Makefile @@ -85,8 +85,13 @@ develop: build-nc publish-dev ## Develop build, do not publish latest @echo "Cleaning up" #docker rmi $(APP_NAME):latest +staging: build-nc publish-staging ## Develop build, do not publish latest + @echo "Cleaning up" + #docker rmi $(APP_NAME):latest + release-cached: build publish ## Make a release by building and publishing the `{version}` ans `latest` tagged containers to ECR develop-cached: build login publish-dev ## develop release +staging-cached: build login publish-staging ## develop release publish: login publish-latest publish-version #publish-version ## Publish the `{version}` ans `latest` tagged containers to ECR @echo "Publishing done" @@ -98,6 +103,11 @@ publish-latest: ## Publish the `latest` taged container to ECR docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest #docker rmi $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):latest +publish-staging: ## Publish the `unstable` taged container to ECR + @echo 'publish unstable to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)' + docker tag $(APP_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):testing + docker push $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):testing + publish-dev: ## Publish the `unstable` taged container to ECR @echo 'publish unstable to $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME)' docker tag $(APP_NAME):latest $(REG_NAME)/$(GL_REG_GROUP)/$(APP_NAME):unstable diff --git a/containers/release/Dockerfile.in b/containers/release/Dockerfile.in index ab7684822..6944cb47c 100644 --- a/containers/release/Dockerfile.in +++ b/containers/release/Dockerfile.in @@ -1,7 +1,7 @@ # Release container for Argonne EIC software # Copy over relevant files from builder # -FROM eicweb.phy.anl.gov:4567/containers/eic_container/eic_builder:latest as builder +FROM eicweb.phy.anl.gov:4567/containers/eic_container/eic_builder:@TAG@ as builder RUN cd /opt/spack-environment && spack env activate . && spack gc -y # Strip all the binaries diff --git a/containers/release/configure_release.sh b/containers/release/configure_release.sh index 144cf4d21..8af0a6899 100644 --- a/containers/release/configure_release.sh +++ b/containers/release/configure_release.sh @@ -9,6 +9,8 @@ mkdir -p config cp /etc/profile.d/z10_spack_environment.sh config/spack-env.sh +export TAG=$1 + ## Spack sets the man-path, which stops bash from using the default man-path ## We can fix this by appending a trailing colon to MANPATH sed -i '/MANPATH/ s/;$/:;/' config/spack-env.sh @@ -20,4 +22,5 @@ grep export config/spack-env.sh | \ ## create our release Dockerfile sed '/^@ENV@/r config/eic-env.sh' containers/release/Dockerfile.in | \ - sed '/^@ENV@/d' > config/Dockerfile + sed '/^@ENV@/d' | \ + sed "s/@TAG@/$TAG/" > config/Dockerfile -- GitLab