From 47714de72c423cbdc52908dad1c7ef29e2d0fd28 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Mon, 12 Nov 2018 17:20:23 +0800 Subject: [PATCH] Re-add All view tab after deleting all jobs&views 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 --- jjb/lf-ci-jobs.yaml | 2 +- .../jenkins-sandbox-cleanup-all-view-1e008fa0b38792a5.yaml | 14 ++++++++++++++ shell/jenkins-sandbox-cleanup.sh | 8 ++++++++ tox.ini | 4 ++-- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/jenkins-sandbox-cleanup-all-view-1e008fa0b38792a5.yaml diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 620783fc..5fe95a61 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -102,7 +102,7 @@ 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 index 00000000..1ebb0df6 --- /dev/null +++ b/releasenotes/notes/jenkins-sandbox-cleanup-all-view-1e008fa0b38792a5.yaml @@ -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 `_ + All view disappears on Jenkins Sandbox after views are deleted. The **All** + view is now recreated after ``delete-all`` is run. diff --git a/shell/jenkins-sandbox-cleanup.sh b/shell/jenkins-sandbox-cleanup.sh index c1969738..e97dbe4c 100644 --- a/shell/jenkins-sandbox-cleanup.sh +++ b/shell/jenkins-sandbox-cleanup.sh @@ -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 58a8600c..aa591472 100644 --- 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} -- 2.16.6