【发布时间】:2019-04-04 06:40:06
【问题描述】:
使用下面的 typescript 函数来触发 jenkins 构建 -
httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': 'Basic ' + btoa('username:password'),
})
};
triggerJenkinsJob(productname:string):Observable<any>{
console.log("service called")
var url = "http://jenkinsbox:30000/job/demo/buildWithParameters?project_name=demo"
return this.http.post(url,this.httpOptions)
.pipe(map(function(item){
console.log(item)
}))
}
使用上面的代码,jenkins 盒子上没有执行任何操作。我已经尝试在浏览器上运行以下 URL,效果很好。
http://jenkinsbox:30000/job/demo/buildWithParameters?project_name=demo
【问题讨论】:
标签: angular http jenkins post jenkins-api