Build: Jenkins Queue Job
VSTS | TFS 2018 | TFS 2017
Queue a job on a Jenkins server
|Jenkins service endpoint||
Select the service endpoint for your Jenkins instance. To create one, click Manage and create a new Jenkins Service Endpoint.
The name of the Jenkins job to queue. This must exactly match the job name on the Jenkins server.
|Capture console output and wait for completion||
If selected, this step will capture the Jenkins build console output, wait for the Jenkins build to complete, and succeed/fail based on the Jenkins build result. Otherwise, once the Jenkins job is successfully queued, this step will successfully complete without waiting for the Jenkins build to run.
|Capture pipeline output and wait for pipeline completion||
This option is similar to capture console output except it will capture the output for the entire Jenkins pipeline, wait for completion for the entire pipeline, and succeed/fail based on the pipeline result.
Select this option if the Jekins job requires parameters.
This option is available for parameterized jobs. Specify job parameters, one per line, in the form parameterName=parameterValue
To set a parameter to an empty value (useful for overriding a default value) leave off the paramter value, e.g. specify parameterName=
Variables are supported, e.g. to define the commitId paramter to be the git commit ID for the build, use: commitId=$(Build.SourceVersion).
Supported Jenkins parameter types are:
|Trust server certificate||
Selecting this option results in the Jenkins server's SSL certificate being trusted even if it is self-signed or cannot be validated by a Certificate Authority (CA).
- task: JenkinsQueueJob@2 inputs: serverEndpoint: jobName: # isMultibranchJob: False multibranchPipelineBranch: # captureConsole: True # capturePipeline: True # isParameterizedJob: False jobParameters:
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:
- Install the Team Foundation Server Plug-in on the Jenkins server.
- On the Jenkins server, for each job you would like to collect results from, add the Collect results for TFS/VSTS post-build action and then configure it with one or more pairs of result type and include file pattern.
- 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 (e.g. Publish Test Results, and Publish Code Coverage Results).
Q: I'm having problems. How can I troubleshoot them?
A: Try this:
On the variables tab, add
system.debugand set it to
true. Select to allow at queue time.
In the explorer tab, view your completed build and click the build step to view its output.
The control options arguments described above can also be useful when you're trying to isolate a problem.
Q: How do variables work? What variables are available for me to use in the arguments?
$(Agent.BuildDirectory) are just a few of the variables you can use. See Variables.
Do I need an agent?
You need at least one agent to run your build or release. Get an agent.