This extension allows executing Azure DevOps pipelines from another pipeline and waiting for the executed pipeline to finish. It also allows choosing whether to consume the RUN or QUEUE API.
Search for the task called "Exec Pipeline" and the inputs are as follows:
-
Use Service Connection (required): Indicates if a service connection will be used to consume the Azure DevOps API. If not, the pipeline execution token will be used.
-
Azure Devops Path (optional): If you selected the option to use a service connection, you must select the service connection to be used. Otherwise, this field will not be displayed.
-
Branch (required): The branch with which the pipeline will be executed.
-
Pipeline Id (required): The ID of the pipeline to be executed.
-
Execution Type (required): The type of execution to be performed. If "Run" is selected, the pipeline will run immediately. If "Queue" is selected, the pipeline will be queued. Both options execute the pipeline, but "Queue" allows changing the Run Reason.
-
Run Reason (optional/required only in queue): The reason for executing the pipeline. This is only used if the "Execution Type" is "Queue".
-
Extra Data is Parameter (optional): Indicates if additional information will be sent to the pipeline to be executed. If "true" (selected), it will be sent as a parameter; if "false", it will be sent as a variable.
-
Parameters or Variables (optional): Additional information to be sent to the pipeline to be executed. It is sent in JSON format, for example: {"key1": "value1", "key2": "value2"}.
-
Just execute (optional): Indicates if you will wait for the executed pipeline to finish. If "true" (selected), it will wait; if "false", it will not wait.
-
Polling interval (seconds) (optional): Seconds between status checks while waiting (5-300). Default
10. -
Wait timeout (minutes) (optional): Maximum time to wait for the executed pipeline.
0(default) means no limit. On timeout the task fails, but the executed pipeline keeps running (unless "Cancel executed pipeline" is enabled). -
Pipeline Name (optional): Alternative to Pipeline ID. If several pipelines share a name, prefix it with the folder (
folder\name). If both are set, the ID is used. -
Parameters file (JSON) (optional): Path (relative to the working directory) to a JSON file with an object of parameters/variables. The file is read as standard JSON; values in the inline field override the file. To use a pipeline variable instead, write
$(myVariable)in the inline field. -
Target Organization / Target Project (optional): Run a pipeline that lives in another project or organization. See below.
-
Personal Access Token (optional, only without a service connection): PAT used for another organization. Pass a secret variable, e.g.
$(myPat). -
Cancel executed pipeline on cancel/timeout (optional): While waiting, cancel the executed pipeline if this task is canceled or the wait timeout is reached.
The Branch input accepts either a branch name (main) or a full ref (refs/heads/main, refs/tags/v1).
| Scenario | What to configure |
|---|---|
| Same project | Nothing (default). |
| Another project, same organization | targetProject. With System.AccessToken the project's Build Service identity must have access to the target project and pipeline. |
| Another organization (no service connection) | targetOrganization + targetProject + personalAccessToken (PAT with Build: Read & execute). |
| Another organization (service connection) | Use a service connection that stores the destination organization/project/PAT. targetProject can still override the project. |
Give the step a name to read these from later steps as $(<name>.<variable>):
| Variable | Description |
|---|---|
runId |
ID of the executed run/build |
runUrl |
Web URL of the executed run/build |
runResult |
succeeded, partiallySucceeded, failed, canceled or timeout (only when waiting) |
Error messages include the reason reported by Azure DevOps and a hint (authentication, permissions, not found...). Parameter and variable names are logged, never their values.
Transient errors (network, HTTP 429/5xx) while waiting are retried up to 3 times before the task fails.
- task: hendamm-exec-pipeline-task@0
inputs:
useSVC: false
branch: "main"
pipelineID: "1234"
execType: "queue"
reason: "individualCI"
parameters: '{"key1": "value1", "key2": "value2"}'Another project, by pipeline name, with a parameters file and waiting up to 30 minutes:
- task: hendamm-exec-pipeline-task@0
name: deploy
inputs:
useSVC: false
targetProject: "Platform"
pipelineName: "infra\\deploy"
branch: "main"
execType: "run"
isParameter: true
parametersFile: "config/deploy-params.json"
onlyExecution: false
timeoutMinutes: 30
cancelOnAbort: true
- script: echo "Result $(deploy.runResult) - $(deploy.runUrl)"To install the project dependencies, run the following command:
npm installTo build the extension, use the following command:
npm run buildTo package the extension, use the following command:
npm run pack
# Bump version and package
npm run packupversion
