Allow image protection script to be disabled
[releng/global-jjb.git] / jjb / lf-ci-jobs.yaml
index da70ba3..2ede3e7 100644 (file)
     git-url: '$GIT_URL/$PROJECT'
     github-url: 'https://github.com'
     openstack-cloud: vex
+    openstack-image-cleanup: true
+    openstack-image-cleanup-age: 30
+    openstack-image-protect: true
     stream: master
     submodule-timeout: 10
 
       - timed: '{obj:cron}'
 
     builders:
+      - lf-infra-pre-build
       - inject:
           properties-content: OS_CLOUD={openstack-cloud}
-      - shell: !include-raw-escape: ../shell/openstack-install.sh
-      - shell: !include-raw-escape: ../shell/openstack-protect-in-use-images.sh
+      # Images
+      - conditional-step:
+          condition-kind: boolean-expression
+          condition-expression: '{openstack-image-protect}'
+          steps:
+            - shell: !include-raw-escape: ../shell/openstack-protect-in-use-images.sh
+      - conditional-step:
+          condition-kind: boolean-expression
+          condition-expression: '{openstack-image-cleanup}'
+          steps:
+            - inject:
+                properties-content: OS_IMAGE_CLEANUP_AGE={openstack-image-cleanup-age}
+            - shell: !include-raw-escape: ../shell/openstack-cleanup-old-images.sh
 
     publishers:
       - lf-infra-publish