问题描述: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
script:
- npm set registry https://registry.npm.taobao.org
- npm install --registry=http://registry.npm.taobao.org
- npm run build:prod
- docker build . --tag xxx.xxx.xxxxxxxxx.com/xxx-xxx-xxx/xxxx-xxxxx-xx:$CI_PROJECT_NAME-SNAPSHOT-$CI_BUILD_ID
- docker push xxx.xxx.xxxxxxxxx.com/xxx-xxx-xxx/xxxx-xxxxx-xx:$CI_PROJECT_NAME-SNAPSHOT-$CI_BUILD_ID
- echo xxx.xxx.xxxxxxxxx.com/xxx-xxx-xxx/xxxx-xxxxx-xx:$CI_PROJECT_NAME-SNAPSHOT-$CI_BUILD_ID
only:
- master
- develop
大致意思:在项目页面中,单击设置,然后单击成员。将您自己(或生成生成版本的用户)作为成员添加到项目中,我使用了"Master" (或意为root)角色,但根据本文档,您可能至少可以使用"Reporter" 角色,报告者角色是仍然有权访问"拉项目代码"的最低权限。这删除了我的403错误并允许我继续
再次运行流水线 Succeeded!!
|