Pipeline jobs in Jenkins allow creating a script which defines your build steps. For those not familiar with Jenkins Pipelines, check out the Pipeline Tutorial or the Getting Started With Pipeline documentation.
You may find more information on working with JFrog Artifactory using Jenkins pipeline jobs on the Working With Pipeline Jobs in Jenkins documentation.
The examples in this repository are meant to help you get started using the Artifactory Pipeline APIs in your pipeline scripts.
Follow the below steps to run the examples.
All examples use an Artifactory server defined in Jenkins' Configuration.
Find or configure an Artifactory server in Jenkins through Manage Jenkins, Configure System. You'll need its Server ID.
The pipeline of most examples includes variables, such as SERVER_ID
, MAVEN_TOOL
, ARTIFACTORY_LOCAL_RELEASE_REPO
, etc.
Please make sure to either set or replace these variables with values that suit your configuration.
To set the variables for the pipeline, follow these steps:
- In the Jenkins job configuration, check the This project is parameterized option.
- Click Add Parameter and then select String Parameter.
- Set the Name as the variable name (
SERVER_ID
for example) and the Default Value as the required value (Artifactory Server ID configured inManage Jenkins
, for example).
Configure the Jenkins using one of the following methods.
In the job configuration, set Definition to Pipeline script, and then copy the content of the example's Jenkinsfile into the Script text-area.
In the job configuration:
- Set Definition to Pipeline script from SCM.
- Set SCM to Git.
- Set Repository URL to https://github.com/jfrog/project-examples.git
- Set Script Path to the relative path to the example's Jenkinsfile. For example, to run the maven-example set Script Path to jenkins-examples/pipeline-examples/declarative-examples/maven-example/Jenkinsfile
This repository includes Declarative pipeline examples and Scripted pipeline examples
Learn more about working with pipeline jobs in Jenkins and the benefits of Artifactory’s integration with Jenkins CI.