संपादित करें

इसके माध्यम से साझा किया गया


JenkinsQueueJob@2 - Jenkins queue job v2 task

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

Syntax

# Jenkins queue job v2
# Queue a job on a Jenkins server.
- task: JenkinsQueueJob@2
  inputs:
    serverEndpoint: # string. Required. Jenkins service connection. 
    jobName: # string. Required. Job name. 
    #isMultibranchJob: false # boolean. Job is of multibranch pipeline type. Default: false.
    #multibranchPipelineBranch: # string. Required when isMultibranchJob = true. Multibranch pipeline branch. 
    #captureConsole: true # boolean. Capture console output and wait for completion. Default: true.
    #capturePipeline: true # boolean. Optional. Use when captureConsole = true. Capture pipeline output and wait for pipeline completion. Default: true.
  # Advanced
    #isParameterizedJob: false # boolean. Alias: parameterizedJob. Parameterized job. Default: false.
    #jobParameters: # string. Optional. Use when parameterizedJob = true. Job parameters. 
    #failOnUnstableResult: false # boolean. Fail on unstable result. Default: false.
    #retryCount: '3' # string. Number of retries for failed connection. Default: 3.
    #delayBetweenRetries: '60' # string. Time between retries. Default: 60.
# Jenkins queue job v2
# Queue a job on a Jenkins server.
- task: JenkinsQueueJob@2
  inputs:
    serverEndpoint: # string. Required. Jenkins service connection. 
    jobName: # string. Required. Job name. 
    #isMultibranchJob: false # boolean. Job is of multibranch pipeline type. Default: false.
    #multibranchPipelineBranch: # string. Required when isMultibranchJob = true. Multibranch pipeline branch. 
    #captureConsole: true # boolean. Capture console output and wait for completion. Default: true.
    #capturePipeline: true # boolean. Optional. Use when captureConsole = true. Capture pipeline output and wait for pipeline completion. Default: true.
  # Advanced
    #isParameterizedJob: false # boolean. Alias: parameterizedJob. Parameterized job. Default: false.
    #jobParameters: # string. Optional. Use when parameterizedJob = true. Job parameters.
# Jenkins Queue Job v2
# Queue a job on a Jenkins server.
- task: JenkinsQueueJob@2
  inputs:
    serverEndpoint: # string. Required. Jenkins service connection. 
    jobName: # string. Required. Job name. 
    #isMultibranchJob: false # boolean. Job is of multibranch pipeline type. Default: false.
    #multibranchPipelineBranch: # string. Required when isMultibranchJob = true. Multibranch pipeline branch. 
    #captureConsole: true # boolean. Capture console output and wait for completion. Default: true.
    #capturePipeline: true # boolean. Optional. Use when captureConsole = true. Capture pipeline output and wait for pipeline completion. Default: true.
  # Advanced
    #isParameterizedJob: false # boolean. Alias: parameterizedJob. Parameterized job. Default: false.
    #jobParameters: # string. Optional. Use when parameterizedJob = true. Job parameters.

Inputs

serverEndpoint - Jenkins service connection
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

failOnUnstableResult - Fail on unstable result
boolean. Default value: false.

Specifies strictness of a success definition, or whether to consider unstable as a failure or not. The false value is for a non-strict version, and the true is for a strict version. If set to true, an unstable build result is treated as a failure. Otherwise, an unstable result is treated as a success.


retryCount - Number of retries for failed connection
string. Default value: 3.

Specifies the amount of connection retries when connection failure or error occurs.


delayBetweenRetries - Time between retries
string. Default value: 60.

Specifies the amount of time between connection retries when an error occurs. This value is specified in seconds.


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 2.144.0 or greater
Task category Build
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