engine: Create verify jobs for kubernetes stack

Change-Id: I6c87ea34fcd9aa888b797360c6686230982555e9
diff --git a/jjb/engine/scripts/delete-heat-stack.sh b/jjb/engine/scripts/delete-heat-stack.sh
index 2e162fa..2115d6e 100755
--- a/jjb/engine/scripts/delete-heat-stack.sh
+++ b/jjb/engine/scripts/delete-heat-stack.sh
@@ -27,6 +27,19 @@
   exit 0
 fi
 
+# NOTE (fdegir): offline installer removes /opt/engine so we prepare venv ourselves for openstack cli
+if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+  sudo /bin/rm -rf /opt/engine/.venv
+  virtualenv --python python3 --never-download /opt/engine/.venv
+  /bin/cp -f /opt/engine/offline/pip/pip.conf /opt/engine/.venv/
+  set +u
+  source /opt/engine/.venv/bin/activate
+  set -u
+  pip install --upgrade pip
+  pip install -r /opt/engine/offline/git/engine/requirements.txt
+  deactivate
+fi
+
 set +u
 source /opt/engine/.venv/bin/activate
 set -u
diff --git a/jjb/engine/scripts/generate-change-metadata.sh b/jjb/engine/scripts/generate-change-metadata.sh
index 6800422..c9d287b 100755
--- a/jjb/engine/scripts/generate-change-metadata.sh
+++ b/jjb/engine/scripts/generate-change-metadata.sh
@@ -19,10 +19,6 @@
 # ============LICENSE_END=========================================================
 
 
-# NOTES (fdegir): this script only works for
-# - infra/engine
-# - infra/provisioner/heat
-
 set -o nounset
 set -o errexit
 set -o pipefail
@@ -44,23 +40,28 @@
 
 echo "Info  : Generating change metadata"
 
-# TODO (fdegir): this should match to the branch of the job for {stack}-verify jobs
-export STACK_VERSION=master
-
 # determine the project
 # this scripts is used by all engine repos so we need to determine what this change is for
 export ENGINE_COMPONENT="${GERRIT_PROJECT//*\//}"
 
+echo "Info  : Setting STACK_TYPE and STACK_VERSION"
 if [[ "$GERRIT_PROJECT" =~ /stack/ ]]; then
+  # set vars
   export STACK_TYPE="$ENGINE_COMPONENT"
-  echo "Info  : Setting STACK_TYPE, STACK_VERSION and STACK_REFSPEC"
+  export STACK_VERSION="$GERRIT_PATCHSET_REVISION"
+  export STACK_REFSPEC="$GERRIT_REFSPEC"
+
+  # log info to console
   echo "        STACK_TYPE=$STACK_TYPE"
   echo "        STACK_VERSION=$GERRIT_PATCHSET_REVISION"
   echo "        STACK_REFSPEC=$GERRIT_REFSPEC"
+
+  # record vars to properties file
   echo "STACK_TYPE=$STACK_TYPE" >> "$CHANGE_METADATA_FILE"
-  echo "STACK_VERSION=$GERRIT_PATCHSET_REVISION" >> "$CHANGE_METADATA_FILE"
-  echo "STACK_REFSPEC=$GERRIT_REFSPEC" >> "$CHANGE_METADATA_FILE"
+  echo "STACK_VERSION=$STACK_VERSION" >> "$CHANGE_METADATA_FILE"
+  echo "STACK_REFSPEC=$STACK_REFSPEC" >> "$CHANGE_METADATA_FILE"
 elif [[ "$GERRIT_PROJECT" =~ /installer/ ]]; then
+  # set vars
   case "${ENGINE_COMPONENT}" in
     kolla)
       export STACK_TYPE="openstack"
@@ -73,19 +74,31 @@
       ;;
     *) echo "ERROR : Invalid engine component $ENGINE_COMPONENT"; exit 1;;
   esac
+  export STACK_VERSION="$GERRIT_BRANCH"
 
-  echo "Info  : Setting STACK_TYPE, STACK_VERSION and STACK_REFSPEC"
+  # log info to console
   echo "        STACK_TYPE=$STACK_TYPE"
   echo "        STACK_VERSION=$STACK_VERSION"
   echo "        NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_VERSION=$GERRIT_PATCHSET_REVISION"
   echo "        NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_REFSPEC=$GERRIT_REFSPEC"
+
+  # record vars to properties file
   echo "STACK_TYPE=$STACK_TYPE" >> "$CHANGE_METADATA_FILE"
   echo "STACK_VERSION=$STACK_VERSION" >> "$CHANGE_METADATA_FILE"
   echo "NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_VERSION=$GERRIT_PATCHSET_REVISION" >> "$CHANGE_METADATA_FILE"
   echo "NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_REFSPEC=$GERRIT_REFSPEC" >> "$CHANGE_METADATA_FILE"
 else
+  # set vars
   export STACK_TYPE=kubernetes
-  export STACK_VERSION=$STACK_VERSION
+  export STACK_VERSION=$GERRIT_BRANCH
+
+  # log info to console
+  echo "        STACK_TYPE=$STACK_TYPE"
+  echo "        STACK_VERSION=$STACK_VERSION"
+  echo "        NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_VERSION=$GERRIT_PATCHSET_REVISION"
+  echo "        NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_REFSPEC=$GERRIT_REFSPEC"
+
+  # record vars to properties file
   echo "STACK_TYPE=kubernetes" >> "$CHANGE_METADATA_FILE"
   echo "STACK_VERSION=$STACK_VERSION" >> "$CHANGE_METADATA_FILE"
   echo "NORDIX_$(echo $ENGINE_COMPONENT | tr a-z A-Z)_VERSION=$GERRIT_PATCHSET_REVISION" >> "$CHANGE_METADATA_FILE"