Salvo
Salvo

Reputation: 41

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:

    ================== 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....```

Upvotes: 4

Views: 7321

Answers (2)

Levi Lu-MSFT
Levi Lu-MSFT

Reputation: 30313

The error unable to load the pipeline's stages might indicate that there is some error in your yaml pipeline(eg. syntax error, bad indentation).

I tested on my multiple stages pipeline. It worked fine. But when I purposely put an error in my pipeline, I got the same error as yours.

enter image description here

You can try runing your pipeline in the normal way without choosing stages to skip. The pipeline will fail to start, if there is format error in your pipeline.

If your pipeline can run successfully without using this feature. Please share your sample pipeline, so that I can reproduce your scenario and troubleshoot.

Update:

I tested your yaml and found the variable group defined outside stages caused this error. If you moved the variable group inside each stage, the feature would work again.

You can try defining your variable group in each stage. To report this problem you can click here (click report a problem and choose Azure Devops)

Upvotes: 3

Salvo
Salvo

Reputation: 41

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

Upvotes: 0

Related Questions