【发布时间】:2020-10-15 21:41:41
【问题描述】:
我正在为一个项目开发 Azure DevOps 构建管道。除了 azure-pipeline.yaml 文件之外,我无法对代码本身进行任何更改。 (老实说,我对项目本身知之甚少)
我卡在 NPM 安装依赖项步骤上。我目前正在使用 YAML 管道,但如果在经典模式下有解决方案,我会采用。
问题如下:
我已经创建了管道,并根据文档检查了一个私有 Bitbucket 存储库:
resources:
repositories:
- repository: MyBitBucketRepo1
type: bitbucket
endpoint: MyBitBucketServiceConnection
name: MyBitBucketOrgOrUser/MyBitBucketRepo
接下来我设置正确的node版本,并执行npm install任务
- task: Npm@1
displayName: 'NPM install'
inputs:
command: 'install'
workingDir: 'the working directory'
到目前为止一切顺利。但是,存在对另一个 Bitbucket 存储库的依赖关系。在 package.json 中有这样的依赖:
another-dependency: git:https://bitbucket.org/organisation/repo.git#v1.1.3
我确实有权访问此存储库,但如果我运行 NPM install 它无法重新使用第一个存储库中的凭据。
我已尝试将两个存储库都添加到resources,希望能奏效。但还是同样的错误:
error fatal: Authentication failed for 'https://bitbucket.org/organisation/repo.git/'
我尝试设置一些缓存机制,在第二个 repo 上运行 npm install,存储依赖项,在第一个 repo 上运行 npm install。但不幸的是,这并没有奏效。
Azure Devops 管道中是否有一种方法(无需更改项目设置)来完成这项工作?
谢谢!
【问题讨论】:
-
嗨,朋友,这个有什么更新吗?你试过我最新的解决方法吗?
-
我还没有时间测试它.. 会尽快回复你@LanceLi-MSFT
标签: azure npm azure-devops yaml azure-pipelines