azure-pipelines.yml指南

时间:2019-07-25 23:07:28

标签: azure azure-devops azure-pipelines

这是我第一次使用azure管道,我开始创建azure-pipeline.yml,但得到/azure-pipelines.yml(第16行,第1行):意外值'stages'

我按照documentation

对齐了所有内容
trigger:
  - master

pr:
  - master

pool:
  vmImage: 'ubuntu-latest'


stages: # this line throws an error and i can't figure out why
- stage: Docker Tag and Push to Registry
  jobs:
  - job: Build and push to Azure Container Registry
    steps:
    - template: az-pipeline-templates/docker-build-tag.yml  # Template reference
- stage: Deploy to US East
  dependsOn: Docker Tag and Push to Registry    # this stage runs after Docker Tag and Push to Registry
  - job: Deploy to Azure Kubernetes Service
    steps:
    - template: az-pipeline-templates/deploy-to-aks.yml  # Template reference

运行此操作将导致:

  

/azure-pipelines.yml(第16行,第1行):意外值“阶段”

1 个答案:

答案 0 :(得分:0)

  

/azure-pipelines.yml(第16行,第1行):意外值“阶段”

此错误消息是由您指定的pool引起的。您不应该在pool之外指定stages

正确的格式应为:

trigger:
  - master

pr:
  - master

stages: # this line throws an error and i can't figure out why
- stage: Docker Tag and Push to Registry
  jobs:
  - job: Build and push to Azure Container Registry
    pool:
      vmImage: 'ubuntu-latest'
    steps:
    - template: az-pipeline-templates/docker-build-tag.yml  # Template reference
- stage: Deploy to US East
  dependsOn: Docker Tag and Push to Registry    # this stage runs after Docker Tag and Push to Registry
  - job: Deploy to Azure Kubernetes Service
    pool:
      vmImage: 'ubuntu-latest'
    steps:
    - template: az-pipeline-templates/deploy-to-aks.yml  # Template reference