[AETHER-1265] Integrate Java profiler in TOST env

Add option to the CI jobs to enable the profiler agent

Change-Id: I45e7805af223f83948d77c67d22c552024840b62
diff --git a/jjb/pipeline/tost-onos-publish.groovy b/jjb/pipeline/tost-onos-publish.groovy
index 1579733..c0feef5 100644
--- a/jjb/pipeline/tost-onos-publish.groovy
+++ b/jjb/pipeline/tost-onos-publish.groovy
@@ -63,6 +63,11 @@
                   export DOCKER_TAG_BUILD_DATE="-$current_date"
                 fi
 
+                # Builds having the profiler enabled
+                if [ ! -z "$PROFILER" ]; then
+                  export DOCKER_TAG_PROFILER="-profiler"
+                fi
+
                 # Build w/extraEnvironmentVars
                 echo "Building image with following vars $extraEnvironmentVars"
                 $extraEnvironmentVars make docker-build 2>&1 | tee "$WORKSPACE/docker-build.log"
@@ -88,10 +93,15 @@
               export DOCKER_REGISTRY="$dockerRegistry/"
               export DOCKER_REPOSITORY="$dockerRepo/"
 
-                # Builds having a build date
-                if [ ! -z "$buildDate" ]; then
-                  export DOCKER_TAG_BUILD_DATE="-$current_date"
-                fi
+              # Builds having a build date
+              if [ ! -z "$buildDate" ]; then
+                export DOCKER_TAG_BUILD_DATE="-$current_date"
+              fi
+
+              # Builds having the profiler enabled
+              if [ ! -z "$PROFILER" ]; then
+                export DOCKER_TAG_PROFILER="-profiler"
+              fi
 
               # Push w/extraEnvironmentVars
               echo "Pushing image with following vars $extraEnvironmentVars"
diff --git a/jjb/templates/tost-onos-jobs.yaml b/jjb/templates/tost-onos-jobs.yaml
index 3e03cf3..f36349d 100644
--- a/jjb/templates/tost-onos-jobs.yaml
+++ b/jjb/templates/tost-onos-jobs.yaml
@@ -91,6 +91,11 @@
           default: '{buildDate}'
           description: "To add the build date to the tag"
 
+      - string:
+          name: PROFILER
+          default: ''
+          description: "To enable the agent profiler"
+
     project-type: pipeline
     concurrent: true
     extraEnvironmentVars: ""