Search code examples
azure-devopsazure-pipelinesmultistage-pipeline

Azure pipelines - "Stages to run" does not work


Clicking on the new feature "Stages to run" on a multi-stage pipeline, I got the error message "Unable to load the pipeline's stages." Is this feature still in a sort of preview status?

stages to run

error

Yaml files below:

  • pipeline file
  • build template
  • deploy template not pasted b/c it's almost identical to build one
    ================== azure-pipelines.yml =============

    trigger: none

    variables:
      - group: var-group

      - name: PREFIX
        value: xyz

    stages:
      - stage: build_and_push
        displayName: Build/Push stage
        jobs:
        - template: build-template-job.yml
          parameters:
            countries:
              - name: Austria
                country_code: AT
              - name: Switzerland
                country_code": CH

      - stage: deploy
        displayName: Deploy stage
        jobs:
        - template: deploy-template-job.yml
          parameters:
            countries:
              - name: Austria
                country_code: AT
              - name: Switzerland
                country_code": CH

    ================== build-template-job.yml =============


    parameters:
      countries: []

    jobs:

    - job: Build_1
      pool:
        vmImage: 'Ubuntu-16.04'
      continueOnError: false
      displayName: "Building 1"

      steps:
        - task: HelmInstaller@0
          displayName: 'Install Helm'
          inputs:
            helmVersion: 2.14.3
            checkLatestHelmVersion: false

        - bash: helm package
            --version 1.0.0
            --destination $(build.artifactStagingDirectory)
            helm/
          displayName: 'Packaging the heml chart....'


    - ${{ each country in parameters.countries}}:

        # more steps....```

Solution

  • SOLVED: I moved the group definition on stage level instead of at the top of azure pipeline file.

    Example:

    stages:
      - stage: build
        variables:
          - group: my-var-group
      - stage: deploy
        variables:
          - group: my-var-group