简体   繁体   English

如何安排詹金斯工作槽网址?

[英]How to schedule a jenkins job trough url?

I'm implementing a way to trigger jenkins jobs and to schedule them with php in my site. 我正在实现一种方法来触发jenkins作业,并在我的网站中使用php安排它们。 The way I'm doing the "on-the-fly" trigger is by simply calling the url of the job with some parameters (I'm also using Build Token Root Plugin so I can trigger the jobs without authentication). 我进行“即时”触发的方式是,只需使用一些参数调用作业的url(我也使用了Build Token Root Plugin,因此我无需身份验证即可触发作业)。

Example below: 下面的例子:

$data = array(
  'job' => 'JOB NAME',
  'token' => 'job_token',
  'parameter1' => 'some parameter',
);

$options = array(
  'method' => 'POST',
  'data' => drupal_http_build_query($data),
  'timeout' => 15,
  'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
);

drupal_http_request('http://localhost:8080/buildByToken/buildWithParameters', $options);

I can trigger the job with multiple parameters but I need to schedule the build. 我可以使用多个参数触发作业,但是我需要安排构建时间。 In jenkins there is this option "Build periodically" but it's not a parameter. 在詹金斯中,有一个“定期构建”选项,但这不是参数。

Anyone knows a way to schedule the job trough the url way? 有人知道一种通过url方式安排作业的方法吗?

Thanks! 谢谢!

You can add ?delay=300secs to the end of the URL to schedule the job to start in five minutes. 您可以在URL末尾添加?delay=300secs ,以安排作业在五分钟内开始。

Note that sec and secs are currently the only accepted duration units . 请注意, secsecs是当前唯一接受的持续时间单位

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM