The Jenkins native step transfers execution to a Jenkins pipeline. For more information, see Using Jenkins With Pipelines.
YAML Schema
The YAML schema for Jenkins native step is as follows:
Jenkins
pipelines: - name: <string> steps: - name: <string> type: Jenkins configuration: #inherits all the tags from bash jenkinsJobName: <string> # Jenkins job/pipeline name jenkinsBranchName: <string> # required for Jenkins Multibranch buildParameters: key1: <string> key2: <string> integrations: - name: <jenkins integration> # required Jenkins integration outputResources: # optional - name: <resource name>
Tags
name
An alphanumeric string (underscores are permitted) that identifies the step.
type
Must be Jenkins
for this step type.
configuration
Specifies all configuration selections for the step's execution environment. This step inherits the Bash step configuration tags, with these pertinent tags:
Tag | Description of usage | Required/Optional |
---|---|---|
| Must specify a named Jenkins Integration. | Required |
In addition, these tags can be defined to support the step's native operation:
Tags derived from Bash
All native steps derive from the Bash step. This means that all steps share the same base set of tags from Bash, while native steps have their own additional tags as well that support the step's particular function. So it's important to be familiar with the Bash step definition, since it's the core of the definition of all other steps.
Tag | Description of usage | Required/Optional |
---|---|---|
| The name of the Jenkins job/pipeline | Required |
ImportantWhen adding the
| ||
| Required field when the Jenkins Job is configured for multibranch. This tells pipelines which branch to execute. | Optional |
| Assigns any build parameters and their strings in key:value format. These parameters will be passed to the Jenkins job. | Optional |
execution
Execution takes place within the Jenkins job only. This section is not supported for this type of step.
Examples
The following examples show how to configure a Jenkins step for a few different Jenkins jobs.
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