I'm struggling with extending a base template in Azure DevOps yaml pipelines. It seems even the simplest action is a challenge with no good resources, tools, documentation, and uninformative error messages. I'm using yamllint.com and the AzDO rest api for parsing yaml:
https://dev.azure.com/{{org}}/{{project}}/_apis/pipelines/{{pielineId}}/runs?api-version=5.1-preview
Any other tools you can recommend would be helpful.
My question; I'd like to prepend jobs from the extending pipeline. Please explain why adding a join below does nothing.
This works as expected:
- stage: parseBuildJobsWithCondition
jobs:
- ${{ each job in parameters.buildJobs }}:
${{ if contains(job.displayName, '1') }}:
job: ${{ 'thisIsATest' }}
steps:
- ${{ job.steps }}
Result:
resources:
repositories:
- repository: templates
type: git
name: basePipelineTemplatesHost/basePipelineTemplatesHost
ref: refs/tags/v1
stages:
- stage: parseBuildJobsWithCondition
jobs:
- job: thisIsATest
steps:
- task: Bash@3
inputs:
targetType: inline
script: echo This is bash script 1
But trying to introduce a join does nothing:
- stage: parseBuildJobsWithCondition
jobs:
- ${{ each job in parameters.buildJobs }}:
${{ if contains(job.displayName, '1') }}:
job: ${{ join('ext_',job.displayName) }}
steps:
- ${{ job.steps }}
Result:
resources:
repositories:
- repository: templates
type: git
name: basePipelineTemplatesHost/basePipelineTemplatesHost
ref: refs/tags/v1
stages:
- stage: parseBuildJobsWithCondition
jobs:
- job: job1
steps:
- task: Bash@3
inputs:
targetType: inline
script: echo This is bash script 1