添加多资源后Azure DevOps YAML流水线失败排查
解决YAML配置中添加pipelines资源后的文档解析错误
问题背景
为实现PR流水线成功后自动触发发布流水线,我在原有YAML的resources配置段中新增了pipelines资源配置。
遇到的错误
修改后运行流水线时直接抛出解析错误:
(Line: 14, Col: 1): Did not find expected
排查编码(已切换为UTF-8无BOM格式)并调整缩进后,又出现新的映射解析错误。
解决过程
最终通过VS Code的Red Hat YAML插件,直接定位到配置中错误的缩进位置,修正后问题彻底解决。
修改前后代码对比
修改前(原有resources配置)
resources: repositories: - repository: self type: git ref: main
修改后(正确的resources配置)
resources: repositories: - repository: self type: git ref: main pipelines: - pipeline: pr-build-pipeline source: PR-Build trigger: branches: include: - main
内容的提问来源于stack exchange,提问作者USMC6072
相关产品推荐
相关产品推荐

