From 650c0363640269f5e89e5e644b485fb703cf7d29 Mon Sep 17 00:00:00 2001 From: rjohnson Date: Mon, 4 Dec 2017 16:42:24 -0700 Subject: [PATCH] bug 1406546: ensure image can be pulled prior to deployment --- Jenkinsfiles/stage-push.groovy | 5 +++++ Jenkinsfiles/utils.groovy | 16 ++++++++++++++++ Makefile | 3 +++ 3 files changed, 24 insertions(+) diff --git a/Jenkinsfiles/stage-push.groovy b/Jenkinsfiles/stage-push.groovy index 389ba627e98..f0fc50b2ad8 100644 --- a/Jenkinsfiles/stage-push.groovy +++ b/Jenkinsfiles/stage-push.groovy @@ -2,6 +2,11 @@ stage("Announce") { utils.announce_push() } +stage("Check Pull") { + // Check that the image can be successfully pulled from the registry. + utils.ensure_pull() +} + stage("Prepare Infra") { // Checkout the "mozmeao/infra" repo's "master" branch into the // "infra" sub-directory of the current working directory. diff --git a/Jenkinsfiles/utils.groovy b/Jenkinsfiles/utils.groovy index 806fa3463dc..2a7ab9f77d6 100644 --- a/Jenkinsfiles/utils.groovy +++ b/Jenkinsfiles/utils.groovy @@ -55,6 +55,22 @@ def notify_irc(Map args) { sh command } +def ensure_pull() { + /* + * This can be used to avoid deploying images to Kubernetes that don't + * exist in the registry, since the deployment to Kubernetes will succeed + * (the deployment just cares that an image URL is provided, not that + * it actually exists) but each pod's image download will then fail + * causing the pod to loop in an image-pull error. + */ + def repo = get_repo_name() + def tag = get_commit_tag() + utils.sh_with_notify( + "make pull-${repo}", + "Ensure pull of ${repo} image ${tag} works" + ) +} + def sh_with_notify(cmd, display, notify_on_success=false) { def nick = "mdn-${env.BRANCH_NAME}" try { diff --git a/Makefile b/Makefile index 7a557d9a98d..68fb80019e4 100644 --- a/Makefile +++ b/Makefile @@ -88,6 +88,9 @@ pull-base: pull-kuma: docker pull ${KUMA_IMAGE} +pull-kumascript: + docker pull ${KUMASCRIPT_IMAGE} + pull-base-latest: docker pull ${BASE_IMAGE_LATEST}