0

Well, I have the following code that uses a template file in azure Devops:

resources:
  repositories:
    - repository: templates
      type: git
      name: "Framework Back-end/templates-devops"

extends:
  template: azure-pipelines-template.yml@templates

This works very well, downloading yml file from another project inside same organization. But inside my "azure-pipelines-template.yml" I'm trying to do the following:

  - job: Deploy
    pool: ${{parameters.agent}}
    displayName: Deploy on Kubernetes
    dependsOn: Push
    condition: and(succeeded(), in(variables['Build.SourceBranchName'], 'master', 'main', 'qas', 'develop'))
    steps:
    - checkout: self
    - checkout: templates

But I got the error:

remote: TF401019: The Git repository with name or identifier templates-devops does not exist or you do not have permissions for the operation you are attempting.
fatal: repository 'https://xx@xx/xxx/Framework%20Back-end/_git/templates-devops/' not found

I need to make a checkout because in other steps I will need to use the files that exist in "template-devops" repository. I can't understand why my pipeline can download the "azure-pipelines-template.yml" file but can't checkout the repository.

SOLVED

Was a permission problem in Settings , I disabled the flags:

Limit job authorization scope to referenced Azure DevOps repositories

Limit job authorization scope to current project for non-release pipelines

Limit job authorization scope to current project for release pipelines

Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92
  • Quick note: These above settings must be updated in the Project where the pipeline is being run. And the Last one still can be enabled which worked for me. – Alex Raj Kaliamoorthy Jun 16 '21 at 03:22
  • Service connection required for other project repo. – Srinivas Charan Mamidi Jul 18 '21 at 18:12
  • If that project is in a separate Azure DevOps organization, you'll need to configure a service connection of type Azure Repos/Team Foundation Server with access to the project and include that in YAML, in the `endpoint` property – Leif Jan 26 '22 at 07:49

1 Answers1

0

I create a demo to reproduce your environment, but it works well on my side. The checkout step works well. Here is my yaml file and temp file:

Main.yaml

resources:
  repositories:  
  - repository: templates
    type: git
    name: MyAgile TestPro/yaml

pool:
  name: 'default'


extends:
  template: azure-pipelines-template.yml@templates

Temp.yaml

  stages:
    - stage: 
      jobs:
        - job: Deploy
          steps:
            - checkout: self
            - checkout: templates
            - task: PowerShell@2
              inputs:
                targetType: 'inline'
                script: |
                  # Write your PowerShell commands here.
                  
                  Write-Host "Hello World MyAgileTestPro temp"

My test result: enter image description here

At present, we recommend you can check if your account has the project admin level for your project Framework Back-end. And please check if there is any name changed about your project.

Felix
  • 1,104
  • 3
  • 6