Problem to solve
I am trying to create a new CI/CD component project. I am using this documentation Link as a guide.
However, when it comes to testing the component (anchor), I run into an issue - the check-job that asks for existence fails with the following error:
$ route="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs" # collapsed multi-line command
jq: error (at <stdin>:0): Cannot index string with string "name"
I removed the jq filter to find the source of the issue, and it shows the following:
$ route="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs"
$ curl -s "$route" | jq
{
"message": "404 Project Not Found"
}
I guess the reason is a combination of the visiblity of internal
(enforced by admin) with the limited set of API endpoint available (docs) to the CI_JOB_TOKEN - the job token can only access metadata and pipeline triggers, not the jobs of a pipeline. When I use the same URL with a personal access token, I get the required information.
Does anyone see the same behaviour? How can I work around this?
Steps to reproduce
Any new project with a visibility of internal
should have this issue.
Configuration
- Project visibility
public
is disabled
Versions
- Self-managed
-
GitLab.com
SaaS - Dedicated
Versions
- GitLab 18.0.5-ee