You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2018/11/07 21:24:16 UTC

[mesos] branch 1.7.x updated: Updated the way to generate tag for CentOS Docker.

This is an automated email from the ASF dual-hosted git repository.

jieyu pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/1.7.x by this push:
     new b0ff3ce  Updated the way to generate tag for CentOS Docker.
b0ff3ce is described below

commit b0ff3ce0564bbc8cc7bf452b9f2f93ed83ae8db0
Author: Jie Yu <yu...@gmail.com>
AuthorDate: Wed Nov 7 13:23:29 2018 -0800

    Updated the way to generate tag for CentOS Docker.
    
    (cherry picked from commit 93621709595a58aad719019c166af1251d50abf6)
---
 support/jenkins/docker-centos.sh | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/support/jenkins/docker-centos.sh b/support/jenkins/docker-centos.sh
index 12cf81c..5c27cf8 100755
--- a/support/jenkins/docker-centos.sh
+++ b/support/jenkins/docker-centos.sh
@@ -15,9 +15,23 @@ DOCKER_IMAGE=${DOCKER_IMAGE:-"mesos/mesos-centos"}
 
 MESOS_SHA=${MESOS_SHA:-$(git rev-parse HEAD)}
 MESOS_TAG_OR_SHA=$(git describe --exact-match "${MESOS_SHA}" 2>/dev/null || echo "${MESOS_SHA}")
-DOCKER_IMAGE_TAG="${MESOS_TAG_OR_SHA}"
+RELEASE_BRANCH=$(git branch --points-at HEAD -r | grep -E 'origin/[0-9]*\.[0-9]*\.x' | grep -E -o '[0-9]*\.[0-9]*\.x' || true)
+
+if [ -z "${RELEASE_BRANCH}" ]; then
+  RELEASE_BRANCH="master"
+fi
+
+DATE=$(date +%F)
+
+if [[ "${MESOS_TAG_OR_SHA}" != "${MESOS_SHA}" ]]; then
+  # HEAD is also a tag.
+  DOCKER_IMAGE_TAG="${MESOS_TAG_OR_SHA}"
+else
+  DOCKER_IMAGE_TAG="${RELEASE_BRANCH}-${DATE}"
+fi
 
 echo "MESOS_SHA=${MESOS_SHA}"
+echo "RELEASE_BRANCH=${RELEASE_BRANCH}"
 echo "DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG}"
 
 function cleanup {
@@ -31,9 +45,5 @@ DOCKER_IMAGE=${DOCKER_IMAGE} \
 DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG} \
 "${SUPPORT_DIR}/packaging/centos/build-docker-centos.sh"
 
-DATE=$(date +%F)
-
-docker tag "${DOCKER_IMAGE}:${DOCKER_IMAGE_TAG}" "${DOCKER_IMAGE}:${DATE}"
 docker login -u "${USERNAME}" -p "${PASSWORD}"
 docker push "${DOCKER_IMAGE}:${DOCKER_IMAGE_TAG}"
-docker push "${DOCKER_IMAGE}:${DATE}"