From ede4d520546520a58540b5b1919b6b33da211d1c Mon Sep 17 00:00:00 2001 From: Micah Abbott Date: Thu, 27 Sep 2018 11:09:02 -0400 Subject: [PATCH] treecompose: detect if `buildmaster` exists on registry To bootstrap the change to `buildmaster`, we need to do a quick test if the tag exists on the registry. If it exists, we can pull from it, otherwise we need to use `latest` --- Jenkinsfile.treecompose | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile.treecompose b/Jenkinsfile.treecompose index 680000d9..a6293797 100644 --- a/Jenkinsfile.treecompose +++ b/Jenkinsfile.treecompose @@ -36,7 +36,15 @@ node(NODE) { withCredentials([ usernameColonPassword(credentialsId: params.REGISTRY_CREDENTIALS, variable: 'CREDS'), ]) { - sh """./scripts/pull-mount-oscontainer ${API_CI_REGISTRY} ${treecompose_workdir} ${OSCONTAINER_IMG}""" + def (registryUser, registryPass) = "${CREDS}".split(':') + utils.registry_login(registryUser, registryPass, "${API_CI_REGISTRY}") + sh """ + if ! skopeo inspect docker://${OSCONTAINER_IMG}:buildmaster; then + ./scripts/pull-mount-oscontainer ${API_CI_REGISTRY} ${treecompose_workdir} ${OSCONTAINER_IMG}:latest + else + ./scripts/pull-mount-oscontainer ${API_CI_REGISTRY} ${treecompose_workdir} ${OSCONTAINER_IMG}:buildmaster + fi + """ } }