Ultimately, I'm trying to do this:
- Move
azure-pipelines.yaml
and associated templates out of the code repository (code-repo
). - Move them into a separate dedicated repository (
pipeline-repo
). - Have the pipeline look at the config for the pipeline in
pipeline-repo
, but run the pipeline on the code in thecode-repo
.
I'm referring the following documentation:
-
My actual PR pipeline would look something like this:
trigger: none resources: repositories: - repository: code-repo type: git name: code-repo variables: - template: templates/variables.yaml pool: vmIMage: $(vmImageName) stages: - template: templates/build/buildStage.yaml ...
Testing that, it confirms that it isn't running on the
code-repo
PR, but thepipeline-repo
so everything fails.So it is unclear to me what I need to do from here to get the pipeline to run on the PR code from
code-repo
.Suggestions?
CodePudding user response:
Ok, I think I have it sorted out, at least some of my stages are now succeeding.
I came across this documentation which informed me of
checkout
.So in addition to doing something like:
resources: repositories: - repository: code-repo type: git name: code-repo
Then you need to add a
step
calledcheckout
like the following:# Triggers when PR is created due to branch policies trigger: none resources: repositories: - repository: code-repo type: git name: code-repo pool: vmImage: 'ubuntu-latest' stages: - stage: Testing displayName: Test stage jobs: - job: ParallelA steps: - checkout: code-repo - task: task1 - task: task2
The
checkout
should set the context for the subsequent steps.