pull image if it doesn't exist for publishing

On retriggers the image won't rebuild so the publish image
stage will fail since the image doesn't exist that we are
trying to tag and push. Added an if statement to check for
image and pull it if it doesn't exist.

flag = none

Test Plan:
Jenkins passes and retrigger passes.

Change-Id: I215d32874e643fe7d61900e070a3b75688b6efd3
closes: CCI-262
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228562
Reviewed-by: Jacob Powell <spowell@instructure.com>
Reviewed-by: Rex Fleischer <rfleischer@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: James Butters <jbutters@instructure.com>
Product-Review: James Butters <jbutters@instructure.com>
This commit is contained in:
James Butters 2020-03-02 11:56:47 -07:00
parent 27abcefdb3
commit fbba03fa19
1 changed files with 5 additions and 0 deletions

5
Jenkinsfile vendored
View File

@ -322,6 +322,11 @@ pipeline {
steps {
timeout(time: 10) {
script {
// Retriggers won't have an image to tag/push, pull that image if doesn't exist
// If image is not found it will return NULL
if (!sh (script: 'docker images -q $PATCHSET_TAG')) {
sh 'docker pull $PATCHSET_TAG'
}
sh '''
docker tag $PATCHSET_TAG $MERGE_TAG
docker push $MERGE_TAG