fatal: unable to access ‘http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx
问题描述:VUE前端项目,编写GitLab流水线.gitlab-ci.yml文件后,执行流水线构建报错如下Running with gitlab-runner 11.9.2 (fa86510e)on dflq@172.00.0.0@xx xxxxxxxxUsing Shell executor...Running on xxxxxxxxxxxx...DEPRECATION: this GitLab
·
问题描述:VUE前端项目,编写GitLab流水线
.gitlab-ci.yml
文件后,执行流水线构建报错如下
Running with gitlab-runner 11.9.2 (fa86510e)
on dflq@172.00.0.0@xx xxxxxxxx
Using Shell executor...
Running on xxxxxxxxxxxx...
DEPRECATION: this GitLab server doesn't support refspecs, gitlab-runner 12.0 will no longer work with this version of GitLab
Cloning repository...
Cloning into '/home/gitlab-runner/builds/b80bb1e3/0/xxxxxxxxxxxx/xxxx-xxxxx-xx'...
remote: You are not allowed to download code from this project.
fatal: unable to access 'http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@172.00.0.0/xxxxxxxxxxxx/xxxx-xxxxx-xx.git/': The requested URL returned error: 403
bash: line 57: cd: /home/gitlab-runner/builds/xxxxxxxx/0/xxxxxxxxxxxx/xxxx-xxxxx-xx: No such file or directory
ERROR: Job failed: exit status 1
流水线脚本如下
stages:
- standalone
image: node:alpine
install_deps:
stage: standalone
variables:
ImageName: "xxx.xxx.xxxxxxxxx.com/xxx-xxx-xxx/xxxx-xxxxx-xx:$CI_PROJECT_NAME-SNAPSHOT-$CI_BUILD_ID"
script:
# - npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
- npm set registry https://registry.npm.taobao.org
- npm install --registry=http://registry.npm.taobao.org
# - VERSION=`npm run dev | awk 'END{print}'`
# - echo "name = ${CI_PROJECT_NAME}, version = ${VERSION}"
- npm run build:prod
- docker build . --tag $ImageName
- docker push $ImageName
- docker rmi $ImageName
- echo " 本次构建的镜像为:$ImageName "
only:
- master
- develop
- 参考文章:https://stackoverflow.com/questions/40006690/gitlab-runner-the-requested-url-returned-error-403
大致意思:在项目页面中,单击设置,然后单击成员。将您自己(或生成生成版本的用户)作为成员添加到项目中,我使用了"Master"
(或意为root)角色,但根据本文档,您可能至少可以使用"Reporter"
角色,报告者角色是仍然有权访问"拉项目代码"的最低权限。这删除了我的403错误并允许我继续
再次运行流水线 Succeeded
!!
更多推荐
已为社区贡献1条内容
所有评论(0)