0

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)'
DreadedFrost
  • 2,602
  • 1
  • 11
  • 29
Taylor83
  • 17
  • 6
  • Does this answer your question? [Error Unexpected value 'steps' in azure-pipelines.yml](https://stackoverflow.com/questions/63271899/error-unexpected-value-steps-in-azure-pipelines-yml) – Julia Feb 01 '22 at 15:55
  • Not quite but pretty similar... – Taylor83 Feb 01 '22 at 16:10
  • 2
    Your indentation is all over the place. Is this how your yaml file is actually indented? If so, you may want to 1. use VsCode to open the file 2. Install the Azure Pipelines extension in VsCode 3. Set file type form yaml to azure Pipelines you should see syntax warnings pop up and then address indentations as needed. – sonofhamer Feb 02 '22 at 20:32

2 Answers2

3

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

- deployment: ....   
  strategy:
        runOnce:
            deploy:
                steps:
DreadedFrost
  • 2,602
  • 1
  • 11
  • 29
-1

From the example at the Azure docs templates page, jobs: should contain a - job: which contains steps:. I don't know that jobs: can directly contain steps:.

Conrad Albrecht
  • 1,976
  • 2
  • 15
  • 19