Azure 管道:意外值 'steps'

Azure Pipeline: Unexpected value 'steps'

有人能给我指出正确的方向吗?

当我尝试从主 yaml 模板启动管道时,参考模板给了我意外的 'steps' 值。 我试图在定义的作业之前添加一个阶段,然后收到意外的 'stage' 消息。查看一些类似的以前问过的问题,我知道不能将步骤直接放在 'stage' 下,但这里不是这种情况。

parameters:
- name: baseEnvironmentName
  type: string
- name: environmentSuffix
  type: string
- name: postDeploySteps
  type: stepList
  default: []
- name: publishedPackageName
  type: string
- name: serviceName
  type: string
- name: dnsHostName
  type: string

jobs:
- deployment: ${{ parameters.environmentSuffix }}Deployment
  displayName: '${{ parameters.environmentSuffix }} Deployment'
  pool:
    vmImage: 'windows-2019'
  environment: ${{ parameters.baseEnvironmentName }}-${{ parameters.environmentSuffix }}
  variables:
    - template: variables/variables.common.yaml
    - template: variables/variables.${{ parameters.environmentSuffix }}.yaml
    - name: MonitorExceptionAlert_Name
      value: '${{ variables.IdPrefix }}-${{ parameters.environmentSuffix }}-${{ parameters.dnsHostName }}-ExceptionAlert'

  steps:
  - checkout: self
  - checkout: common_iac

- task: Random Task Name
  displayName: 'Create Environment Resource Group'
  inputs:
    ConnectedServiceName: '$(ADOS.ServiceConnectionName)'
    resourceGroupName: '$(ResourceGroup.Name)'
    location: '$(ResourceGroup.Location)'
    condition: and(succeeded(), ne(variables['CreateResourceGroupInTaskGroup'], 'false'))

- task: Random Task Name 2
  displayName: 'Create Application Insights'
  inputs:
    ConnectedServiceName: '$(ADOS.ServiceConnectionName)'
    ResourceGroupName: '$(ResourceGroup.Name)'
    Location: '$(ResourceGroup.Location)'
    instanceName: '$(ApplicationInsights.Name)'

the Azure docs templates page 的示例中,jobs: 应该包含一个 - job:,其中包含 steps:。不知道jobs:可以直接包含steps:.

您正在使用 deployment jobs。尝试定义一个 strategy。尝试将 steps: 内联部署替换为:

- deployment: ....   
  strategy:
        runOnce:
            deploy:
                steps: