Download the artifacts archive API returns 404
Summary
Using the Download the artifacts archive fails in one pipeline where it worked before. In other pipelines where we do exactly the same it still works. Executing the same commands on a local machine in powershell everything works fine. It just fails in this one pipeline.
Since we don't have Premium subscription we use the PRIVATE_TOKEN header to authenticate. The whole script looks like this (ran by a windows shell runner):
script:
- $wc = New-Object System.Net.WebClient
- $wc.Headers.Add("PRIVATE-TOKEN", "${GITLAB_TOKEN}")
- $wc.DownloadFile("https://gitlab.com/api/v4/projects/<redacted id>/jobs/artifacts/trunk/download?job=build:windows", "${CI_PROJECT_DIR}\artifact.zip")
This returns
Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found."
Also tried to make the request with Invoke-WebRequest and passing the token via get parameter instead of in a header:
curl -OutFile ${CI_PROJECT_DIR}\artifact.zip "https://gitlab.com/api/v4/projects/<redacted id>/jobs/artifacts/master/download?job=build:windows&private_token=${GITLAB_TOKEN}"
curl : {"message":"404 Project Not Found"}
$GITLAB_TOKEN is a private token with api scope.
This is a serious issue to us as we need to pull artifacts of other projects and breaks our previously working pipeline.
Steps to reproduce
Not sure. Still works in other pipelines.
What is the current bug behavior?
API request returns 404
What is the expected correct behavior?
API returns artifact archive
Output of checks
This bug happens on GitLab.com