我能够将curl POST jenkins job
调用转换为php cURL。这是我的解决方案:
PHP cURL POST Jenkins job with parameters
有类似的东西:
$url = "http://build:f9280f75396f83a0@mobile-jenkins.domain.com:8080/job/android-test/buildWithParameters";
$data = "POST_RESULTS=true&RUN_ID=".$testrun_id."&CHECK_NAME=SampleAutomatedPlan";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
现在我想为jenkins作业添加描述字段,以便我可以在开始时设置它。
以下是我所指的:How can I set Jenkins build description while triggering build via curl?,它显示了通过命令行设置描述:
curl -v -X POST --data-urlencode "MyDescription=This is my desc" "http://[myServer]/job/[jobName]/buildWithParameters"
如何在上面的php curl方法/ call中添加这样的描述参数?
答案 0 :(得分:1)
如果您不想使用帖子参数,请将它们添加到网址上怎么样?
$url = "http://build:f9280f75396f83a0@mobile-jenkins.domain.com:8080/job/android-test/buildWithParameters?POST_RESULTS=true&RUN_ID=".$testrun_id."&CHECK_NAME=SampleAutomatedPlan&MyDescription=This+is+my+desc"