How to check disabled jobs on a Jenkins server?

I use Jenkins to run tests on my servers.

So, I created a task for each server, and I run a test in the task, and I would like to know with a simple bash script if my task is disabled / enabled?

I can ssh to the Jenkins server and I want to run this script from there, how can I do this?

+2
source share
3 answers

See http://<Your Jenkins>/api and http://<Your Jenkins>/api/xml :

 <hudson> ... <job> <name>...your job name...</name> ... <color>disabled</color> </job> ... 

For a job description, see http://<Your Jenkins>/job/<Your job name>/api and http://<Your Jenkins>/job/<Your job name>/api/xml .

+2
source

Check project status from this line

 curl http://$JENKINS_URL/job/$JOB_NAME/api/json | python -mjson.tool 

It resets job data in json format. then grep for the string "buildable":

this will give you the option to disable or disable the project.

 "buildable": true, --> Project enabled "buildable": false, --> Project Disabled 

Then do whatever you want.

0
source

Put the url of your jenkins server in the browser and put / api / xml in front of your url.

Example:

 https://xyzjenkins.cloud/view/all/api/xml 

Or

to get the result in JSON, just put JSON instead of XML in the above URL

 https://xyzjenkins.cloud/view/all/api/json 
0
source

All Articles