Trigger Jenkins build from Octopus Deploy

Hi,
Our customer is using TeamCity for CI and Octopus Deploy for deployment. Also we have Selenium based tests (in .Net platform) available which are configured to run from Jenkins build.
The requirement is to trigger or start Jenkins build after Octopus Deploy is completed with it’s deployment. The trigger should be automatic and happen once the deployment is completed.
After the testing in respective test environment, Jenkins build should pass the result to Octopus Deploy to mark whether the deployment is successful.
Can you please help to find out if there is a way to achieve the above integration?

Thanks,
Praveen

Hi @Venkata_Praveen, thanks for reaching out.

The easiest way to trigger a job in Jenkins is to use the Jenkins CLI, which is documented at https://jenkins.io/doc/book/managing/cli. By using the CLI from Octopus to trigger a build in Jenkins, you can trigger a build once an Octopus deployment has finished, and then Octopus can wait for the result.

You will most likely want to run the build command, waiting for the build to finish. https://support.cloudbees.com/hc/en-us/articles/228392127-How-to-wait-for-build-to-finish-when-triggering-from-CLI- has some documentation on how to trigger and wait for a build in Jenkins.

So the high level process would be:

  1. Octopus completes a deployment
  2. Octopus calls the Jenkins CLI to run a build
  3. Octopus waits for the build to finish, checks the return code for the status of the job
  4. If the Jenkins job was successful, Octopus completes successfully. If the Jenkins job failed, the Octopus deployment will also fail.

Regards
Matt C

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.