Как перенести конвейер из визуального конструктора в конвейер YAML? При разборе сопоставления блока не нашел ожидаемого ключа - PullRequest
0 голосов
/ 29 октября 2018

Из-за этот вопрос Мне нужно было переключиться на конвейер YAML. Таким образом, я запустил новый конвейер и вставил в задание YAML задачу от визуального дизайнера.

Я предполагаю, что мне не нужно повторять слово

steps:

Таким образом, весь конвейер теперь

pool:
  vmImage: 'VS2017-Win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 2.1.5'
  inputs:
    version: 2.1.403


- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '**/Api*.csproj'

    #Your build pipeline references an undefined variable named ‘Parameters.projects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

    - task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

Но это дает ошибку

azure-pipelines.yml (Line: 35, Col: 5, Idx: 1118) - (Line: 35, Col: 6, Idx: 1119): While parsing a block mapping, did not find expected key.

1 Ответ

0 голосов
/ 29 октября 2018

Проблема в этой строке - task: PublishBuildArtifacts@1, строка с пробелами. просто прикрепите текст к началу строки.

pool:
  vmImage: 'VS2017-Win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 2.1.5'
  inputs:
    version: 2.1.403


- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '**/Api*.csproj'

    #Your build pipeline references an undefined variable named ‘Parameters.projects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
...