Support to build docker image with commit id 23/36223/2
authorMatthewLi <matthew.lijun@huawei.com>
Tue, 20 Jun 2017 07:05:38 +0000 (03:05 -0400)
committerMatthewLi <matthew.lijun@huawei.com>
Tue, 20 Jun 2017 07:59:54 +0000 (03:59 -0400)
JIRA: DOVETAIL-447

this support dovetail to make tag/container snapshot at some
commit id

this will also used for functest/yardstick if needed, since their danube.2.0/3.0
may not satisfy dovetail requirements, while their snapshots at some commit id
satisfy.

Change-Id: I76cf6df586d1c9f0f563c6bfc039e3e271dc3de8
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
jjb/releng/opnfv-docker.sh
jjb/releng/opnfv-docker.yml

index 2aa52ad..ebd0c9f 100644 (file)
@@ -73,6 +73,8 @@ fi
 # Get tag version
 echo "Current branch: $BRANCH"
 
+BUILD_BRANCH=$BRANCH
+
 if [[ "$BRANCH" == "master" ]]; then
     DOCKER_TAG="latest"
 elif [[ -n "${RELEASE_VERSION-}" ]]; then
@@ -82,19 +84,17 @@ else
     DOCKER_TAG="stable"
 fi
 
+if [[ -n "${COMMIT_ID-}" && -n "${RELEASE_VERSION-}" ]]; then
+    DOCKER_TAG=$RELEASE_VERSION
+    BUILD_BRANCH=$COMMIT_ID
+fi
+
 # Start the build
 echo "Building docker image: $DOCKER_REPO_NAME:$DOCKER_TAG"
 echo "--------------------------------------------------------"
 echo
-if [[ $DOCKER_REPO_NAME == *"dovetail"* ]]; then
-    if [[ -n "${RELEASE_VERSION-}" ]]; then
-        DOCKER_TAG=${RELEASE_VERSION}
-    fi
-    cmd="docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_TAG -f $DOCKERFILE ."
-else
-    cmd="docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_TAG --build-arg BRANCH=$BRANCH
-        -f $DOCKERFILE ."
-fi
+cmd="docker build --no-cache -t $DOCKER_REPO_NAME:$DOCKER_TAG --build-arg BRANCH=$BUILD_BRANCH
+    -f $DOCKERFILE ."
 
 echo ${cmd}
 ${cmd}
index 5fe0eb9..095ba41 100644 (file)
             name: DOCKER_REPO_NAME
             default: "opnfv/{project}"
             description: "Dockerhub repo to be pushed to."
+        - string:
+            name: COMMIT_ID
+            default: ""
+            description: "commit id to make a snapshot docker image"
         - string:
             name: RELEASE_VERSION
             default: ""