diff --git a/Jenkinsfile b/Jenkinsfile index 8b59fe219248d..d144857a05b10 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-07-01T12:43:52.727636 +// Generated at 2022-07-11T10:28:26.048119 import org.jenkinsci.plugins.pipeline.modeldefinition.Utils // NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. --> @@ -3418,6 +3418,117 @@ def deploy() { } } } + if (env.BRANCH_NAME == 'main' && env.RETAG_STAGING_IMAGES == 'yes') { + withCredentials([string( + credentialsId: 'dockerhub-tlcpack-key', + variable: 'TLCPACK_TOKEN', + )]) { + if (ci_arm.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_arm.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_arm/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-arm/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + if (ci_cpu.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_cpu.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_cpu/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-cpu/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + if (ci_gpu.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_gpu.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_gpu/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-gpu/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + if (ci_hexagon.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_hexagon.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_hexagon/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-hexagon/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + if (ci_i386.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_i386.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_i386/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-i386/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + if (ci_lint.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_lint.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_lint/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-lint/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + if (ci_qemu.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_qemu.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_qemu/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-qemu/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + if (ci_wasm.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = ci_wasm.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/ci_wasm/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/ci-wasm/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + } + } 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 0249aaffc5123..434c40abe2fc3 100644 --- a/ci/jenkins/Deploy.groovy.j2 +++ b/ci/jenkins/Deploy.groovy.j2 @@ -86,6 +86,28 @@ def deploy() { } } } + if (env.BRANCH_NAME == 'main' && env.RETAG_STAGING_IMAGES == 'yes') { + withCredentials([string( + credentialsId: 'dockerhub-tlcpack-key', + variable: 'TLCPACK_TOKEN', + )]) { + {% for image in images %} + if ({{ image.name }}.contains("tlcpackstaging")) { + // Push image to tlcpack + def tag = {{ image.name }}.split(":")[1] + sh( + script: """ + set -eux + CONTENT_TYPE="application/vnd.docker.distribution.manifest.v2+json" + MANIFEST=\$(curl -H "Accept: \${CONTENT_TYPE}" "https://hub.docker.com/v2/tlcpackstaging/{{ image.name }}/manifests/${tag}") + curl -X PUT -H "Authorization: Bearer \${TLCPACK_TOKEN}" -H "Content-Type: \${CONTENT_TYPE}" -d "\${MANIFEST}" "https://hub.docker.com/v2/tlcpack/{{ image.name.replace("_", "-") }}/manifests/${tag}" + """, + label: 'Tag tlcpackstaging image to tlcpack', + ) + } + {% endfor %} + } + } 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') }}) {