How to trigger Codefresh pipelines from Artifactory
It is possible to define and manage Artifactory pipeline triggers with the Codefresh UI. This allows you to trigger Codefresh pipelines when a Artifactory event happens (i.e. a new Docker image is uploaded).
Manage Artifactory Triggers with Codefresh UI
The process involves two parts:
- Creating a trigger in Codefresh. This will result in a special Codefresh webhook URL
- Activating the webhook plugin in Artifactory and setting it up to call the Codefresh URL
Make sure that you have admin access to your Artifactory instance in order to setup its webhook plugin.
Create a new Artifactory Trigger
To add a new Artifactory trigger, navigate to a Codefresh Pipeline Configuration view and expand the Triggers section. Press the
Add Trigger button and select a
Registry trigger type to add.
Fill the following information:
- Registry Provider - select
- Namespace - put JFrog name of repository.
- Name - put name of Docker image.
- Action - select
- Filter - optional filter to specify which image tags will trigger pipeline execution: Re2 regular expression.
Click next and a new Dialog will appear that shows you the Codefresh webhook URL. Copy it to your clipboard.
Now we must set JFrog Artifactory to call this URL when an event takes place.
Setup JFrog Artifactory webhook plugin
- The file
webhook.groovyneeds to be copied to
ARTIFACTORY_HOME/etc/plugins(the plugin itself)
- A file
webhook.config.jsonshould also be placed in the same folder (the plugin setup)
Here is an example for Codefresh.
Triggering a Codefresh pipeline with an Artifactory push
Now, every time you push/tag a Docker image to the selected Artifactory repository, manually, with Codefresh or any other CI/CD tool, Codefresh will trigger execution of all pipelines associated with that Artifactory Push trigger event.