And*_*rin 4 amazon-web-services aws-codecommit aws-codebuild
我们有2份报告
在 Repo 1 > package.json 中有一个依赖项
"dependencies": {
"repo-2": "git+https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo-2/"
}
Run Code Online (Sandbox Code Playgroud)
然后,在“repo-1”的 CodeBuild 中,我们有以下构建规范
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- mkdir -p ./deploy
build:
commands:
- echo "Server copy START $(date)"
- cp -r ./index.js ./deploy/index.js
- cp -r ./package.json ./deploy/package.json
- cp -r ./buildspec.yml ./deploy/buildspec.yml
- echo "Server copy END $(date)"
- echo "Server npm install START $(date)"
- cd ./deploy && npm install --production
- echo "Server npm install END $(date)"
post_build:
commands:
artifacts:
files:
- '**/*'
base-directory: 'deploy'
Run Code Online (Sandbox Code Playgroud)
CodeBuild 抛出的错误如下
npm ERR! fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo-2/': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud)
基本上,问题是:我可以使用 CodeCommit repo 作为 npm 依赖项吗?正确的做法是什么?
尝试 #1
我试图添加这个(和类似的变体)但没有成功 https://medium.com/@ngchiwang/aws-npm-install-private-codecommit-module-8512c3203c37
#尝试2
我也尝试将依赖 URL 更改为此
"repo-2": "git://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo-2"
Run Code Online (Sandbox Code Playgroud)
但是出现以下错误
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fatal: unable to connect to git-codecommit.us-east-1.amazonaws.com:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: git-codecommit.us-east-1.amazonaws.com[0: 52.94.233.146]: errno=Connection refused
Run Code Online (Sandbox Code Playgroud)
小智 7
我今天遇到了同样的问题,并通过在buildspec文件的env部分启用git-credential-helper使其工作。
例子:
version: 0.2
env:
git-credential-helper: yes
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
build:
commands:
- npm run build
Run Code Online (Sandbox Code Playgroud)
这与策略中的 CodeCommit 权限(您说您已经拥有)相结合,可以使用来自 CodeCommit 的私有 npm 包进行构建。
| 归档时间: |
|
| 查看次数: |
3256 次 |
| 最近记录: |