From: Thanh Ha Date: Thu, 20 Sep 2018 01:07:25 +0000 (-0400) Subject: Add macro to delete an openstack heat stack X-Git-Tag: v0.25.0~2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F72%2F12672%2F3;p=releng%2Fglobal-jjb.git Add macro to delete an openstack heat stack This is migrated from OpenDaylight's releng/builder project. Issue: RELENG-236 Change-Id: I3da707ea8315c861183b536114a7e32595e78c1f Signed-off-by: Thanh Ha --- diff --git a/.jjb-test/lf-openstack.yaml b/.jjb-test/lf-openstack.yaml new file mode 100644 index 00000000..5b11b599 --- /dev/null +++ b/.jjb-test/lf-openstack.yaml @@ -0,0 +1,9 @@ +--- +- job: + name: openstack-tester + parameters: + - string: + name: STACK_NAME + default: test-lf-stack-delete + publishers: + - lf-stack-delete diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index 1fac0433..ce7ac0d2 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -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 === diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index 10b070d8..d59a9644 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -497,6 +497,24 @@ - '**/*.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 index 00000000..8100e1be --- /dev/null +++ b/releasenotes/notes/stack-delete-7364d1da61f49b1c.yaml @@ -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.