+ - "{branch}"
+
+##################
+# OPENSTACK CRON #
+##################
+
+- lf_openstack_cron: &lf_openstack_cron
+ name: lf-openstack-cron
+
+ ######################
+ # Default parameters #
+ ######################
+
+ branch: master
+ build-days-to-keep: 7
+ build-timeout: 10
+ cron: "@hourly"
+ disable-job: false
+ 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
+ openstack-port-cleanup: true
+ openstack-server-cleanup: true
+ openstack-stack-cleanup: true
+ openstack-volume-cleanup: true
+ stream: master
+ submodule-timeout: 10
+ submodule-disable: false
+
+ #####################
+ # Job Configuration #
+ #####################
+
+ project-type: freestyle
+ node: "{build-node}"
+ concurrent: false
+ disabled: "{disable-job}"
+
+ properties:
+ - lf-infra-properties:
+ build-days-to-keep: "{build-days-to-keep}"
+
+ parameters:
+ - lf-infra-parameters:
+ project: "{project}"
+ stream: "{stream}"
+ branch: "{branch}"
+ - string:
+ name: JENKINS_URLS
+ default: "{jenkins-urls}"
+ description: |
+ Space separated list of Jenkins URLs to check for active builds.
+
+ wrappers:
+ - lf-infra-wrappers:
+ build-timeout: "{build-timeout}"
+ jenkins-ssh-credential: "{jenkins-ssh-credential}"
+ # Listed after to override openstack-infra-wrappers clouds.yaml definition
+ - config-file-provider:
+ files:
+ - file-id: clouds-yaml
+ target: "$HOME/.config/openstack/clouds.yaml"
+ - file-id: npmrc
+ target: "$HOME/.npmrc"
+ - file-id: pipconf
+ target: "$HOME/.config/pip/pip.conf"
+
+ triggers:
+ - timed: "{obj:cron}"
+
+ builders:
+ - lf-infra-pre-build
+ - inject:
+ properties-content: OS_CLOUD={openstack-cloud}
+ # Stacks
+ - conditional-step:
+ condition-kind: boolean-expression
+ condition-expression: "{openstack-stack-cleanup}"
+ steps:
+ - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-stacks.sh
+ # Servers
+ - conditional-step:
+ condition-kind: boolean-expression
+ condition-expression: "{openstack-server-cleanup}"
+ steps:
+ - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-servers.sh
+ # Ports
+ - conditional-step:
+ condition-kind: boolean-expression
+ condition-expression: "{openstack-port-cleanup}"
+ steps:
+ - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-ports.sh
+ # Volumes
+ - conditional-step:
+ condition-kind: boolean-expression
+ condition-expression: "{openstack-volume-cleanup}"
+ steps:
+ - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-volumes.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
+
+- job-template:
+ name: "{project-name}-openstack-cron"
+ id: gerrit-openstack-cron
+ <<: *lf_openstack_cron
+
+ scm:
+ - lf-infra-gerrit-scm:
+ git-url: "{git-url}"
+ refspec: "refs/heads/{branch}"
+ branch: "{branch}"
+ submodule-recursive: true
+ submodule-timeout: "{submodule-timeout}"
+ submodule-disable: "{submodule-disable}"
+ choosing-strategy: default
+ jenkins-ssh-credential: "{jenkins-ssh-credential}"
+
+- job-template:
+ name: "{project-name}-openstack-cron"
+ id: github-openstack-cron
+ <<: *lf_openstack_cron
+
+ scm:
+ - lf-infra-github-scm:
+ url: "{git-clone-url}{github-org}/{project}"
+ refspec: ""
+ branch: "refs/heads/{branch}"
+ submodule-recursive: true
+ submodule-timeout: "{submodule-timeout}"
+ submodule-disable: "{submodule-disable}"
+ choosing-strategy: default
+ jenkins-ssh-credential: "{jenkins-ssh-credential}"