Using access tokens with push rule restrictions

Hi,
we have a release pipeline where a version increment is committed and pushed to the repository using an access token, here’s the relevant script snippet from the gitlab-ci.yml:

- git config user.email "$GITLAB_TOKEN_NAME@$COMPANY.com"
- git config user.name "$GITLAB_TOKEN_NAME"
- git config user.password "$GITLAB_TOKEN"
- mvn -U versions:set -DnextSnapshot=true
- git commit
- git push https://$GITLAB_TOKEN_NAME:$GITLAB_TOKEN_@gitlab.com/<REPO>.git

When enabling push rules, mainly “Reject unverified users” and “Check whether the commit author is a GitLab user”, this is no longer possible and the pipeline fails, as the push is rejected due to a non-verified committer.

  1. Is it simply impossible to enforce these push rules while using access tokens?
  2. If not, what is the correct git user/email to use in such a case?

Current GItlab version is 14.6.pre, Enterprise Edition.

1 Like