Disable Jenkins Job from Another Job

后端 未结 7 1418
夕颜
夕颜 2020-12-16 01:20

Is there a way in Jenkins (Hudson) to disable a job from another job?

Basically we have a build environment that does the standard building/testing. We also use the

7条回答
  •  庸人自扰
    2020-12-16 01:58

    I found one possible approach using the jenkins-cli (command-line interface). I added this build step (for me it was a Windows batch command, though I may make it a script or something more elegant):

    java -jar C:\my\jenkins\path\jenkins-cli.jar -s %JENKINS_URL% disable-job "Job 1"
    

    I haven't looked into how to get the path to Jenkins, but that should not be too hard.

    Here is some information on the CLI. You can also go to http://your-jenkins:8080/cli for some of the available commands.

提交回复
热议问题