Fix uploading foundation node image to glance

- Properly check for UPLOAD_IMAGE_TO_GLANCE parameter
- Pass OS_* variables to openstack cli

PROD-37197

Change-Id: I9aea93047807325556b2d35b866598031780e13f
diff --git a/jobs/pipelines/packer-image-create.groovy b/jobs/pipelines/packer-image-create.groovy
index 7aa417a..0832cf0 100644
--- a/jobs/pipelines/packer-image-create.groovy
+++ b/jobs/pipelines/packer-image-create.groovy
@@ -77,7 +77,7 @@
             }
 
 
-            if (env.UPLOAD_IMAGE_TO_GLANCE) {
+            if (env.UPLOAD_IMAGE_TO_GLANCE.toBoolean()) {
 
                 stage("Upload generated config drive ISO into volume on cfg01 node") {
                     withCredentials([
@@ -86,10 +86,15 @@
                        passwordVariable: 'OS_PASSWORD',
                        usernameVariable: 'OS_USERNAME']
                     ]) {
-                        env.OS_IDENTITY_API_VERSION = 3
 
                         def imagePath = "tmp/${IMAGE_NAME}/${IMAGE_NAME}.qcow2"
                         shared.run_cmd("""\
+                            export OS_IDENTITY_API_VERSION=3
+                            export OS_AUTH_URL=${env.OS_AUTH_URL}
+                            export OS_USERNAME=${OS_USERNAME}
+                            export OS_PASSWORD=${OS_PASSWORD}
+                            export OS_PROJECT_NAME=${env.OS_PROJECT_NAME}
+                            export OS_USER_DOMAIN_NAME=${env.OS_USER_DOMAIN_NAME}
                             openstack --insecure image delete ${IMAGE_NAME} || true
                             sleep 3
                             openstack --insecure image create ${IMAGE_NAME} --file ${imagePath} --disk-format qcow2 --container-format bare
@@ -111,4 +116,4 @@
             sh "rm -f ./tmp/${IMAGE_NAME}.qcow2 || true"
         } // try
     } // node
-} // timeout
\ No newline at end of file
+} // timeout