Disable Jenkins Job from Another Job

后端 未结 7 1405
夕颜
夕颜 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:41

    We've used the Port Allocator Plugin to do this. It lets your jobs "grab" a TCP port for the duration of their run, meaning that no other job can grab that port for the duration, effectively blocking parallel execution of two jobs that try to get the same port.

    There is also the Locks and Latches Plugin which sounds perfect but we found it to be difficult to use, and it doesn't seem to be maintained any more.

    Update after question clarified:

    You can remotely enable/disable a job using Jenkins' HTTP api. If you browse to any job then put api on the end of the URL you will see instructions about the HTTP requests you need to make to do so. For example: http://ci.jruby.org/job/activerecord-jdbc-master/api (look at the end of that page - basically POST to /disable).

    It should be a simple matter to use a build step in a job to call curl or similar with the appropriate request data.

提交回复
热议问题