web-dev-qa-db-ja.com

Azure DevOps Pipelineでのステージの使用:予期しない値の「ステージ」

次のように始まるAzure-Pipelinesファイルを作成します。

pool:
  vmImage: 'Ubuntu-16.04'

trigger:
- master

variables:
  buildConfiguration: 'Release'
  buildPlatform: 'any cpu'
  version: '0.2.0'
  azureSubscription: 'Azure.Nupaya'
  azureAppType: 'Web App on Windows'
  webAppName: 'api'

stages:

- stage: 'Prepare'
  displayName: 'Prepare'

  jobs:

  - job: 'Setup'
    steps:
    - task: DotNetCoreInstaller@0
      displayName: 'Install'
      inputs:
        packageType: 'sdk'
        version: '2.2.105'

実行するとエラーが発生します。

 Unexpected value 'stages'

Yamlファイルでステージはサポートされていませんか?

Microsoft Docsで Schema を確認しました...

何が欠けていますか?

12
Miguel Moura

予期しない値 'jobs'で自分を見つけた場合は、嵐の構造を試してください https://stackoverflow.com/a/56111720/ 1977871

働いている鉱山はこちらです。

# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.Microsoft.com/Azure/devops/pipelines/apps/aspnet/build-aspnet-4

trigger:
- master

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  finalBuildArtifactName: 'aspnetFrameworkDropFromYaml'

stages:
- stage: 'Prepare'
  displayName: 'Prepare'

  jobs:
  - job: 'BuildPipelineNetFrameworkYaml'
    displayName: 'Build pipeline NetFramework Yaml'
    pool:
      vmImage: 'windows-latest'
      name: VivekPool1
    steps:
    - task: NuGetToolInstaller@1
      displayName: 'Use NuGet 5 3 1'
      inputs:
        versionSpec: 5.3.1

    - script: |
        echo $(build.artifactstagingdirectory) $(build.buildnumber)
        echo $(RestoreBuildProjects)   
        echo $(BuildConfiguration)
        echo The current branch is - $(Build.SourceBranchName)!!!!.
        echo $(finalBuildArtifactName)
      displayName: 'Command Line Script to write out some vars'

    - powershell: |
        # Write your PowerShell commands here.
        Write-Host "The following are the environment vars."
        get-childitem -path env:*
      displayName: 'PowerShell script to write out env vars'
    - task: NuGetCommand@2
      displayName: 'NuGet restore'
      inputs:
        restoreSolution: '$(solution)'

    - task: VSBuild@1
      displayName: 'Build solution'
      inputs:
        solution: '$(solution)'
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'

    - task: VSTest@2
      displayName: 'Test Assemblies'
      inputs:
        testAssemblyVer2: |
          **\$(BuildConfiguration)\*test*.dll
          !**\obj\**
          !**\$(BuildConfiguration)\*SeleniumTest*.dll
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'

    - task: PublishSymbols@2
      displayName: 'Publish symbols path'
      inputs:
        SearchPattern: '**\bin\**\*.pdb'
        PublishSymbols: false
      continueOnError: true

    - task: CopyFiles@2
      displayName: 'Copy ProvisionNetFramework Files to drop directory'
      inputs:
        SourceFolder: Cicd/provisionForNetFramework
        TargetFolder: '$(build.artifactstagingdirectory)/provisionForNetFramework'

    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact'
      inputs:
        PathtoPublish: '$(build.artifactstagingdirectory)'
        ArtifactName: '$(finalBuildArtifactName)'
      condition: succeededOrFailed()
0
VivekDev