Delete stack upon completion

Change-Id: Ie5103efaa6c924d4eddbbd622db3a145b0dfc59a
diff --git a/jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml b/jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml
index 5376bb0..c83da30 100644
--- a/jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml
+++ b/jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml
@@ -104,12 +104,6 @@
 
     properties:
       - logrotate
-#      - build-blocker:
-#          use-build-blocker: true
-#          blocking-jobs:
-#            - 'engine-verify-online-ubuntu1804.*'
-#            - 'engine-verify-offline-ubuntu1804.*'
-#          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
@@ -173,7 +167,6 @@
               node-parameters: true
               kill-phase-on: FAILURE
               abort-all-job: true
-#             enable-condition: "\"$EXECUTION_MODE\" == \"offline-deployment\""
       - multijob:
           name: "{environment-type} deployment and testing"
           condition: SUCCESSFUL
@@ -197,9 +190,8 @@
                 EXECUTION_MODE=$EXECUTION_MODE
                 VERBOSITY=$VERBOSITY
                 DISTRO=$DISTRO
-              property-file: "$WORKSPACE/change.properties"
               kill-phase-on: FAILURE
-              abort-all-job: true
+              abort-all-job: false
             - name: 'engine-verify-{environment-type}-deploy-test-{distro}-city-cloud-master'
               current-parameters: false
               node-parameters: false
@@ -219,7 +211,7 @@
                 VERBOSITY=$VERBOSITY
                 DISTRO=$DISTRO
               kill-phase-on: FAILURE
-              abort-all-job: true
+              abort-all-job: false
 
 - job-template:
     name: 'engine-verify-packaging-{distro}-{stream}'
diff --git a/jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml b/jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml
index 027657a..8ed343a 100644
--- a/jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml
+++ b/jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml
@@ -77,11 +77,11 @@
           description: 'Name of heat-environment file to use.'
       - string:
           name: STACK_NAME
-          default: "nordix-cicd-verify-engine-offline-{distro}-$BUILD_NUMBER"
+          default: "nordix-cicd-verify-engine-online-{distro}-$GERRIT_CHANGE_NUMBER"
           description: 'Name of the created stack'
       - string:
           name: KEYPAIR_NAME
-          default: "keypair-nordix-cicd-verify-offline-engine-{distro}-$BUILD_NUMBER"
+          default: "keypair-nordix-cicd-verify-offline-engine-{distro}-$GERRIT_CHANGE_NUMBER"
           description: 'Name of the created keypair'
       - string:
           name: USE_PREBUILT_DEPLOYMENT_IMAGE
@@ -154,18 +154,20 @@
               node-parameters: true
               kill-phase-on: FAILURE
               abort-all-job: false
-      - conditional-step:
-          condition-kind: and
-          condition-operands:
-            - condition-kind: strings-match
-              condition-string1: $DELETE_STACK
-              condition-string2: true
-            - condition-kind: strings-match
-              condition-string1: $PROVISIONER_TYPE
-              condition-string2: heat
-          on-evaluation-failure: dont-run
-          steps:
-            - 'engine-delete-stack-macro'
+
+    publishers:
+      - postbuildscript:
+          builders:
+            - role: SLAVE
+              build-on:
+                - SUCCESS
+                - FAILURE
+                - ABORTED
+                - NOT_BUILT
+                - UNSTABLE
+              build-steps:
+                - 'engine-wait-pkg-mgr-macro'
+                - 'engine-delete-stack-macro'
 
 - job-template:
     name: 'engine-verify-offline-{phase}-{distro}-{cloud}-{type}-{stream}'
diff --git a/jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml b/jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml
index c295c78..7f3b903 100644
--- a/jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml
+++ b/jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml
@@ -77,11 +77,11 @@
           description: 'Name of heat-environment file to use.'
       - string:
           name: STACK_NAME
-          default: "nordix-cicd-verify-engine-online-{distro}-$BUILD_NUMBER"
+          default: "nordix-cicd-verify-engine-online-{distro}-$GERRIT_CHANGE_NUMBER"
           description: 'Name of the created stack'
       - string:
           name: KEYPAIR_NAME
-          default: "keypair-nordix-cicd-verify-online-engine-{distro}-$BUILD_NUMBER"
+          default: "keypair-nordix-cicd-verify-online-engine-{distro}-$GERRIT_CHANGE_NUMBER"
           description: 'Name of the created keypair'
       - string:
           name: USE_PREBUILT_DEPLOYMENT_IMAGE
@@ -159,18 +159,20 @@
               node-parameters: true
               kill-phase-on: FAILURE
               abort-all-job: false
-      - conditional-step:
-          condition-kind: and
-          condition-operands:
-            - condition-kind: strings-match
-              condition-string1: $DELETE_STACK
-              condition-string2: true
-            - condition-kind: strings-match
-              condition-string1: $PROVISIONER_TYPE
-              condition-string2: heat
-          on-evaluation-failure: dont-run
-          steps:
-            - 'engine-delete-stack-macro'
+
+    publishers:
+      - postbuildscript:
+          builders:
+            - role: SLAVE
+              build-on:
+                - SUCCESS
+                - FAILURE
+                - ABORTED
+                - NOT_BUILT
+                - UNSTABLE
+              build-steps:
+                - 'engine-wait-pkg-mgr-macro'
+                - 'engine-delete-stack-macro'
 
 - job-template:
     name: 'engine-verify-online-{phase}-{distro}-{cloud}-{type}-{stream}'
diff --git a/jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh b/jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh
index da41d0b..f11c4d3 100755
--- a/jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh
+++ b/jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh
@@ -27,6 +27,11 @@
   exit 0
 fi
 
+if [[ "$DELETE_STACK" != "true" || "$PROVISIONER_TYPE" != "heat" ]]; then
+  echo "Info  : Skipping stack delete"
+  exit 0
+fi
+
 set +u
 source /opt/engine/.venv/bin/activate
 set -u