]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
jenkins-job-builder: don't delete jobs named 'preserve-*' 2149/head
authorDan Mick <dmick@redhat.com>
Fri, 21 Jul 2023 02:43:05 +0000 (19:43 -0700)
committerDan Mick <dmick@redhat.com>
Fri, 21 Jul 2023 02:46:18 +0000 (19:46 -0700)
This is to allow job development without losing the jobs and past builds
as other ceph-build PRs are pushed.  It's assumed that if you create a job
with 'preserve-' in its title that you will clean it up when you're done.

Signed-off-by: Dan Mick <dmick@redhat.com>
jenkins-job-builder/build/build

index 04c8d757f066904d52a041e9a5ffb0d4cb05af57..4c85e535a88aecf836fe6f3d404366edd3c81639 100644 (file)
@@ -69,7 +69,9 @@ JJB_CONFIG="$HOME/.jenkins_jobs.$JENKINS_FQDN.ini"
 
 # Delete jobs our controller has that didn't get job xml written during `jenkins-jobs test`
 # jenkins-job-builder doesn't get a config written so we `grep -v it` so it doesn't get deleted.
-for JOB in $(curl -s https://$JENKINS_FQDN/api/json | jq -r '.jobs[].name' | grep -v jenkins-job-builder | sort); do
+# Jobs that start with 'preserve-' will also be kept, as it's assumed they're jobs under
+# development that will be deleted (perhaps renamed) once development is finished.
+for JOB in $(curl -s https://$JENKINS_FQDN/api/json | jq -r '.jobs[].name' | egrep -v 'jenkins-job-builder|^preserve-' | sort); do
     if [ ! -f $TEMPDIR/$JOB ]; then
         echo "Did not find job definition for $JOB.  Deleting!"
         $VENV/jenkins-jobs --log_level DEBUG --conf $JJB_CONFIG delete $JOB