trigger the jenkins job from octopus

240 Views Asked by At
I want to call the jenkins job(automated smoke suite) automatically from the octopus(deployment tool), once the deployment is successful.
The simplest way of doing this I found is, to create a script that uses the Jenkins REST API to trigger the jenkins job. And then add that script as a step at the end of deployment in octopus.
Created a powershell script, 

to call the REST API Invoke-WebRequest -Uri "http://jenkinsserver/jenkins/job/Run%20a%20script/build" -Headers $BuildHeaders -Method Postenter code here

I am getting error " Invoke-WebRequest : HTTP ERROR 403 No valid crumb was included in the request". 
In jenkins due to security issue I can not change configuration.
Please guide me to proceed.
1

There are 1 best solutions below

0
On

There is a community step, Jenkins - Queue Job, for triggering a Jenkins job.

More information about Octopus Community Step Templates - https://octopus.com/docs/projects/community-step-templates