From fe4fdf42237d95ba7520777b99b7358311ba7a11 Mon Sep 17 00:00:00 2001
From: Christopher Hubing <chubing@internet2.edu>
Date: Tue, 9 Oct 2018 11:45:25 -0400
Subject: [PATCH] Update Jenkinsfile

---
 Jenkinsfile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 823b222e..a015af5e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,6 +1,7 @@
 
 pipeline {
     agent any
+    def baseImg
     environment { 
         maintainer = "t"
         imagename = 'g'
@@ -52,7 +53,9 @@ pipeline {
             steps {
                 script {
                   try{
-                    sh 'bin/rebuild.sh | tee debug ; test ${PIPESTATUS[0]} -eq 0'
+                      docker.withRegistry('https://registry.hub.docker.com/',   "dockerhub-$maintainer") {
+                        baseImg = docker.build("$maintainer/$imagename", "--no-cache .")
+                      }
                   } catch(error) {
                      def error_details = readFile('./debug');
                      def message = "BUILD ERROR: There was a problem building ${imagename}:${tag}. \n\n ${error_details}"
@@ -80,8 +83,6 @@ pipeline {
         stage('Push') {
             steps {
                 script {
-                   docker.withRegistry('https://registry.hub.docker.com/',   "dockerhub-$maintainer") {
-                      def baseImg = docker.build("$maintainer/$imagename", "--no-cache .")
                       //// scan the image with clair
                       // sh 'docker run -p 5432:5432 -d --name clairdb arminc/clair-db:latest'
                       // sh 'docker run -p 6060:6060 --link clairdb:postgres -d --name clair arminc/clair-local-scan:v2.0.5'
@@ -97,9 +98,7 @@ pipeline {
                       //// bring down after testing
                       //sh 'cd test-compose && docker-compose down'
                       baseImg.push("$tag")
-                      
-                   }
-               }
+                  }
             }
         }
         stage('Notify') {