My YAML file already contains a Resource section and now I want to add a pipeline to the resource section to trigger my publish pipeline after the PR pipeline is successful. THis works fine and the pipeline is trigger when a merge is made to the main branch
Here are the relevant sections as they stand now
trigger:
- main
---------- removed parameter and variable sections for brevity -----------
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
Based on several SO posts like this one: Azure Devops - How to call one pipeline from another
I modified the YAML as such:
trigger:
- none
---------- removed parameter and variable sections for brevity -----------
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
pipelines:
- pipeline: DRIContactManagement-Official
source: DRIContactManagement-PullRequest
trigger: true
When I run the modified YAML, the pipeline fails with the error: (Line: 14, Col: 1): Did not find expected <document start>. The line number is right below the "trigger".
Any suggestions to fix this?
Update 1 To answer @brightran's question, here is the full section of the YAML
#################################################################################
# Pipelines - Official
#
# This pipeline was created from a sample located at:
#
# https://aka/obpipelines/easystart/samples #
# Documentation: https://aka/obpipelines #
# Yaml Schema: https://aka/obpipelines/yaml/schema #
# Retail Tasks: https://aka/obpipelines/tasks #
# Support: https://aka/onebranchsup #
#################################################################################
trigger:
- none
parameters: # parameters are shown up in ADO UI in a build queue time
- name: 'debug'
displayName: 'Enable debug output'
type: boolean
default: false
variables:
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
system.debug: ${{ parameters.debug }}
ENABLE_PRS_DELAYSIGN: 1
ROOT: $(Build.SourcesDirectory)
REPOROOT: $(Build.SourcesDirectory)
OUTPUTROOT: $(REPOROOT)\out
NUGET_XMLDOC_MODE: none
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest' # Docker image which is used to build the project https://aka/obpipelines/containers
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
pipelines:
- pipeline: DRIServiceUpdate-Official # Name of the pipeline resource.
source: DRIServiceUpdate-PullRequest # The name of the pipeline referenced by this pipeline resource.
#project: # Required only if the source pipeline is in another project
trigger: true # Run app-ci pipeline when any run of security-lib-ci completes
Line 14 corresponds to the start of the Parameters: section. There are no other errors or logs from the build. I've tried to edit the YAML file in Azure DevOps so it will validate when I save the changes, but it always says its valid structure. I've also tried running it through some online validators and get the same result.
Update 2
The encoding was set to UTF-8 wo BOM so that was fine. I made minor changes to the indention as suggested and got a new error /.pipelines/DRIServiceUpdate-Official.yml (Line: 44, Col: 5): While parsing a block mapping, did not find expected key.
Line 44 is "template:", in the "Extends" section.
trigger: main
parameters: # parameters are shown up in ADO UI in a build queue time
- name: 'debug'
displayName: 'Enable debug output'
type: boolean
default: false
variables:
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
system.debug: ${{ parameters.debug }}
ENABLE_PRS_DELAYSIGN: 1
ROOT: $(Build.SourcesDirectory)
REPOROOT: $(Build.SourcesDirectory)
OUTPUTROOT: $(REPOROOT)\out
NUGET_XMLDOC_MODE: none
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest' # Docker image which is used to build the project https://aka.ms/obpipelines/containers
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
pipelines:
- pipeline: DRIServiceUpdate-Official # Name of the pipeline resource.
source: DRIServiceUpdate-PullRequest # The name of the pipeline referenced by this pipeline resource.
#project: # Required only if the source pipeline is in another project
trigger: true # Run app-ci pipeline when any run of security-lib-ci completes
extends:
template: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
parameters:
cloudvault: # https://aka.ms/obpipelines/cloudvault
enabled: false
globalSdl: # https://aka.ms/obpipelines/sdl
asyncSdl:
enabled: true
tsaOptionsFile: .config/tsaoptions.json
tsa:
enabled: false # onebranch publish all sdl results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode.
# credscan:
# suppressionsFile: $(Build.SourcesDirectory)\.config\CredScanSuppressions.json
binskim:
break: true # always break the build on binskim issues in addition to TSA upload
policheck:
break: true # always break the build on policheck issues. You can disable it by setting to 'false'
# suppression:
# suppressionFile: $(Build.SourcesDirectory)\.gdn\global.gdnsuppress
I'm sure it's still a formatting issue but I can't see it.
Update 3 Ok, finally finished it. The last error was one line with incorrect indention. Which line doesn't matter but what I found was an awesome extension for VS Code https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml. This was recommended on another SO thread and after I installed it, the incorrect line was underlined in Red and that was that. I would highly recommend it.
Thanks Bright Ran for sticking with me on this problem

Line: 14) reported in the error message? Is there more detailed error messages/logs thrown out?