Search code examples
azure-devopsazure-pipelinesazure-yaml-pipelinesmultistage-pipeline

Azure Pipeline: Unexpected value 'steps'


Can anybody point me in the right direction here?

When I attempt to kick off the pipeline from the main yaml template the reference template gives me the unexpected 'steps' value. I attempted to add a stage before the defined job and then receive the unexpected 'stage' message. Looking at some similar previously asked questions I understand a step can't be place directly under a 'stage' but this is not the case here.

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)'

Solution

  • You are using deployment jobs. Try defining a strategy. Try replacing steps: inline with deployment with:

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