Skip to content

Instantly share code, notes, and snippets.

View jayveersolanki's full-sized avatar
🏠
Working from home

Jayveersinh Solanki jayveersolanki

🏠
Working from home
  • Ahmedabad, Gujarat
View GitHub Profile
@jayveersolanki
jayveersolanki / Jenkins Jobs Disable From Jenkins UI
Last active March 10, 2025 12:18
Disable All Jenkins Jobs from UI.
Step 1: Nevigate to *https://<Jenkins_URL>/script* URL
Step 2: Run below script from script console one by one.
I) Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.job.WorkflowJob.class).each {i -> i.setDisabled(true); i.save() }
II) Jenkins.instance.getAllItems(hudson.model.AbstractProject.class).each {i -> i.setDisabled(true); i.save()}
@jayveersolanki
jayveersolanki / disablejobs.sh
Created March 10, 2025 12:12
Disable All Jenkins Jobs from jobs folder.
#!/bin/bash
# Check to see if your jenkins home is in
# /var/lib/jenkins. If it isn't, then modify the script
# This will traverse through all your jobs, and disable them.
cd /var/lib/jenkins/jobs
for d in */ ; do
cd "$d"
@jayveersolanki
jayveersolanki / Jenkins Multibranch Pipeline Kill
Last active August 7, 2024 08:37
how to stop an unstoppable zombie multibranch job
Jenkins.instance.getItemByFullName("<project-name>/<branch-name>")
.getBuildByNumber(JobNumber)
.finish(hudson.model.Result.ABORTED,
new java.io.IOException("Aborting build")
);
@jayveersolanki
jayveersolanki / Jenkins Multibranch Pipeline Kill
Created June 21, 2023 04:41
how-to-stop-an-unstoppable-zombie-job-on-jenkins-without-restarting-the-server
Jenkins.instance
.getItemByFullName("<JOB NAME>")
.getBranch("<BRANCH NAME>")
.getBuildByNumber(<BUILD NUMBER>)
.finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));