diff --git a/Jenkinsfile b/Jenkinsfile index dc857c316c1cc..3854192200ca2 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-08-10T11:53:48.439484 +// Generated at 2022-08-11T10:26:17.191200 import org.jenkinsci.plugins.pipeline.modeldefinition.Utils // NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. --> @@ -5418,6 +5418,128 @@ def deploy() { } } } + if (env.BRANCH_NAME == 'main' && env.RETAG_STAGING_IMAGES == 'yes') { + withCredentials([string( + credentialsId: 'dockerhub-tlcpack-key', + variable: 'TLCPACK_TOKEN', + )]) { + try { + sh( + script: 'echo $TLCPACK_TOKEN | docker login --username octomldriazati --password-stdin', + label: 'Log in to Docker Hub' + ) + if (ci_arm.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_arm.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_arm:${tag} + docker tag tlcpackstaging/ci_arm:${tag} tlcpack/ci-arm:${tag} + docker push tlcpack/ci-arm:${tag} + """, + label: 'Tag tlcpackstaging/ci_arm image to tlcpack', + ) + } + if (ci_cpu.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_cpu.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_cpu:${tag} + docker tag tlcpackstaging/ci_cpu:${tag} tlcpack/ci-cpu:${tag} + docker push tlcpack/ci-cpu:${tag} + """, + label: 'Tag tlcpackstaging/ci_cpu image to tlcpack', + ) + } + if (ci_gpu.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_gpu.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_gpu:${tag} + docker tag tlcpackstaging/ci_gpu:${tag} tlcpack/ci-gpu:${tag} + docker push tlcpack/ci-gpu:${tag} + """, + label: 'Tag tlcpackstaging/ci_gpu image to tlcpack', + ) + } + if (ci_hexagon.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_hexagon.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_hexagon:${tag} + docker tag tlcpackstaging/ci_hexagon:${tag} tlcpack/ci-hexagon:${tag} + docker push tlcpack/ci-hexagon:${tag} + """, + label: 'Tag tlcpackstaging/ci_hexagon image to tlcpack', + ) + } + if (ci_i386.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_i386.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_i386:${tag} + docker tag tlcpackstaging/ci_i386:${tag} tlcpack/ci-i386:${tag} + docker push tlcpack/ci-i386:${tag} + """, + label: 'Tag tlcpackstaging/ci_i386 image to tlcpack', + ) + } + if (ci_lint.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_lint.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_lint:${tag} + docker tag tlcpackstaging/ci_lint:${tag} tlcpack/ci-lint:${tag} + docker push tlcpack/ci-lint:${tag} + """, + label: 'Tag tlcpackstaging/ci_lint image to tlcpack', + ) + } + if (ci_cortexm.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_cortexm.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_cortexm:${tag} + docker tag tlcpackstaging/ci_cortexm:${tag} tlcpack/ci-cortexm:${tag} + docker push tlcpack/ci-cortexm:${tag} + """, + label: 'Tag tlcpackstaging/ci_cortexm image to tlcpack', + ) + } + if (ci_wasm.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_wasm.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/ci_wasm:${tag} + docker tag tlcpackstaging/ci_wasm:${tag} tlcpack/ci-wasm:${tag} + docker push tlcpack/ci-wasm:${tag} + """, + label: 'Tag tlcpackstaging/ci_wasm image to tlcpack', + ) + } + } finally { + sh( + script: 'docker logout', + label: 'Clean up login credentials' + ) + } + } + } if (env.BRANCH_NAME == 'main' && env.DEPLOY_DOCKER_IMAGES == 'yes' && rebuild_docker_images && upstream_revision != null) { node('CPU') { ws("workspace/exec_${env.EXECUTOR_NUMBER}/tvm/deploy-docker") { diff --git a/ci/jenkins/Deploy.groovy.j2 b/ci/jenkins/Deploy.groovy.j2 index 636fcdb5a96f2..425eef57ebbce 100644 --- a/ci/jenkins/Deploy.groovy.j2 +++ b/ci/jenkins/Deploy.groovy.j2 @@ -90,6 +90,39 @@ def deploy() { } } } + if (env.BRANCH_NAME == 'main' && env.RETAG_STAGING_IMAGES == 'yes') { + withCredentials([string( + credentialsId: 'dockerhub-tlcpack-key', + variable: 'TLCPACK_TOKEN', + )]) { + try { + sh( + script: 'echo $TLCPACK_TOKEN | docker login --username octomldriazati --password-stdin', + label: 'Log in to Docker Hub' + ) + {% for image in images %} + if ({{ image.name }}.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = {{ image.name }}.split(":")[1] + sh( + script: """ + set -eux + docker pull tlcpackstaging/{{ image.name }}:${tag} + docker tag tlcpackstaging/{{ image.name }}:${tag} tlcpack/{{ image.name.replace("_", "-") }}:${tag} + docker push tlcpack/{{ image.name.replace("_", "-") }}:${tag} + """, + label: 'Tag tlcpackstaging/{{ image.name }} image to tlcpack', + ) + } + {% endfor %} + } finally { + sh( + script: 'docker logout', + label: 'Clean up login credentials' + ) + } + } + } if (env.BRANCH_NAME == 'main' && env.DEPLOY_DOCKER_IMAGES == 'yes' && rebuild_docker_images && upstream_revision != null) { node('CPU') { ws({{ m.per_exec_ws('tvm/deploy-docker') }}) {