You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ar...@apache.org on 2022/05/18 17:55:33 UTC

[tvm] 33/36: build and test with img

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

areusch pushed a commit to branch areusch/freeze-dependencies
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 51874ddac6409086989132dd2f6b959b2dded6bb
Author: Andrew Reusch <ar...@gmail.com>
AuthorDate: Tue May 17 13:47:12 2022 -0700

    build and test with img
---
 Jenkinsfile            | 20 +++++++++++---------
 docker/build.sh        | 22 ++++++++++++----------
 jenkins/Jenkinsfile.j2 |  4 +++-
 3 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index cb36f5b582..d7642bd515 100755
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -45,7 +45,7 @@
 // 'python3 jenkins/generate.py'
 // Note: This timestamp is here to ensure that updates to the Jenkinsfile are
 // always rebased on main before merging:
-// Generated at 2022-05-17T10:23:30.174515
+// Generated at 2022-05-17T13:48:28.023057
 
 import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
 // NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. -->
@@ -428,6 +428,8 @@ def build_image(image_name) {
     script: "docker rmi ${full_name}",
     label: 'Remove docker image'
   )
+
+  return full_name
 }
 
 if (rebuild_docker_images) {
@@ -448,7 +450,7 @@ if (rebuild_docker_images) {
         node('ARM') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_arm')
+            ci_arm = build_image('ci_arm')
           }
         }
       },
@@ -456,7 +458,7 @@ if (rebuild_docker_images) {
         node('CPU') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_cpu')
+            ci_cpu = build_image('ci_cpu')
           }
         }
       },
@@ -464,7 +466,7 @@ if (rebuild_docker_images) {
         node('CPU') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_gpu')
+            ci_gpu = build_image('ci_gpu')
           }
         }
       },
@@ -472,7 +474,7 @@ if (rebuild_docker_images) {
         node('CPU') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_hexagon')
+            ci_hexagon = build_image('ci_hexagon')
           }
         }
       },
@@ -480,7 +482,7 @@ if (rebuild_docker_images) {
         node('CPU') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_i386')
+            ci_i386 = build_image('ci_i386')
           }
         }
       },
@@ -488,7 +490,7 @@ if (rebuild_docker_images) {
         node('CPU') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_lint')
+            ci_lint = build_image('ci_lint')
           }
         }
       },
@@ -496,7 +498,7 @@ if (rebuild_docker_images) {
         node('CPU') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_qemu')
+            ci_qemu = build_image('ci_qemu')
           }
         }
       },
@@ -504,7 +506,7 @@ if (rebuild_docker_images) {
         node('CPU') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('ci_wasm')
+            ci_wasm = build_image('ci_wasm')
           }
         }
       },
diff --git a/docker/build.sh b/docker/build.sh
index f495bba8d0..ee09c5a01e 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -162,29 +162,31 @@ function upsearch () {
         cd .. && upsearch "$1"
 }
 
+# Under Jenkins matrix build, the build tag may contain characters such as
+# commas (,) and equal signs (=), which are not valid inside docker image names.
+# Convert to all lower-case, as per requirement of Docker image names
+function sanitize_docker_name() {
+    echo "$@" | sed -e 's/=/_/g' -e 's/,/-/g' -e 's/\//-/g' | tr '[:upper:]' '[:lower:]'
+}
+
 # Set up WORKSPACE and BUILD_TAG. Jenkins will set them for you or we pick
 # reasonable defaults if you run it outside of Jenkins.
 WORKSPACE="${WORKSPACE:-${SCRIPT_DIR}/../}"
 BUILD_TAG=$(echo "${BUILD_TAG:-tvm}" | sed 's/-/--/g' | sed 's/%/-/g')
-DOCKER_IMAGE_TAG="${DOCKER_IMAGE_TAG:-latest}"
 
 # Determine the docker image name
-DOCKER_IMG_NAME="${BUILD_TAG}.${CONTAINER_TYPE}"
-
-# Under Jenkins matrix build, the build tag may contain characters such as
-# commas (,) and equal signs (=), which are not valid inside docker image names.
-DOCKER_IMG_NAME=$(echo "${DOCKER_IMG_NAME}" | sed -e 's/=/_/g' -e 's/,/-/g')
-
-# Convert to all lower-case, as per requirement of Docker image names
-DOCKER_IMG_NAME=$(echo "${DOCKER_IMG_NAME}" | tr '[:upper:]' '[:lower:]')
+DOCKER_IMG_NAME=$(echo "${BUILD_TAG}.${CONTAINER_TYPE}" | sanitize_docker_name)
+DOCKER_IMAGE_TAG=$(echo "${DOCKER_IMAGE_TAG:-latest}" | sanitize_docker_name)
 
 # Compose the full image spec with "name:tag" e.g. "tvm.ci_cpu:v0.03"
 DOCKER_IMG_SPEC="${DOCKER_IMG_NAME}:${DOCKER_IMAGE_TAG}"
 
 if [[ -n ${OVERRIDE_IMAGE_SPEC+x} ]]; then
-    DOCKER_IMG_SPEC="$OVERRIDE_IMAGE_SPEC"
+    DOCKER_IMG_SPEC=$(echo "$OVERRIDE_IMAGE_SPEC" | sanitize_docker_name)
 fi
 
+DOCKER_IMG_SPEC=
+
 # Print arguments.
 echo "WORKSPACE: ${WORKSPACE}"
 echo "CI_DOCKER_EXTRA_PARAMS: ${CI_DOCKER_EXTRA_PARAMS[@]}"
diff --git a/jenkins/Jenkinsfile.j2 b/jenkins/Jenkinsfile.j2
index bc1b3c6125..9521c0969c 100644
--- a/jenkins/Jenkinsfile.j2
+++ b/jenkins/Jenkinsfile.j2
@@ -345,6 +345,8 @@ def build_image(image_name) {
     script: "docker rmi ${full_name}",
     label: 'Remove docker image'
   )
+
+  return full_name
 }
 
 if (rebuild_docker_images) {
@@ -366,7 +368,7 @@ if (rebuild_docker_images) {
         node('{{ image.platform }}') {
           timeout(time: max_time, unit: 'MINUTES') {
             init_git()
-            build_image('{{ image.name }}')
+            {{ image.name }} = build_image('{{ image.name }}')
           }
         }
       },