Move cleanup stale nodes script to openstack-cron 08/67408/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 22 Jan 2018 01:20:43 +0000 (20:20 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 22 Jan 2018 01:22:05 +0000 (20:22 -0500)
Consolidate job into openstack-cron job to save cloud resources
as these tasks do not take very long to run.

Change-Id: I2bc66c7f567145f217c3e4df254173bc565670e9
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/odl-openstack-cleanup-stale-nodes.sh [moved from jjb/opendaylight-infra-cleanup-stale-nodes.sh with 72% similarity]
jjb/releng-jobs.yaml
jjb/releng-macros.yaml

similarity index 72%
rename from jjb/opendaylight-infra-cleanup-stale-nodes.sh
rename to jjb/odl-openstack-cleanup-stale-nodes.sh
index 2ec19ee8e3736aea19636874b675fcba91203e65..ddd104180613badd389c4da532de706874a6da05 100644 (file)
@@ -1,13 +1,14 @@
 #!/bin/bash
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
-# Copyright (c) 2017 The Linux Foundation and others.
+# Copyright (c) 2017 - 2018 The Linux Foundation and others.
 #
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
 # which accompanies this distribution, and is available at
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
+echo "---> Cleanup stale nodes"
 
 # 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
@@ -15,7 +16,7 @@
 # 24H timeout in place for all jobs therefore all jobs are expected to complete
 # within the timeout.
 
-lftools openstack --os-cloud vex \
-    server list --days=1
-lftools openstack --os-cloud vex \
-    server cleanup --days=1
+# shellcheck source=/tmp/v/lftools/bin/activate disable=SC1091
+source "/tmp/v/lftools/bin/activate"
+lftools openstack --os-cloud vex server list --days=1
+lftools openstack --os-cloud vex server cleanup --days=1
index b4462739b1e661124fa60caad087229c8c9c2ec8..9e2b8d30adf6a54c1b15a86fe7b66414efdab777 100644 (file)
@@ -10,7 +10,6 @@
       - gerrit-tox-verify
       # OpenStack Related
       - 'builder-delete-orphaned-nodes'
-      - 'builder-delete-stale-nodes'
       # Automation for docs and jobs
       - 'builder-update-image-list'
 
       - shell: !include-raw-escape: global-jjb/shell/lftools-install.sh
       # Servers
       - odl-openstack-cleanup-stale-stacks
+      - odl-openstack-cleanup-stale-nodes
       # Images
       - odl-openstack-check-image-protection
       - odl-openstack-cleanup-old-images
           email-prefix: '[releng]'
       - lf-infra-publish
 
-
-- job-template:
-    name: 'builder-delete-stale-nodes'
-    project-type: freestyle
-    node: centos7-builder-2c-1g
-
-    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}'
-
-    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]'
-      - lf-infra-publish
-
 - job-template:
     name: 'builder-update-image-list'
     project-type: freestyle
index 3ea477cc3f276bb9cef11c8d4756908c3122954c..3c824fb113ea4b7f7eb865cd29f9abed8a72a30d 100644 (file)
     builders:
       - shell: !include-raw: odl-openstack-cleanup-old-images.sh
 
+- builder:
+    name: odl-openstack-cleanup-stale-nodes
+    builders:
+      - shell: !include-raw: odl-openstack-cleanup-stale-nodes.sh
+
 - builder:
     name: odl-openstack-cleanup-stale-stacks
     builders: