Jenkins - Examples for Pipeline Steps

JFrog Pipelines Documentation

Products
JFrog Pipelines
Content Type
User Guide
ft:sourceType
Paligo

The following examples show how to configure a Jenkins step for a few different Jenkins jobs. For more information about Jenkins Pipeline steps, see Jenkins.

Freestyle Jenkins Project or Pipeline

A Jenkins step for a freestyle Jenkins project or Pipeline. Note that this example will not work with Jenkins Multibranch Pipelines, see the next example for those.

This example uses timeoutSeconds Bash tag. For more information about other Bash tags that can be used, see Bash.

Jenkins

pipelines: 
  - name: jenkinsPipeline
    steps:
      - name: jenkinsStep
        type: Jenkins
        configuration: 
                  timeoutSeconds: 30 # uses Bash tag to set time limit, in seconds, for the step to complete
          jenkinsJobName: myJenkinsJob
          integrations:
            - name: jenkins_integration

Jenkins Multibranch Pipeline

A Jenkins step for a Jenkins Multibranch Pipeline.

Jenkins

pipelines: 
  - name: jenkinsPipeline
    steps:
      - name: jenkinsStep
        type: Jenkins
        configuration: 
          jenkinsJobName: myJenkinsMultibranchJob
          jenkinsBranchName: myBranchName
          integrations:
            - name: jenkins_integration

Trigger Jenkins Jobs using an Input Image Resource

A Jenkins step providing an image name and tag and run number as build parameters to trigger Jenkins jobs using an input Image resource.

Jenkins

pipelines: 
  - name: jenkinsPipeline
    steps:
      - name: jenkinsStep
        type: Jenkins
        configuration: 
          jenkinsJobName: myJenkinsMultibranchJob
          jenkinsBranchName: myBranchName
          buildParameters:
            imageName: "${res_myImageResource_imageName}"
            imageTag: "${res_myImageResource_imageTag}"
            jfrogPipelineRun: "${run_number}"
          inputResources:
            - name: myImageResource
          integrations:
            - name: jenkins_integration

Two Jenkins Jobs using Priority Tag

Two Jenkins jobs that use the Priority Bash tag. For more information about other Bash tags that can be used, see Bash.

pipelines:
  - name: pipelines_Jen
    steps:
      - name: S_B_Jen_0022_1
        type: Jenkins
        configuration:
          jenkinsJobName: var_output_job    
          priority: 1 # bash tag
          buildParameters:
            key1: 1
            key2: 2
          integrations:
            - name: i_testJenkins

      - name: S_B_Jen_0022_2
        type: Jenkins
        configuration:
          jenkinsJobName: var_output_job   
          priority: 2 @ bash tag
          buildParameters:
            key1: 1
            key2: 2
          integrations:
            - name: i_testJenkins
          inputSteps:
            - name : S_B_Jen_0022_1