day1

PROD-18791

Change-Id: I2f47ea12d166676e583323b60d2798f184c8ef9a
diff --git a/Jenkinsfile b/Jenkinsfile
index ce609b7..a30d4f3 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -31,11 +31,16 @@
  *    GLANCE_PROJECT
  *    GLANCE_ARGS
  *    OPENSTACK_API_CLIENT
+ *    IMAGE_NAME - Name of the result image.
+ *    EXTRA_VARIABLES - list of key:value variables required by template.json
  */
 
 // Load shared libs
 common = new com.mirantis.mk.Common()
 
+ArrayList extra_vars = EXTRA_VARIABLES.readLines()
+IMAGE_NAME = IMAGE_NAME + "-" + dateTime
+
 @NonCPS
 def getCleanupImageList(remoteImagesString, imageType, osImage) {
     def remoteImages = remoteImagesString.tokenize("\n")
@@ -89,9 +94,10 @@
 
             stage("build") {
                 dir(BUILD_OS) {
-                    withEnv([String.format("PATH=%s:%s/bin", env.PATH, workspace),
+                    withEnv(extra_vars + [String.format("PATH=%s:%s/bin", env.PATH, workspace),
                         "PACKER_LOG_PATH=${workspace}/packer.log",
                         "PACKER_LOG=1",
+                        "IMAGE_NAME=${IMAGE_NAME}",
                         "TMPDIR=${workspace}/tmp"
                     ]) {
                         if (PACKER_DEBUG == 'true') {