即使在不同的项目中调用,Azure Pipeline 模板是否也可以在其所在的同一项目中运行?

问题描述 投票:0回答:1

我有一个使用组变量和特定代理池的 Azure Pipeline 模板,模板所在的存储库可以访问组变量和代理池,但当我尝试从另一个项目调用此模板时,我收到此错误消息:(授权资源没有任何作用)

There was a resource authorization issue: "The pipeline is not valid. Stage snapshot: Variable group creds could not be found. The variable group does not exist or has not been authorized for use. Could not find a pool with name agents_. The pool does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."

错误信息

有没有办法让模板像在原始存储库中一样运行,而不是从调用它的项目中运行?

当我尝试从同一项目中的另一个存储库调用模板时,我所要做的就是单击“授权资源”按钮,一切都很好,但我也尝试从同一组织和项目中的另一个项目运行它在另一个组织中但收到错误。

这就是我如何称呼我的模板:

   resources:
      repositories:
        - repository: '<Repo Name>'
          name: <Project Name>/<Repo Name>
          type: git
          ref: <Branch Name>
    
   stages:
      - template: <Pipeline file.yml>@<Repo Name>
        parameters:
          Action: Delete
          HostIPs: <IPs>
          SnapshotName: <Name>
 
azure-pipelines
1个回答
0
投票

不支持从不同项目共享管道中的变量组,只能在同一项目中共享。这是一个已知的限制,并且之前提出了功能请求票

enter image description here 作为解决方法,您可以在新项目中创建相同的命名变量组,并定义相同的变量和值。它将通过验证。或者您可以将这些共享变量添加到 Azure Key Vault,并在模板中下载它们,而不是变量组。

可以

在不同的项目管道中共享

agent pool,只需从项目设置->管道->代理池将您的自托管池添加到项目中即可。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.