Share via


JenkinsQueueJob@2 - Jenkins queue job v2 task

Use this task to queue a job on a Jenkins server.

Inputs

serverEndpoint - Jenkins service endpoint
string. Required.

Specifies the service connection for your Jenkins instance. Click the Manage link to create a new Jenkins service connection.


jobName - Job name
string. Required.

The name of the Jenkins job to queue. This must exactly match the job name on the Jenkins server.


isMultibranchJob - Job is of multibranch pipeline type
boolean. Default value: false.

This job is a multibranch pipeline. If specified, add the appropriate branch name. This input requires Team Foundation Server Plugin for Jenkins v5.3.4 or later.


multibranchPipelineBranch - Multibranch pipeline branch
string. Required when isMultibranchJob = true.

Queues this multibranch pipeline job on the specified branch. This input requires Team Foundation Server Plugin for Jenkins v5.3.4 or later.


captureConsole - Capture console output and wait for completion
boolean. Default value: true.

If specified, this input captures the Jenkins build console output, waits for the Jenkins build to complete, and succeeds/fails based on the Jenkins build result. Otherwise, once the Jenkins job queues, this task successfully completes without waiting for the Jenkins build to run.


capturePipeline - Capture pipeline output and wait for pipeline completion
boolean. Optional. Use when captureConsole = true. Default value: true.

If specified, this task captures the full Jenkins build pipeline console output, waits for the full Jenkins build pipeline to complete, and succeeds/fails based on the Jenkins build pipeline result. Otherwise, once the first Jenkins job completes, this task successfully completes without waiting for full Jenkins build pipeline to run.


isParameterizedJob - Parameterized job
Input alias: parameterizedJob. boolean. Default value: false.

Specifies if the Jenkins job accepts parameters. Use this input even if all default parameter values are used and no parameters are actually specified.


jobParameters - Job parameters
string. Optional. Use when parameterizedJob = true.

Specifies job parameters, with one per line, in the format of <parameterName>=<parameterValue>.

To set a parameter to an empty value, which is useful for overriding a default value, leave off the parameter value. For example, specify parameterName=.

Variables are supported. To set a commitId parameter value to the Git commit ID of the build, for example, you can use: commitId=$(Build.SourceVersion). For more information, see the documentation on variables.

The supported Jenkins parameter types are:

  • Boolean
  • Choice
  • Password
  • String

Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

JENKINS_JOB_ID
The ID of the Jenkins job instance queued by this task. Use this variable in the Jenkins Download Artifacts task to download the artifacts for this particular job instance.

Remarks

Use this task to queue a job on a Jenkins server.

Team Foundation Server Plug-in

You can use Team Foundation Server Plug-in (version 5.2.0 or newer) to automatically collect files from the Jenkins workspace and download them into the build.

To set it up:

  1. Install the Team Foundation Server Plug-in on the Jenkins server.

  2. On the Jenkins server, for each job you would like to collect results from, add the Collect results for Azure Pipelines/TFS post-build action and then configure it with one or more pairs of result type and include file pattern.

  3. On the Jenkins Queue Job, build task enable the Capture console output and wait for completion to collect results from the root level job, or the Capture pipeline output and wait for pipeline completion to collect results from all pipeline jobs.

Results will be downloaded to the $(Build.StagingDirectory)/jenkinsResults/Job Name/team-results.zip and extracted to this location. Each set of result types collected by the plug-in, will be under the team-results directory, $(Build.StagingDirectory)/jenkinsResults/Job Name/team-results/ResultType/. This is the directory where build results can be published by downstream tasks (for example, Publish Test Results, and Publish Code Coverage Results).

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Build