[VOL-2993] Add pipeline support to build -profile images

Change-Id: Iad8c9a2984cc08deb6232fe6aa40e343c9173250
diff --git a/jjb/docker-publish.yaml b/jjb/docker-publish.yaml
index f9f878a..d264eb9 100644
--- a/jjb/docker-publish.yaml
+++ b/jjb/docker-publish.yaml
@@ -72,7 +72,13 @@
           default: '{maintainers}'
           description: "The person that sould be notified if this job fails"
 
+      - string:
+          name: extraEnvironmentVars
+          default: '{extraEnvironmentVars}'
+          description: "Provide extra environment variables to the build"
+
     project-type: pipeline
     concurrent: true
+    extraEnvironmentVars: ""
 
     dsl: !include-raw-escape: pipeline/docker-publish.groovy
diff --git a/jjb/pipeline/docker-publish.groovy b/jjb/pipeline/docker-publish.groovy
index a21eda9..3b80806 100644
--- a/jjb/pipeline/docker-publish.groovy
+++ b/jjb/pipeline/docker-publish.groovy
@@ -54,7 +54,7 @@
 
           # Build w/branch
           echo "Building image with branch"
-          make DOCKER_TAG="$branchName" docker-build 2>&1 | tee "$WORKSPACE/docker-build.log"
+          $extraEnvironmentVars DOCKER_TAG="$branchName" make docker-build 2>&1 | tee "$WORKSPACE/docker-build.log"
 
           # Build w/tags if they exist
           if [ -n "$git_tags" ]
@@ -67,7 +67,7 @@
               # remove leading 'v' on funky golang tags
               clean_tag=\$(echo \$tag | sed 's/^v//g')
               echo "Building image with tag: \$clean_tag (should reuse cached layers)"
-              make DOCKER_TAG="\$clean_tag" docker-build
+              $extraEnvironmentVars DOCKER_TAG="\$clean_tag" make docker-build
             done
           fi
         """)
@@ -91,7 +91,7 @@
 
               # Push w/branch
               echo "Pushing image with branch"
-              make DOCKER_TAG="$branchName" docker-push 2>&1 | tee "$WORKSPACE/docker-push.log"
+              $extraEnvironmentVars DOCKER_TAG="$branchName" make docker-push 2>&1 | tee "$WORKSPACE/docker-push.log"
 
               # Push w/tags if they exist
               if [ -n "$git_tags" ]
@@ -103,7 +103,7 @@
                   # remove leading 'v' on funky golang tags
                   clean_tag=\$(echo \$tag | sed 's/^v//g')
                   echo "Pushing image with tag: \$clean_tag (should reuse cached layers)"
-                  make DOCKER_TAG="\$clean_tag" docker-push
+                  $extraEnvironmentVars DOCKER_TAG="\$clean_tag" make docker-push
                 done
               fi
             """)
diff --git a/jjb/verify/voltha-go.yaml b/jjb/verify/voltha-go.yaml
index c40242d..089eaa5 100644
--- a/jjb/verify/voltha-go.yaml
+++ b/jjb/verify/voltha-go.yaml
@@ -41,3 +41,4 @@
           build-timeout: 30
           docker-repo: 'voltha'
           dependency-jobs: 'version-tag'
+          extraEnvironmentVars: BUILD_PROFILED=true
diff --git a/jjb/verify/voltha-openolt-adapter.yaml b/jjb/verify/voltha-openolt-adapter.yaml
index 893ec19..6f9c4c8 100644
--- a/jjb/verify/voltha-openolt-adapter.yaml
+++ b/jjb/verify/voltha-openolt-adapter.yaml
@@ -41,3 +41,4 @@
           build-timeout: 30
           docker-repo: 'voltha'
           dependency-jobs: 'version-tag'
+          extraEnvironmentVars: BUILD_PROFILED=true