CI Pipelines fail for API commits using Project Access Token
Summary
A commit via API using an Project Access Token will lead to total failure of the CI pipeline.
The pipeline will work for the same API call using Personal Access Token
Steps to reproduce
- Have a repository with a simple pipeline
- Create an API call committing a change to that repository using a Project Access Token
Example script: https://gitlab.com/eblom/testapibug/-/blob/master/gitlab_api_commit_test.py This expects one parameter, the TOKEN.
If this TOKEN is a Project Access Token the script works, but the pipeline triggered by the commit fails.
If the TOKEN is a Personal Access Token also the pipeline works
Example Project
A minimal working example can be found here: https://gitlab.com/eblom/testapibug/
But since I don't have access to Project Access Tokens I can only demonstrate the working version by using a personal access token ( https://gitlab.com/eblom/testapibug/-/pipelines/187263986 )
What is the current bug behavior?
Commits created by API call using a Project Access Token lead to "HTTP Basic: Access denied" issues in the CI pipeline for every job of the pipeline
What is the expected correct behavior?
A Project Access Token should allow the same behavior as a Personal Access Token?
Relevant logs
This is a copy of a internal log (with some redactions).
Running with gitlab-runner 13.2.2 (a998cacd)
on Docker runner for GROUP XraKdDsD
Preparing the "docker" executor
Using Docker executor with image python:latest ...
Pulling docker image python:latest ...
Using docker image sha256:a7cda474cef4f5cbc00c8f72b1a1eda717c425fa3994fb90997b0216fc21598c for python:latest ...
Preparing environment
Running on runner-xrakddsd-project-586-concurrent-0 via 61d6efd6d430...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/GROUP/PROJECT/.git/
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://SERVER/GROUP/PROJECT.git/'
ERROR: Job failed: exit code 1
Results of GitLab environment info
Gitlab CE 13.3.5 gitlab-runner 13.2.2 using Docker Runner
Workaround
A possible workaround for us is using a private access token stored in the variable