using below typescript function to trigger a jenkins build -
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)
}))
}
with the above code, nothing is executing on the jenkins box. I have tried running the below URL on the browser, which is working perfectly.
http://jenkinsbox:30000/job/demo/buildWithParameters?project_name=demo