This is migrated from OpenDaylight's releng/builder project.
Issue: RELENG-236
Change-Id: I3da707ea8315c861183b536114a7e32595e78c1f
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
--- /dev/null
+---
+- job:
+    name: openstack-tester
+    parameters:
+      - string:
+          name: STACK_NAME
+          default: test-lf-stack-delete
+    publishers:
+      - lf-stack-delete
 
 used in all job templates. This primary objective of this trigger is to
 gather build logs and copy them to a log server.
 
+lf-stack-delete
+---------------
+
+Requirements:
+
+* lftools >= v0.17.0
+
+Delete an openstack heat stack. Use at the end of a job that creates a stack.
+
+This macro requires a parameter defined in the job named STACK_NAME
+containing the name of the stack to delete.
+
 SCM
 ===
 
 
             - '**/*.jenkins-trigger'
           fail-build: false
 
+- publisher:
+    name: lf-stack-delete
+    publishers:
+      - postbuildscript:
+          builders:
+            - role: BOTH
+              build-on:
+                - ABORTED
+                - FAILURE
+                - SUCCESS
+                - UNSTABLE
+              build-steps:
+                - shell: |
+                    #!/bin/bash -l
+                    echo "Deleting $STACK_NAME"
+                    lftools openstack stack delete "$STACK_NAME"
+          mark-unstable-if-failed: false
+
 #######
 # SCM #
 #######
 
--- /dev/null
+---
+features:
+  - |
+    Add lf-stack-delete macro to delete an openstack heat stack at the end of
+    the job.
+
+    This macro requires a parameter defined in the job named STACK_NAME
+    containing the name of the stack to delete.