Add macro to delete an openstack heat stack 72/12672/3
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 20 Sep 2018 01:07:25 +0000 (21:07 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 20 Sep 2018 15:07:03 +0000 (11:07 -0400)
This is migrated from OpenDaylight's releng/builder project.

Issue: RELENG-236
Change-Id: I3da707ea8315c861183b536114a7e32595e78c1f
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
.jjb-test/lf-openstack.yaml [new file with mode: 0644]
docs/jjb/lf-macros.rst
jjb/lf-macros.yaml
releasenotes/notes/stack-delete-7364d1da61f49b1c.yaml [new file with mode: 0644]

diff --git a/.jjb-test/lf-openstack.yaml b/.jjb-test/lf-openstack.yaml
new file mode 100644 (file)
index 0000000..5b11b59
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- job:
+    name: openstack-tester
+    parameters:
+      - string:
+          name: STACK_NAME
+          default: test-lf-stack-delete
+    publishers:
+      - lf-stack-delete
index 1fac043..ce7ac0d 100644 (file)
@@ -295,6 +295,18 @@ Provides basic lf-infra recommended publisher configurations which should be
 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
 ===
 
index 10b070d..d59a964 100644 (file)
             - '**/*.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 #
 #######
diff --git a/releasenotes/notes/stack-delete-7364d1da61f49b1c.yaml b/releasenotes/notes/stack-delete-7364d1da61f49b1c.yaml
new file mode 100644 (file)
index 0000000..8100e1b
--- /dev/null
@@ -0,0 +1,8 @@
+---
+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.