:Includes:
- gerrit-jenkins-cfg-merge
+ - gerrit-jenkins-sandbox-cleanup
- gerrit-jjb-deploy-job
- gerrit-jjb-merge
- gerrit-jjb-verify
:Includes:
- github-jenkins-cfg-merge
+ - github-jenkins-sandbox-cleanup
- github-jjb-deploy-job
- github-jjb-merge
- github-jjb-verify
inspected.
+Jenkins Sandbox Cleanup
+-----------------------
+
+Cleanup Jenkins Sandbox of jobs and views periodically.
+
+:Template names:
+
+ - {project-name}-jenkins-sandbox-cleanup
+ - gerrit-jenkins-sandbox-cleanup
+ - github-jenkins-sandbox-cleanup
+
+:Comment Trigger: NONE
+
+:Required parameters:
+
+ :build-node: The node to run build on.
+ :jenkins-ssh-credential: Credential to use for SSH. (Generally
+ should be configured in defaults.yaml)
+
+:Optional parameters:
+
+ :cron: Schedule to run job. (default: '0 8 * * 6')
+
+
JJB Deploy Job
--------------
jobs:
- gerrit-jenkins-cfg-merge
+ - gerrit-jenkins-sandbox-cleanup
- gerrit-jjb-deploy-job
- gerrit-jjb-merge
- gerrit-jjb-verify
jobs:
- github-jenkins-cfg-merge
+ - github-jenkins-sandbox-cleanup
- github-jjb-deploy-job
- github-jjb-merge
- github-jjb-verify
white-list-target-branches:
- '{branch}'
+
+###########################
+# JENKINS SANDBOX CLEANUP #
+###########################
+
+- lf_jenkins_sandbox_cleanup: &lf_jenkins_sandbox_cleanup
+ name: lf-jenkins-sandbox-cleanup
+
+ ######################
+ # Default parameters #
+ ######################
+
+ build-timeout: 30
+ # Run every Saturday at 08:00 UTC
+ cron: '0 8 * * 6'
+
+ #####################
+ # Job Configuration #
+ #####################
+
+ project-type: freestyle
+ node: '{build-node}'
+ concurrent: true
+
+ parameters:
+ - lf-infra-jjb-parameters:
+ jjb-version: '{jjb-version}'
+
+ triggers:
+ - timed: '{obj:cron}'
+
+ builders:
+ - lf-infra-jjbini
+ - shell: !include-raw-escape:
+ - ../shell/jjb-install.sh
+ - ../shell/jenkins-sandbox-cleanup.sh
+ - ../shell/jjb-cleanup.sh
+
+- job-template:
+ name: '{project-name}-jenkins-sandbox-cleanup'
+ id: gerrit-jenkins-sandbox-cleanup
+ <<: *lf_jjb_common
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_jenkins_sandbox_cleanup
+
+- job-template:
+ name: '{project-name}-jenkins-sandbox-cleanup'
+ id: github-jenkins-sandbox-cleanup
+ <<: *lf_jjb_common
+ # yamllint disable-line rule:key-duplicates
+ <<: *lf_jenkins_sandbox_cleanup
+
+
##################
# JJB DEPLOY JOB #
##################
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 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
+##############################################################################
+# Deletes all jobs on a Jenkins Sandbox system.
+echo "---> jenkins-sandbox-cleanup.sh"
+
+set -eux -o pipefail
+
+bash -c "/usr/bin/yes 2>/dev/null || true" | jenkins-jobs -s sandbox delete-all