Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger a Jenkins build on a new artifact in Artifactory?

Can Artifactory be used as "SCM" or source in Jenkins to trigger the builds on an particular artifact deploy?

Don't see (or miss it) anything similar in the Artifactory Jenkis plugin description (and on Jenkins side)

This could be needed for instance if there is only access to the Artifactory repository and not to the SCM with code the binaries are coming from.

Such functionality looks to be availble for Nexus (via nexus-webhook-plugin). Hard to believe that this feature is missing for Artifactory.

like image 798
Sergey Shcherbakov Avatar asked Jul 07 '15 14:07

Sergey Shcherbakov


People also ask

How do you trigger a new build in Jenkins?

Developers can follow these three steps to implement a remote Jenkins build trigger: Create 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.

How do I link Jenkins to Artifactory?

To install the Jenkins Artifactory Plugin, go to Manage Jenkins > Manage Plugins, click on the Available tab and search for Artifactory. Select the Artifactory plugin and click Download Now and Install After Restart.

How do you push artifacts to Artifactory from Jenkins?

This is made via passing Jenkins BUILD_NUMBER variable to Maven. In the post-build actions section, add deploy artifacts to the Artifactory step, specify that you would like to add your artifacts, and check the 'Deploy Maven Artifacts' checkbox. You will also need to specify a project name and path to your repository.


2 Answers

Now you can use Enable Artifactory trigger in a newer version.

Go to Build Triggers and check the Enable Artifactory trigger checkbox.

enter image description here

More Detail on GitHub Support for Artifactory trigger

like image 54
Corey Avatar answered Sep 19 '22 16:09

Corey


It's maybe not as elegant as a hook, but I believe the URLTrigger Plugin will achieve what you're looking for. Listed in their use cases:

This plugin enables users to check if new artifacts (such as binaries) have been deployed in a repository (managed for example by a repository manager such as Sonatype Nexus, JFrog Artifactory, Apache Archiva and so on).

It allows you to check the last modification date and inspect the contents of the response for changes.

You would have to use a polling interval instead of relying on Artifactory to notify Jenkins via a hook, but in my experience polling is relatively innocuous even with lots of polls at high intervals.

like image 40
bto Avatar answered Sep 18 '22 16:09

bto