Skip to content

Commit

Permalink
[ci][docker] Tag tlcpackstaging images to tlcpack (#11832)
Browse files Browse the repository at this point in the history
See #11768, this PR changes the deploy workflow so that after a successful build with fallback images (see #11775), they get moved over to tlcpack automatically. Since the images are moving repositories we can't just rename the blobs in docker, so there needs to be a full `pull -> tag -> push` for each image
  • Loading branch information
driazati authored Aug 11, 2022
1 parent 99f5e92 commit de12486
Show file tree
Hide file tree
Showing 3 changed files with 291 additions and 73 deletions.
285 changes: 223 additions & 62 deletions Jenkinsfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 52 additions & 11 deletions ci/jenkins/Deploy.groovy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,21 @@ def deploy_docs() {

def deploy() {
stage('Deploy') {
if (env.BRANCH_NAME == 'main' && env.DOCS_DEPLOY_ENABLED == 'yes') {
node('CPU') {
ws({{ m.per_exec_ws('tvm/deploy-docs') }}) {
if (env.BRANCH_NAME == 'main') {
parallel(
{% call m.deploy_step(
name="Deploy Docs",
feature_flag="env.DOCS_DEPLOY_ENABLED == 'yes'",
ws="tvm/deploy-docs",
) %}
{{ m.download_artifacts(tag='docs', filenames=["docs.tgz"]) }}
deploy_docs()
}
}
}
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') }}) {
{% endcall %}
{% call m.deploy_step(
name="Upload built Docker images",
feature_flag="env.DEPLOY_DOCKER_IMAGES == 'yes' && rebuild_docker_images && upstream_revision != null",
ws="tvm/deploy-docker",
) %}
try {
withCredentials([string(
credentialsId: 'dockerhub-tlcpackstaging-key',
Expand All @@ -118,8 +122,45 @@ def deploy() {
label: 'Clean up login credentials'
)
}
}
}
{% endcall %}
{% call m.deploy_step(
name="Tag tlcpackstaging to tlcpack",
feature_flag="env.DOCS_DEPLOY_ENABLED == 'yes'",
ws="tvm/tag-images",
) %}
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'
)
}
}
{% endcall %}
)
}
}
}
Loading

0 comments on commit de12486

Please sign in to comment.