I thought this should be simple, but I am not able to find any Jenkins plugin which would simply let me call a REST GET API (equivalent of wget URL
) when the job is finished. Am I missing something here? As I certainly don't want to write a new plugin for this simple task.
I have scanned through all the plugins and the only interesting one are:
But in my case, I don't have access to Jenkins' file system, so I can't write a post-build script to do this job, or neither can I install Groovy on that machine.
Also, Jenkins is running on a Windows Server 2008 machine.
Jenkins provides rich set of REST based APIs. The REST API feature can be enabled per Job basis. To enable REST API trigger for a Job, Navigate to Your JobName ->Configure -> Build triggers TAB and Check on 'Trigger build remotely'.
The simplest way to access Jenkins REST API is to gather the User Token which is available by selecting your User and clicking on Configure. Now you will use the token as parameter for your authentication.
Create a remote Jenkins build trigger in three stepsCreate a Jenkins build job and enable the Trigger builds remotely checkbox. Provide an authentication token; This can be any text string of your choice. Invoke the Jenkins build URL to remotely trigger the build job.
There is a plugin that allows to make an HTTP request (GET and POST) as a build step.
There is also a plugin that allows any build step to be used in post-build actions.
Use both and you get what you are asking for.
To be able to use any build step as a post-build action, you need to enable this in the settings. Go to: Jenkins → Manage Jenkins → Configure System → Flexible Push and switch the dropdown menu to "Any build step".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With