Add job to delete stale nodes older than 24H on RS 91/56991/8
authorAnil Belur <abelur@linuxfoundation.org>
Sat, 13 May 2017 02:47:02 +0000 (12:47 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Mon, 22 May 2017 01:54:59 +0000 (11:54 +1000)
- All jobs are expected to complete within 24H atmost, this job
removes nodes on RS with creation time older than 24H.
- Reorder the jobs alphabetically.
- Use global-jjb lftools script

Note: this change requires an upstream change to be merged
in lftools for running successfully.
https://gerrit.linuxfoundation.org/infra/4861
Change-Id: Id37a73ce8b1f785cdfd52507bafdfbeda00f3c9f
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
jjb/opendaylight-infra-cleanup-stale-nodes.sh [new file with mode: 0644]
jjb/releng-jobs.yaml

diff --git a/jjb/opendaylight-infra-cleanup-stale-nodes.sh b/jjb/opendaylight-infra-cleanup-stale-nodes.sh
new file mode 100644 (file)
index 0000000..e8f1c83
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# Todo: As a safe check we could obtain the list of active jobs from Jenkins and
+# compute the checksum from $JOB_NAME to check if any active nodes exist and
+# skip deleting those nodes. This step may not be required since there is already
+# 24H timeout in place for all jobs therefore all jobs are expected to complete
+# within the timeout.
+
+lftools openstack --os-cloud rackspace \
+    server list --days=1
+lftools openstack --os-cloud rackspace \
+    server cleanup --days=1
index 7fe94b94292015b18d36a1ca91d3c30afecbfed3..0a28cb1280cad347cd05a9f9e599c43b7dc33d7a 100644 (file)
@@ -5,10 +5,12 @@
       - '{project-name}-ci-jobs'
       - '{project-name}-verify-tox-{stream}'
       - 'builder-check-poms'
+      # Packer jobs
       - 'builder-verify-packer'
       - 'builder-merge-packer-{platforms}-{templates}'
       # OpenStack Related
       - 'builder-cleanup-old-images'
+      - 'builder-delete-stale-nodes'
       - 'builder-delete-stale-stacks'
       # Automation for docs and jobs
       - 'builder-update-csit-tests'
       - opendaylight-infra-shiplogs:
           maven-version: 'mvn33'
 
+
 - job-template:
-    name: 'builder-delete-stale-stacks'
+    name: 'builder-cleanup-old-images'
     project-type: freestyle
     node: centos7-java-builder-2c-4g
 
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts}'
 
+    scm:
+      - git-scm:
+          branch: '{branch}'
+
     wrappers:
       - opendaylight-infra-wrappers:
           build-timeout: '{build-timeout}'
+      # Listed after to override openstack-infra-wrappers clouds.yaml definition
+      - config-file-provider:
+          files:
+            - file-id: opendaylight-private-clouds-yaml
+              target: '$HOME/.config/openstack/clouds.yaml'
 
     triggers:
-      # Attempt to clear up stacks every 30 mins in case we have orphaned stacks
-      - timed: '0,30 * * * *'
+      # Cleanup images on a weekly schedule
+      - timed: '@weekly'
 
     builders:
-      - shell: !include-raw-escape: opendaylight-infra-cleanup-stale-stacks.sh
+      - shell: !include-raw-escape: opendaylight-infra-cleanup-old-images.sh
 
     publishers:
       - email-notification:
       - opendaylight-infra-shiplogs:
           maven-version: 'mvn33'
 
+
 - job-template:
-    name: 'builder-cleanup-old-images'
+    name: 'builder-delete-stale-nodes'
     project-type: freestyle
     node: centos7-java-builder-2c-4g
 
           refspec: 'refs/heads/{branch}'
           artifacts: '{archive-artifacts}'
 
-    scm:
-      - git-scm:
+    wrappers:
+      - opendaylight-infra-wrappers:
+          build-timeout: '{build-timeout}'
+
+    triggers:
+      # Attempt to clear up stacks every 30 mins in case we have orphaned stacks
+      - timed: '0,30 * * * *'
+
+    builders:
+      - shell: !include-raw-escape:
+          - global-jjb/shell/lftools-install.sh
+          - opendaylight-infra-cleanup-stale-nodes.sh
+
+    publishers:
+      - email-notification:
+          email-recipients: '{email-recipients}'
+          email-prefix: '[releng]'
+      - opendaylight-infra-shiplogs:
+          maven-version: 'mvn33'
+
+
+- job-template:
+    name: 'builder-delete-stale-stacks'
+    project-type: freestyle
+    node: centos7-java-builder-2c-4g
+
+    properties:
+      - opendaylight-infra-properties:
+          build-days-to-keep: 7
+
+    parameters:
+      - opendaylight-infra-parameters:
+          os-cloud: '{os-cloud}'
+          project: '{project}'
           branch: '{branch}'
+          refspec: 'refs/heads/{branch}'
+          artifacts: '{archive-artifacts}'
 
     wrappers:
       - opendaylight-infra-wrappers:
           build-timeout: '{build-timeout}'
-      # Listed after to override openstack-infra-wrappers clouds.yaml definition
-      - config-file-provider:
-          files:
-            - file-id: opendaylight-private-clouds-yaml
-              target: '$HOME/.config/openstack/clouds.yaml'
 
     triggers:
-      # Cleanup images on a weekly schedule
-      - timed: '@weekly'
+      # Attempt to clear up stacks every 30 mins in case we have orphaned stacks
+      - timed: '0,30 * * * *'
 
     builders:
-      - shell: !include-raw-escape: opendaylight-infra-cleanup-old-images.sh
+      - shell: !include-raw-escape: opendaylight-infra-cleanup-stale-stacks.sh
 
     publishers:
       - email-notification:
       - opendaylight-infra-shiplogs:
           maven-version: 'mvn33'
 
+
 - job-template:
     name: 'builder-update-image-list'
     project-type: freestyle