diff --git a/.zuul.yaml b/.zuul.yaml index 5fc37dda..d09a01ef 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -29,6 +29,12 @@ jobs: - docker-publish-monasca-base - legacy-monasca-common-localrepo-upload + periodic: + jobs: + - docker-publish-monasca-base + release: + jobs: + - docker-publish-monasca-base - job: name: docker-build-monasca-base @@ -38,8 +44,6 @@ required-projects: - openstack/monasca-common attempts: 1 - files: - - ^docker\/(?!example).* irrelevant-files: - ^.*\.rst$ - ^.*\.md$ diff --git a/docker/build_base_image.sh b/docker/build_base_image.sh index 4db80606..0c37793a 100755 --- a/docker/build_base_image.sh +++ b/docker/build_base_image.sh @@ -10,11 +10,10 @@ BASE_GIT_COMMIT=$(git rev-parse --verify HEAD) [ -z "${BASE_GIT_COMMIT}" ] && echo "No git commit hash found" && exit 1 BASE_CREATION_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") -# Docker tags don't like colons so use shorter version of ISO 8601 for them. -BASE_CREATION_TIME_SHORT=$(date -d "$BASE_CREATION_TIME" -u +"%Y%m%dT%H%M%SZ") + +: "${MONASCA_COMMON_TAG:="master"}" docker build --no-cache \ --build-arg BASE_CREATION_TIME="$BASE_CREATION_TIME" \ --build-arg BASE_GIT_COMMIT="$BASE_GIT_COMMIT" \ - --tag monasca/base:master \ - --tag monasca/base:"$BASE_CREATION_TIME_SHORT" . + --tag monasca/base:"$MONASCA_COMMON_TAG" . diff --git a/playbooks/run.yml b/playbooks/run.yml index 6afc4ba5..bac41e48 100644 --- a/playbooks/run.yml +++ b/playbooks/run.yml @@ -13,6 +13,8 @@ - name: Build monasca-base Docker image shell: "{{ zuul.project.src_dir }}/docker/build_base_image.sh" + environment: + MONASCA_COMMON_TAG: "{{ zuul.tag if zuul.pipeline == 'release' else zuul.branch | basename }}" become: true - name: List images