diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5da025980d7c899cea80eb419cfd976036b361e9..d76c9a41f8ec8c18d5464644ee552aebdf28fa15 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,18 +23,24 @@ generate_jobs: expire_in: 1 day build_reposync: - stage: build - tags: - - docker-image-build - script: "echo" # unused but this line is required by GitLab CI + extends: .build_image variables: CONTEXT_DIR: reposync - TO: $CI_REGISTRY_IMAGE/reposync:$CI_COMMIT_REF_NAME + DOCKER_FILE: reposync/Dockerfile + TO: $CI_REGISTRY_IMAGE/reposync + PARENT_PIPELINE_ID: ${CI_PIPELINE_ID} + ARTIFACT_JOB: prepare_dirs stop_deleted: extends: .nomad stage: cleanup script: + - set +e - nomad job status | grep running | cut -d' ' -f1 | grep "^${PREFIX}_reposync_[^\/]\+$" | sort > oldjobs + - set -e - ls *.nomad | sed 's/\.nomad//' | sort > newjobs - - for JOB in `diff --new-line-format="" --unchanged-line-format="" oldjobs newjobs`; do echo -e "\nDeleting job ${JOB}:"; nomad job stop -verbose ${JOB} || true; done + - | + for JOB in $(diff --new-line-format="" --unchanged-line-format="" oldjobs newjobs); do + echo -e "\nDeleting job ${JOB}:" + nomad job stop -verbose ${JOB} || true + done diff --git a/reposync.nomad.tpl b/reposync.nomad.tpl index 9c6c814c6da48aac3239876efac65b69e0a4910d..f0d10fda55243473076de2ae1b383ead486cc932 100644 --- a/reposync.nomad.tpl +++ b/reposync.nomad.tpl @@ -33,8 +33,7 @@ job "${PREFIX}_reposync_${REPOID}" { } config { - image = "https://gitlab-registry.cern.ch/linuxsupport/cronjobs/reposync/reposync:${CI_COMMIT_REF_NAME}" - force_pull = ${FORCE_PULL} + image = "https://gitlab-registry.cern.ch/linuxsupport/cronjobs/reposync/reposync:${CI_COMMIT_SHORT_SHA}" logging { config { tag = "${PREFIX}_reposync"