Trigger Remote Jenkins Build

Trigger Remote Jenkins Build

  1. Enabled “Trigger builds remotely” in Jenkins Job Configuration.
    Click on the desired job –> Configure –> Locate the “Trigger builds remotely” under “Build Triggers” Tab
    Enabled the check box of “Trigger builds remotely”
    Provide some Authentication Token e.g – iFBDOBhNhaxL4T9ass93HRXun2JF161Z

  2. Formulate the command to run using curl.
    curl –user userid:API-Token http://IP OR HOST:PORT/job/JOB_NAME/build?token=Authentication_Token
    eg.curl –user admin1:xxxxxx http://xxxip:8080/job/ANT-BUILD/build?token=xxxxxx

  3. Formulate the command to run using curl with parameters
    curl –user userid:API-Token http://IP OR HOST:PORT/job/JOB_NAME/buildWithParameters?token=Authentication_Token
    eg.curl –user admin1:xxxxxx http://xxxip:8080/job/ANT-BUILD/build?token=xxxxxx

  4. Trigger jenkins build throught Wiki Page

<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<td>Select Publish Environment:</td>
<td>
<select id="azureEnv">
    <option value="test">test</option>
    <option value="prod">prod</option>
  </select>
</td>
</tr>
<tr>
<td>Enter Release Build Version (<span style="color:red">*</span>):</td>
<td>
<input type="text" id="buildVersion" value=""> (e.g: 7.1.2.3)
</td>
</tr>
</table>
 <br>
<input type=button onclick="publish()" value='Publish' >
<script>
function publish(){
 
    var version = document.getElementById("buildVersion").value;
    if (!version.match(/\S/))
    {
        window.alert("Please Enter Release Build Version");
        return false;
    } else{
        var e = document.getElementById("azureEnv")
        var env = e.options[e.selectedIndex].value
        var URL = "https://xxxjenkinsServer/job/xxxxyourjenkinsJob/buildWithParameters?token=[your token]&Param1="+value1+"&Param2=value2&Param3=" + value3;
         window.open(URL, "_blank");   
    }
 
}
</script>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值