最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

request using CI_JOB_TOKEN fails after upgrade from gitlab 17.8.4 to 17.9.1 - Stack Overflow

programmeradmin5浏览0评论

I have a problem after an update to gitlab 17.9.1 (latest) from 17.8.4. Everything seems to be working fine except the ability to get some files from the repository without cloning it, because it is huge.

Here is the relevant part from the job:

build-git-baseline:
  stage: build
  image:
    name: ....
    entrypoint: [""]
  variables:
    GIT_STRATEGY: none # Don't clone the Git repository. (Cloned in the script instead)
  script:
    - env | sort
    - >
      wget https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}/-/raw/${CI_COMMIT_SHA}/container/dockerfiles/Dockerfile.git
      -O Dockerfile.git

So the problem is that wget fails to authenticate and instead of a valid Dockerfile I get a sign in/redirection page which eventually fails being used for creating a docker container - of course.

Is there a way to test/debug this?

I created some manual jobs to test with various curl / wget requests but without success.

If I get the resulting URL and put in in a browser (where I am authenticated) it works well.

Is there a change that I need to be aware of? I should upgrade to newer version either way so rolling back to previous version is just delaying the inevitable.

All the best.

PS: I filed a gitlab issue here:

I have a problem after an update to gitlab 17.9.1 (latest) from 17.8.4. Everything seems to be working fine except the ability to get some files from the repository without cloning it, because it is huge.

Here is the relevant part from the job:

build-git-baseline:
  stage: build
  image:
    name: ....
    entrypoint: [""]
  variables:
    GIT_STRATEGY: none # Don't clone the Git repository. (Cloned in the script instead)
  script:
    - env | sort
    - >
      wget https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}/-/raw/${CI_COMMIT_SHA}/container/dockerfiles/Dockerfile.git
      -O Dockerfile.git

So the problem is that wget fails to authenticate and instead of a valid Dockerfile I get a sign in/redirection page which eventually fails being used for creating a docker container - of course.

Is there a way to test/debug this?

I created some manual jobs to test with various curl / wget requests but without success.

If I get the resulting URL and put in in a browser (where I am authenticated) it works well.

Is there a change that I need to be aware of? I should upgrade to newer version either way so rolling back to previous version is just delaying the inevitable.

All the best.

PS: I filed a gitlab issue here: https://gitlab/gitlab-/gitlab/-/issues/524418

Share edited Mar 11 at 19:01 INS asked Mar 11 at 5:25 INSINS 10.8k8 gold badges61 silver badges94 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Similar issue.

The syntax you are using is GitLab's shorthand route used within GitLab's web interface to access raw file contents directly. But the official Rest interface fails as well:

curl --header "JOB-TOKEN: <token>" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/files/<file>/raw?ref=<git-ref>"
  • https://docs.gitlab/api/repository_files/#get-raw-file-from-repository
发布评论

评论列表(0)

  1. 暂无评论