Build Triggers - Declarative Pipeline Syntax

JFrog Integrations Documentation

Content Type
Integrations
ft:sourceType
Paligo

The Artifactory Trigger allows a Jenkins job to be automatically triggered when files are added or modified in a specific Artifactory path. The trigger periodically polls Artifactory to check if the job should be triggered. You can read more about it here.

You have the option of defining the Artifactory Trigger from within your pipeline. Here's how you do it:

First, create an Artifactory server instance, as described in the Creating an Artifactory Server Instance section.

Next, define the trigger as shown here:

rtBuildTrigger(
    serverId: "ARTIFACTORY_SERVER",
    spec: "*/10 * * * *",
    paths: "generic-libs-local/builds/starship"
)

When a job is triggered following deployments to Artifactory, you can store the URL of the file in Artifactory which triggered the job in an environment variable. Here's how you do it:

environment {
    RT_TRIGGER_URL = "${currentBuild.getBuildCauses('org.jfrog.hudson.trigger.ArtifactoryCause')[0]?.url}"
}