Re-add All view tab after deleting all jobs&views 57/13457/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 12 Nov 2018 09:20:23 +0000 (17:20 +0800)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Mon, 19 Nov 2018 06:45:52 +0000 (14:45 +0800)
This resolves the Jenkins Sandbox being left in a state where a
'00-Empty View' tab is left. This is confusing for Jenkins Sandbox
users as it will look as if the jobs they upload are not being added.

This patch requires JJB 2.8.0 otherwise the jenkins-sandbox-cleanup
job will report failed state. Despite this the primary purpose of the
job (deleting jobs and views) will be successful but needs the new
JJB version to replace the All view automatically.

Issue: RELENG-1450
Change-Id: I4ec106dc55789b7eab717e540491a94e47551852
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/lf-ci-jobs.yaml
releasenotes/notes/jenkins-sandbox-cleanup-all-view-1e008fa0b38792a5.yaml [new file with mode: 0644]
shell/jenkins-sandbox-cleanup.sh
tox.ini

index 620783f..5fe95a6 100644 (file)
     disable-job: false
     github-url: 'https://github.com'
     jjb-cache: '$HOME/.cache/jenkins_jobs'
-    jjb-version: 2.2.1
+    jjb-version: 2.8.0
     stream: master
     submodule-recursive: true
     submodule-timeout: 10
diff --git a/releasenotes/notes/jenkins-sandbox-cleanup-all-view-1e008fa0b38792a5.yaml b/releasenotes/notes/jenkins-sandbox-cleanup-all-view-1e008fa0b38792a5.yaml
new file mode 100644 (file)
index 0000000..1ebb0df
--- /dev/null
@@ -0,0 +1,14 @@
+---
+upgrade:
+  - |
+    Requires JJB 2.8.0 for the jenkins-sandbox-cleanup job to not fail.
+
+    .. note::
+
+       Despite the failure if JJB 2.8.0 is not available the job will
+       successfully delete all jobs and views, the primary purpose of this job.
+fixes:
+  - |
+    :ref:`RELENG-1450 <https://jira.linuxfoundation.org/browse/RELENG-1450>`_
+    All view disappears on Jenkins Sandbox after views are deleted. The **All**
+    view is now recreated after ``delete-all`` is run.
index c196973..e97dbe4 100644 (file)
@@ -14,3 +14,11 @@ echo "---> jenkins-sandbox-cleanup.sh"
 set -eux -o pipefail
 
 bash -c "/usr/bin/yes 2>/dev/null || true" | jenkins-jobs -s sandbox delete-all
+
+# Recreate the All default view.
+cat << EOF > all-view.yaml
+- view:
+    name: All
+    view-type: all
+EOF
+jenkins-jobs -s sandbox update -v all-view.yaml
diff --git a/tox.ini b/tox.ini
index 58a8600..aa59147 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -36,7 +36,7 @@ commands =
 
 [testenv:jjb]
 deps =
-    jenkins-job-builder==2.2.1
+    jenkins-job-builder==2.8.0
 commands =
     jenkins-jobs -l DEBUG test --recursive -o {toxinidir}/archives/job-configs {toxinidir}/jjb:{toxinidir}/.jjb-test
 
@@ -65,7 +65,7 @@ commands = lftools license check-dir -r '.+' shell
 
 [testenv:jenkins-jobs]
 deps =
-    jenkins-job-builder{env:JJB_VERSION_OP:~=}{env:JJB_VERSION:2.0.9}
+    jenkins-job-builder{env:JJB_VERSION_OP:~=}{env:JJB_VERSION:2.8.0}
 commands =
     jenkins-jobs {posargs:--help}