Azure DevOps Pipeline - YAML 格式错误?

标签 azure azure-devops formatting yaml devops

有人知道如何解决以下错误吗?

# Starter pipeline
- task: CloudFormationCreateOrUpdateStack@1
  inputs:
    awsCredentials: 'aws_test'
    regionName: 'us-east-1'
    stackName: 'test'
    templateSource: 'url'
    templateUrl: 'https://gist.githubusercontent.com/lizrice/5889f33511aab739d873cb622688317e/raw/c2ba38eb72b350fec28b50df0d8f74b51e1a68e8/vpc-fargate.yaml'
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
  vmImage: ubuntu-latest
steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'
- script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See https://aka.ms/yaml
  displayName: 'Run a multi-line script'

我在 azure devops 和 yaml lint 上遇到的错误

Other Errors
2 error(s), 0 warning(s)
    /azure-pipelines-1.yml (Line: 2, Col: 1): A sequence was not expected
    /azure-pipelines-1.yml: (Line: 13, Col: 1, Idx: 461) - (Line: 13, Col: 1, Idx: 461): While parsing a block collection, did not find expected '-' indicator.

在 YAML Lint 上,当我在第 2 行前面添加 3 个空格时,错误已“修复”,但 azure devops 仍会针对同一行但其他列抛出相关错误。

想知道以前是否有人遇到过这个错误,因为我自己并没有真正输入任何 YAML 代码,而是使用 azure devops 中的编辑器和其他 GUI 助手来创建此错误

最佳答案

请参阅 YAML 文档。您有一个任务(即文件中的第一件事)超出其有效范围,该任务位于steps下。

YAML 编辑器不保证 YAML 语法有效。最好使用更强大的编辑器,例如带有 Azure Pipelines 扩展的 Visual Studio Code。

关于Azure DevOps Pipeline - YAML 格式错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70675019/

相关文章:

c# - 使用云服务对 Web 应用程序进行压力测试

sql - 延迟写入 SQL Server

android - 应用程序不断停止(仅在Azure DevOps的apk上)?

azure-devops - 在步骤条件中使用矩阵环境变量的 Azure 管道

LaTeX - 序言中的表格左对齐(即不居中)?

java - Eclipse:设置自动格式化的最大行长?

Azure 说 "Unsupported Token"

c#-4.0 - Azure 上的 Hadoop C#同位素

Azure管道: could not extract archive

.net - 将货币/小数转换为字符串