简体   繁体   English

Azure DevOps 管道 - YAML 格式错误?

[英]Azure DevOps Pipeline - YAML formatting error?

Would anyone know how to solve the following error?有人知道如何解决以下错误吗?

# 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'

The error I get on azure devops & yaml lint我在 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.

It appears on YAML Lint the error is "fixed" when I add 3 spaces in front of line 2 but azure devops will still throw a related error for the same line but other column.它出现在 YAML Lint 上,当我在第 2 行前面添加 3 个空格时,错误是“已修复”,但 azure devops 仍会为同一行但其他列抛出相关错误。

Wondering if anyone has encountered this error before as I didn't really enter any YAML code myself, but used the editor + other GUI assistants within azure devops to create this想知道以前是否有人遇到过这个错误,因为我自己并没有真正输入任何 YAML 代码,而是使用 azure devops 中的编辑器 + 其他 GUI 助手来创建这个

Refer to the YAML documentation.请参阅 YAML 文档。 You have a task (ie the first thing in the file) outside of a scope in which it's valid, which would be under steps .您在 scope之外有一个有效的task (即文件中的第一件事),该任务在steps下。

The YAML editor does not guarantee syntactically valid YAML. YAML 编辑器不保证语法上有效的 YAML。 You're better off using a more robust editor like Visual Studio Code with the Azure Pipelines extension.您最好使用更强大的编辑器,例如带有 Azure Pipelines 扩展的 Visual Studio Code。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 请参阅使用 YAML 管道在 Azure DevOps 中构建工件 - See Build Artifacts in Azure DevOps with YAML Pipeline Azure devops使用Yaml文件无法构建管道 - Azure devops build pipeline with yaml file not working Azure devops yaml 管道如何重置参数 - Azure devops yaml pipeline how to reset a parameter 有没有办法使用 Azure Devops 将 yaml 构建管道转换为发布管道? - Is there a way to translate a yaml build pipeline to a release pipeline using Azure Devops? 如何在 Azure Devops 管道中的 YAML 中设置管道“任务版本” - How to set Pipeline 'Task version' in YAML in Azure Devops pipeline 是否可以将 Azure DevOps YAML 管道集成到发布管道中? - Is it possible to integrate an Azure DevOps YAML pipeline into a release pipeline? Azure DevOps YAML 管道错误:解析块映射时未找到预期的密钥 - Azure DevOps YAML Pipeline Error: While parsing a block mapping did not find expected key Azure DevOps - 在 Azure YAML 管道的 React 构建中删除文件夹为空 - Azure DevOps - Drop folder empty in React build for Azure YAML pipeline Azure 来自 Azure DevOps YAML 管道的容器实例创建问题 - Azure Container Instance creation issue from Azure DevOps YAML pipeline Azure Devops 管道 Yaml“切换块评论”不起作用 - Azure Devops pipeline Yaml 'Toggle Block Comment' not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM