Reputation: 1
I want to trigger a Test pipeline from a stage of Main pipeline, both the pipelines are present in different projects within the same organization. I am able to trigger the pipeline using the resource option but the problem is it triggers the Test pipeline when Main pipeline finishes successfully but I want to trigger the Test pipeline in between run of Main pipeline using an stage. Is it possible to achieve this using any feature of Azure Devops?
For now I am adding this resource in Test pipeline yaml to trigger after Main pipeline.
resources:
pipelines:
- pipeline: Test-Repo
source: Test # Test pipeline from different project
project: private
trigger: true # enable the trigger
Upvotes: 0
Views: 1757
Reputation: 2216
A good approach is using Extension "Trigger Build Task": https://marketplace.visualstudio.com/items?itemName=benjhuser.tfs-extensions-build-tasks&targetId=ca4e4e67-3099-4c62-9ea9-bef80e0cc70a&utm_source=vstsproduct&utm_medium=ExtHubManageList
My main Pipeline is in Project A with two stages:
trigger:
- none
pool:
vmImage: ubuntu-latest
stages:
- stage: A
displayName: A stage
jobs:
- job: A
displayName: A
steps:
- task: TriggerBuild@4
inputs:
definitionIsInCurrentTeamProject: false
tfsServer: '{Org URL}'
teamProject: '{Project B Name}'
buildDefinition: '213'
queueBuildForUserThatTriggeredBuild: false
ignoreSslCertificateErrors: false
useSameSourceVersion: false
useCustomSourceVersion: false
useSameBranch: false
waitForQueuedBuildsToFinish: false
storeInEnvironmentVariable: false
authenticationMethod: 'Personal Access Token'
password: '{PAT}'
enableBuildInQueueCondition: false
dependentOnSuccessfulBuildCondition: false
dependentOnFailedBuildCondition: false
checkbuildsoncurrentbranch: false
failTaskIfConditionsAreNotFulfilled: false
- stage: B
displayName: B stage
dependsOn: A
jobs:
- job:
steps:
- bash: echo "B"
Run Main Pipeline in Project A:
Test Pipeline in Project B is triggered at Main Pipeline Stage A:
Test Pipeline in Project B.
Upvotes: 0
Reputation: 16133
As a workaround, you can trigger the needed build through REST API. Check this: Powershell to trigger a build in Azure DevOps
Upvotes: 1