4

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....```
Salvo
  • 41
  • 1
  • 5

2 Answers2

3

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)

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • The pipeline runs normally. I edited the post adding the yaml code – Salvo Jan 17 '20 at 08:38
  • [Update] even though the pipeline runs, there should be some not correct in the yml files. I need to review them. Tnx – Salvo Jan 17 '20 at 09:16
  • I've found the issue, it's not related to yaml format but this error: _Failed to retrieve pipeline stages: Variable group was not found or is not authorized for use. For authorization details, refer to https://aka.ms/yamlauthz._ It's weird because the access to all variables groups is granted to all pipelines. Any idea? – Salvo Jan 17 '20 at 10:45
  • I tested 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. – Levi Lu-MSFT Jan 18 '20 at 06:57
0

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
Salvo
  • 41
  • 1
  • 5