[英]Azure DevOps YAML Pipeline Error: While parsing a block mapping did not find expected key
I just created a pipeline using the YAML file and I am always getting the error "/_Azure-Pipelines/templates/webpart.yml: (Line: 41, Col: 27, Idx: 1058) - (Line: 41, Col: 60, Idx: 1091): While parsing a block mapping, did not find expected key.".我刚刚使用 YAML 文件创建了一个管道,但我总是收到错误“/_Azure-Pipelines/templates/webpart.yml: (Line: 41, Col: 27, Idx: 1058) - (Line: 41, Col: 60 , Idx: 1091): 解析块映射时,没有找到预期的键。”。 I already verified the indentation of my YAML file and that looks fine.
我已经验证了我的 YAML 文件的缩进,看起来不错。
Below is my YAML file.下面是我的 YAML 文件。
parameters:
- name: azureSubscription
type: string
- name: cdnStorageAccount
type: string
- name: cdnResourceGroupName
type: string
- name: cdnEndpointName
type: string
- name: cdnProfileName
type: string
- name: sourceBranchTrigger
type: string
stages:
- stage: build_stage
displayName: "Build"
jobs:
- job: build_job
steps:
- task: UseNode@1
displayName: "Use Node 8.x"
inputs:
version: "8.x"
- task: CmdLine@2
displayName: "Build"
inputs:
script: |
cd ./Webparts
npm run build-server
- task: PublishBuildArtifacts@1
displayName: "Publish Build Artifact (Apps)"
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
PathtoPublish: "Webparts/sharepoint/solution/webpart.sppkg
ArtifactName: Apps
- task: PublishBuildArtifacts@1
displayName: "Publish Build Artifact (Scripts)"
condition: ne(variables['Build.Reason'], 'PullRequest')
inputs:
PathtoPublish: "Webparts/temp/deploy"
ArtifactName: Scripts
It was due to a missing quotation mark in the task PublishBuildArtifacts@1
for the PathtoPublish
.这是由于 PathtoPublish 的任务
PathtoPublish
PublishBuildArtifacts@1
中缺少引号。 I found this error by using a YAML
extension provided by RedHat
.我通过使用
RedHat
提供的YAML
扩展发现了这个错误。
Once you enabled that extension and set the formatted for YAML (SHIFT + ALT + F), it should show you the errors in your YAML file.一旦启用该扩展并设置 YAML 的格式(SHIFT + ALT + F),它应该会显示 YAML 文件中的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.