Chore: Upgrade Jenkins-job-builder to 6.3.0
[releng/global-jjb.git] / shell / jenkins-sandbox-cleanup.sh
index c196973..10f3b29 100644 (file)
 # Deletes all jobs on a Jenkins Sandbox system.
 echo "---> jenkins-sandbox-cleanup.sh"
 
-set -eux -o pipefail
+set -euf -o pipefail
 
-bash -c "/usr/bin/yes 2>/dev/null || true" | jenkins-jobs -s sandbox delete-all
+# shellcheck disable=SC1090
+. ~/lf-env.sh
+
+lf-activate-venv --python python3 --venv-file /tmp/.jjb_venv \
+    jenkins-job-builder
+
+# jenkins-jobs does not always open 'stdin' which may cause 'yes' to fail
+(yes || 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