diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2152d0aa148f2005d07f86efc180887f6165ee10..237cd7c50296abf70100a4792b30676b3787ab82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,9 +35,7 @@ build_reposync: script: "echo" # unused but this line is required by GitLab CI variables: CONTEXT_DIR: reposync - TO: $CI_REGISTRY_IMAGE/do_reposync:latest # latest is the image used in production - only: - - master + TO: $CI_REGISTRY_IMAGE/do_reposync:$CI_COMMIT_REF_NAME build_scheduler: stage: build @@ -46,53 +44,7 @@ build_scheduler: script: "echo" # unused but this line is required by GitLab CI variables: CONTEXT_DIR: scheduler - TO: $CI_REGISTRY_IMAGE/reposync_scheduler:latest # latest is the image used in production - only: - - master - -build_reposync_branch: - stage: build - tags: - - docker-image-build - script: "echo" # unused but this line is required by GitLab CI - variables: - CONTEXT_DIR: reposync - TO: $CI_REGISTRY_IMAGE/do_reposync:$CI_BUILD_REF_NAME # put name of branch in image - except: - - master - -build_scheduler_branch: - stage: build - tags: - - docker-image-build - script: "echo" # unused but this line is required by GitLab CI - variables: - CONTEXT_DIR: scheduler - TO: $CI_REGISTRY_IMAGE/reposync_scheduler:$CI_BUILD_REF_NAME # put name of branch in image - except: - - master - -tag_reposync: - stage: tag - tags: - - docker-image-build - script: "echo" # unused but this line is required by GitLab CI - variables: - CONTEXT_DIR: reposync - TO: $CI_REGISTRY_IMAGE/do_reposync:$CI_COMMIT_TAG - only: - - tags - -tag_scheduler: - stage: tag - tags: - - docker-image-build - script: "echo" # unused but this line is required by GitLab CI - variables: - CONTEXT_DIR: scheduler - TO: $CI_REGISTRY_IMAGE/reposync_scheduler:$CI_COMMIT_TAG - only: - - tags + TO: $CI_REGISTRY_IMAGE/reposync_scheduler:$CI_COMMIT_REF_NAME .nomad_deps_template: &nomad_deps @@ -100,9 +52,9 @@ tag_scheduler: curl https://releases.hashicorp.com/nomad/${NOMAD_VERSION}/nomad_${NOMAD_VERSION}_linux_amd64.zip -o /tmp/nomad.zip && unzip /tmp/vault.zip -d /usr/local/bin/ && unzip /tmp/nomad.zip -d /usr/local/bin/ && - export IMAGE_VER="${CI_COMMIT_TAG:-latest}" && vault read nomad/creds/submitjobs -format=json > token.json && - export `jq -r '"NOMAD_TOKEN=" + .data.secret_id' token.json` + export `jq -r '"NOMAD_TOKEN=" + .data.secret_id' token.json` && + if [ -z ${CI_COMMIT_TAG+x} ]; then export FORCE_PULL="true"; else export FORCE_PULL="false"; fi deploy_test: stage: deploy_test diff --git a/reposync.nomad b/reposync.nomad index 959a5818cca13971c7d0f95f162e57e94438fe6d..96a287c22b9817e74600f60231dcd3e6b4dac708 100644 --- a/reposync.nomad +++ b/reposync.nomad @@ -12,7 +12,8 @@ job "${JOB_PREFIX}reposync" { driver = "docker" config { - image = "https://gitlab-registry.cern.ch/linuxsupport/containers/reposync_test/do_reposync:${IMAGE_VER}" + image = "https://gitlab-registry.cern.ch/linuxsupport/containers/reposync_test/do_reposync:${CI_COMMIT_REF_NAME}" + force_pull = "${FORCE_PULL}" logging { type = "gelf" config { diff --git a/reposync_oneshot.nomad b/reposync_oneshot.nomad index bb68e3f186db47f45f188fef44a9d6abb454344f..5da4bc092cc413769effb0e6b612541cb2cd6128 100644 --- a/reposync_oneshot.nomad +++ b/reposync_oneshot.nomad @@ -11,7 +11,8 @@ job "${JOB_PREFIX}reposync_oneshot" { driver = "docker" config { - image = "https://gitlab-registry.cern.ch/linuxsupport/containers/reposync_test/reposync_scheduler:${IMAGE_VER}" + image = "https://gitlab-registry.cern.ch/linuxsupport/containers/reposync_test/reposync_scheduler:${CI_COMMIT_REF_NAME}" + force_pull = "${FORCE_PULL}" logging { type = "gelf" config { diff --git a/reposync_scheduler.nomad b/reposync_scheduler.nomad index a2e866daf75e0f7f70812f9518903745134ba159..a1158ff69de5de6a9b9c366ba250ef1f72bfa9b1 100644 --- a/reposync_scheduler.nomad +++ b/reposync_scheduler.nomad @@ -14,7 +14,8 @@ job "${JOB_PREFIX}reposync_scheduler" { driver = "docker" config { - image = "https://gitlab-registry.cern.ch/linuxsupport/containers/reposync_test/reposync_scheduler:${IMAGE_VER}" + image = "https://gitlab-registry.cern.ch/linuxsupport/containers/reposync_test/reposync_scheduler:${CI_COMMIT_REF_NAME}" + force_pull = "${FORCE_PULL}" logging { type = "gelf" config {