Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
bug 1406546: ensure image can be pulled prior to deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
escattone committed Dec 5, 2017
1 parent 24744d7 commit 650c036
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Jenkinsfiles/stage-push.groovy
Expand Up @@ -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.
Expand Down
16 changes: 16 additions & 0 deletions Jenkinsfiles/utils.groovy
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -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}

Expand Down

0 comments on commit 650c036

Please sign in to comment.