Forum Discussion
Trigger pipeline from repo in another org and project
Hello community, I am in need of some help with Azure Pipelines.
I need to trigger a pipeline from a repository in another project and org. For this I am using a PAT with full access to the source repo and setting up a service connection in the project where the pipeline is to run. I can see both self and the remote repo as sources for the pipeline and when triggered manually the pipeline correctly checks out the remote repo. However, the issues I am having is that it does not trigger on commits to the remote repo.
Here is how the pipeline is configured:
trigger:
- main
resources:
repositories:
- repository: PrismaTeamRepo # In a different organization
endpoint: PrismaServiceDefenderRepoTest
type: git
name: defender-upgrades/defender-upgrades-sample
ref: main
trigger:
branches:
include:
- main
paths:
include:
- customer1
What could the issue be?
1 Reply
Please try the workaround below:
- Use Pipeline Completion Triggers
Set up a pipeline in the remote repo that runs on commit, and configure your target pipeline to trigger when that pipeline completes:
resources: pipelines: - pipeline: remotePipeline source: RemoteProjectPipeline project: RemoteProject trigger: branches: include: - mainThis requires the remote repo to have its own pipeline that runs on commits.
- Use Scheduled Triggers
If real-time triggering isn't critical, you can schedule your pipeline to run periodically:
schedules: - cron: "0 * * * *" # every hour displayName: Hourly trigger branches: include: - main- Use Webhooks + REST API
Set up a webhook in the remote repo to call the Azure DevOps REST API and trigger the pipeline manually. This requires a bit of scripting and a secure endpoint, but it gives you full control.