Search code examples
azure-devopsazure-pipelinesazure-pipelines-yaml

only main branch shows up for a new pipeline running off a feature branch


I've setup a pipeline that takes input from user to allow them to chose one or more services as a tick box and is currently running from a feature branch.

All is working fine but my issue is that when I run this pipeline it can only see the main branch not the release or other feature branches of the repo.

Could someone advise why i don't see other branches when running the pipeline? I'm specifying the branch name under "resources" though (See the code below). I don't want users to manually enter the release branch or feature branch name every time they run this pipeline.

below is the code for my pipeline

trigger: none

pool:
  vmImage: 'ubuntu-latest'

parameters:
# hyphens not supported in the name
- name: external_portal
  type: boolean
  default: false
- name: internal_portal
  type: boolean
  default: false

resources:
  repositories:
    - repository: templates
      type: git
      name: deploy-templates/deploy-templates
      ref: refs/heads/feature-branch
    - repository: external-portal
      type: git
      name: aks-microservices/ExternalPortal
      ref: refs/heads/main
    - repository: internal-portal
      type: git
      name: aks-microservices/InternalPortal
      ref: refs/heads/main
      
stages:
- ${{ if eq(parameters.external_portal, true) }}:
    - template: pipelines/templates/deploy.yml@templates
      parameters:
        aksNameSpace: 'external'
        aksServiceName: 'external-portal'
- ${{ if eq(parameters.internal_portal, true) }}:
    - template: pipelines/templates/deploy.yml@templates
      parameters:
        aksNameSpace: 'internal'
        aksServiceName: 'internal-portal'

for security i have changed my code and removed parameters etc

I was hoping to see all branches of the repo enter image description here

pipeline with correct branch selected


Solution

  • Encontered error(s): Could not find valid pipeline for this branch/tag

    In order to use the pipeline with other branches, ensure that your pipeline YAML file (e.g. azure-pipelines.yml) and related YAML templates exist in the branch you are trying to use.