Introduction
GitLab Runners are critical in executing CI/CD pipelines, but users occasionally encounter problems when attempting to unregister a Runner. One such error is the “Unregistering runner from GitLab forbidden” message, which can be inconvenient to resolve. In this guide, we will look at how to fix this problem without editing the GitLab configuration file, providing a simple solution for other users who are experiencing similar problems.
Error Message:
When users try to unregistered a Runner, they may get the following error message:
$ gitlab-runner unregister --url https://gitlab.com/ --token your $GITLAB_TOKEN
ERROR: Unregistering runner from GitLab forbidden runner=G85489KL status=DELETE https://gitlab.com/api/v4/runners: 403 Forbidden
FATAL: Failed to unregister runner
Resolution Without Editing GitLab Config File:
To fix the “Unregistering runner from GitLab forbidden” problem without changing the GitLab configuration file, follow these steps:
Use the GitLab Runner command to verify and remove invalid Runners.
gitlab-runner verify --delete
Manually update the Runner configuration:
sudo gitlab-runner stop
sudo vi /etc/gitlab-runner/config.toml #Remove lines from file.
sudo gitlab-runner start
Verification:
After applying the above steps, verify that the Runner has been unregistered successfully by listing the Runners:
gitlab-runner list
Conclusion:
Experiencing errors when unregistering GitLab Runners can be frustrating, but by following the steps outlined in this guide, you can effectively resolve the “Unregistering runner from GitLab forbidden” issue. Whether using the GitLab Runner command or manually updating the Runner configuration, these methods offer a simple solution for users facing similar problems. By addressing this issue as soon as possible, you will be able to ensure smooth CI/CD pipeline management and optimize your GitLab environment for more efficient development workflows.
You may like this post : Gitlab unable to get local issuer certificate