microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.19k stars 926 forks source link

How to reference steps-templates from other branches? #523

Closed evertonmc closed 3 years ago

evertonmc commented 3 years ago

I want to deploy to environment staging & production from branched steps-templates e.g. bein this my head extendable template (see last line)

stages:
- stage: dev
  variables:
  - template: ../variables/common-vars.yml
  - template: ../variables/dev-vars.yml
  dependsOn: build
  condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
  jobs:
  - deployment:
    environment: dev.${{ parameters.service_project_name }}
    strategy:
      runOnce:
        deploy:
          steps:
          - template: ../templates/generic-service-deployment.yml

- stage: staging
  variables:
  - template: ../variables/common-vars.yml
  - template: ../variables/staging-vars.yml
  dependsOn: build
  condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
  jobs:
  - deployment:
    displayName: deploy ${{ parameters.service }}
    environment: staging.${{ parameters.service_project_name }}
    strategy:
      runOnce:
        deploy:
          steps:
          - template: ../templates/generic-service-deployment.yml@my-staged-branch

This throws an error of course because I can't attach resources to extended templates

stale[bot] commented 3 years ago

In order to consolidate to fewer feedback channels, we've moved suggestions and issue reporting to Developer Community. Sorry for any confusion resulting from this move.