gpt4 book ai didi

Gitlab-CI 无法克隆

转载 作者:行者123 更新时间:2023-12-05 00:59:08 31 4
gpt4 key购买 nike

我为 Gitlab-CI 配置了一个非常基本的集成,但是当它必须克隆代码时,它几乎在一开始就失败了。

我的集成是这样的:

image: node:latest

stages:
- build
- test

cache:
paths:
- node_modules/
- dist/

build-prod:
stage: build
script:
- npm install
- npm run build-prod
artifacts:
paths:
- node_modules/
- dist/

test_with_karma:
stage: test
script: ng test

我得到的错误是:

Running with gitlab-runner 11.7.0 (8bb608ff)
on fakehost 2eaf11ea
Using Docker executor with image node:latest ...
Pulling docker image node:latest ...
Using docker image sha256:8c67bfd7b95bdc535edc4a4144f5392b0f73efd6385fbcb47747d028d7059359 for node:latest ...
Running on runner-2eaf11ea-project-56-concurrent-0 via fakehost...
Cloning repository...
Cloning into '/builds/redacted/frontend'...
remote: You are not allowed to download code from this project.
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@working-domain.com/redacted/frontend.git/': The requested URL returned error: 403
/bin/bash: line 65: cd: /builds/redacted/frontend: No such file or directory
ERROR: Job failed: exit code 1

这里有什么问题?

最佳答案

检查这是否被 gitlab-org/gitlab-ce issue 39469 覆盖

YAY - it works for me. This problem seems to have multiple solutions.

The one that worked for me is #44855

To summarize. Being an Administrator on Gitlab does not mean you have the "access" to do whatever you want to do in Gitlab.

"Unable to access" permissions applies to the person who is logged into Gitlab and running the job.
To fix the problem - the person / account running the job must be a member (master) of the project.

This will apply to private projects.
It is not necessary to make a private project Public even though that appears to fix the problem. GITLAB suggests you must have https for the project to work you can use http.

SOLUTION - add your account to the project even if you are the Administrator

还有:

Conrad has described it correctly.

You need to have rights to the project to run pipeline, however, as administrator, you can start any pipeline.

I've got the case when the user being Admin in Gitlab could push his commit from command line, although theoretically having no rights to project - and the pipeline has failed.

This inconsistency need to be fixed, either Admin user should not be able to push/start pipeline, having no rights for it, or he should authomatically be granted all rights to all projects. I'd prefer the first one, because it separates gitlab administration from project rights. Sometimes I prefer not having full rights, just like working as non-root under Linux.

关于Gitlab-CI 无法克隆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54468530/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com