依赖于私有AZ回购的Azure构建管道 [英] Azure build pipeline with dependency on private AZ repo

查看:65
本文介绍了依赖于私有AZ回购的Azure构建管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Azure存储库中有一个Angular项目,该项目在依赖项下的packages.json文件中引用了另一个私有Azure项目/存储库.该项目在本地为所有开发人员构建良好,但是在Azure管道中通过身份验证失败.将代码从私有Azure存储库中提取代码到另一个项目构建管道的正确方法是什么?

We have an Angular project in an Azure repo that references another private Azure project/Repo in the packages.json file under dependencies. The project builds fine locally for all developers, but fails in the Azure Pipeline with Authentication failed. What is the correct way to pull code from a private Azure repo into another projects build pipeline?

我将访问协议从ssh更改为https,并做了很多有关如何实现此目的的阅读.我已经阅读了有关个人访问令牌的信息,但这似乎不是一个好的解决方案.

I changed the access protocol from ssh to https and have done a lot of reading about how to accomplish this. I have read about the personal access tokens, but this doesn't seem like a good solution.

"core-js": "^2.5.4",
"xxx": "git+https://xxx@dev.azure.com/xxx/xxx#master",
"date-fns": "^1.30.1",

注意:该错误表明是致命的:' https://dev.azure.com/ ...,在依赖项url中不包含提供的用户名.

Note: The error is saying fatal: Authentication failed for 'https://dev.azure.com/..., which doesn't include the provided username in the dependency url.

推荐答案

与您同意.我还认为使用PAT令牌不是一种安全方法,因为它不能完全公开令牌.

Agree with yours. I also think that using PAT token is not a security way, because it does not expose the token exactly.

如果要使用SSH,首先需要确保要安装的存储库在根目录下具有package.json.

If you want to use SSH, you need first sure that the repos you want to install has a package.json at root.

然后,使用命令:vssh-keygen -t rsa生成一对公钥/私钥.之后,您可以按照以下文档操作:

And then, generate a pair of public/private key with the command: vssh-keygen -t rsa. After that, you can follow this doc: Use SSH key authentication to install them into your org.

使用SSH克隆存储库,这将使您的客户端接受服务器表示的指纹.然后,进入存储库页面,获取用于克隆存储库的SSH URI,并将其添加到package.json文件的依赖项部分:

Clone the repos with SSH, and this will make your client accept the fingerprint expressed by the server. Then, go repos page, get the SSH URI to cloning your repos and add it into the dependencies section of your package.json file:

 "dependencies": {
    "testproj": "git+ssh://account@ssh.visualstudio.com:v3/{org name}/{project name}/{repos name}"
  }

这篇关于依赖于私有AZ回购的Azure构建管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆