Disable Jenkins Job from Another Job

后端 未结 7 1415
夕颜
夕颜 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:46

    It's possible to do this using the Job DSL Plugin, without specifying credentials.

    The DSL script to use would be:

    job("jobname"){
        using("jobname")
        disabled(true)
    }
    
    1. This is for Freestyle jobs. If you need to disable, for example, a Pipeline Job, use pipelineJob instead of job.
    2. Usually, "jobname" needs to include folders, using the Jenkins root as reference.
    3. To reenable a job, use disabled(false).

提交回复
热议问题