Error `remote: GitLab: API is not accessible` when pushing to protected branches
Summary
When I try to push to a protected branch I see an error:
remote: GitLab: API is not accessible
To http://192.168.20.9:3000/test-project.git
! [remote rejected] protected-branch -> protected-branch (pre-receive hook declined)
error: failed to push some refs to 'http://root@192.168.20.9:3000/test-project.git'
Pushing to an unprotected branch works as expected.
This happens when using GDK on master
, and omnibus-gitlab images built from master
.
This bug is causing a few E2E tests to fail:
Steps to reproduce
- Create a project with a protected branch
- Try to push to the protected branch
What is the current bug behavior?
The push fails, showing an error: remote: GitLab: API is not accessible
What is the expected correct behavior?
The push fails, but the error should be: remote: GitLab: You are not allowed to push code to protected branches on this project
Relevant logs and/or screenshots
There is one entry in api_json.log
that seems relevant and unexpected:
{
"time": "2020-02-27T01:41:28.158Z",
"severity": "INFO",
"duration": 30.44,
"db": 9.27,
"view": 21.17,
"status": 403,
"method": "POST",
"path": "/api/v4/internal/allowed",
"params": [
{
"key": "action",
"value": "git-receive-pack"
},
{
"key": "changes",
"value": "902c090b066027b814061c51d59a8e9371fa7d35 d6261aabb9bdf4761f19d166f51a58d101d066ca refs/heads/protected-branch\n"
},
{
"key": "gl_repository",
"value": "project-72"
},
{
"key": "project",
"value": "/home/mark/dev/gdk/repositories/@hashed/87/22/8722616204217eddb39e7df969e0698aed8e599ba62ed2de1ce49b03ade0fede.git"
},
{
"key": "protocol",
"value": "http"
},
{
"key": "env",
"value": "{\"GIT_ALTERNATE_OBJECT_DIRECTORIES\":[\"/home/mark/dev/gdk/repositories/@hashed/87/22/8722616204217eddb39e7df969e0698aed8e599ba62ed2de1ce49b03ade0fede.git/./objects\"],\"GIT_ALTERNATE_OBJECT_DIRECTORIES_RELATIVE\":[\"objects\"],\"GIT_OBJECT_DIRECTORY\":\"/home/mark/dev/gdk/repositories/@hashed/87/22/8722616204217eddb39e7df969e0698aed8e599ba62ed2de1ce49b03ade0fede.git/./objects/incoming-sNeQp3\",\"GIT_OBJECT_DIRECTORY_RELATIVE\":\"objects/incoming-sNeQp3\"}"
},
{
"key": "user_id",
"value": "1"
},
{
"key": "secret_token",
"value": "[FILTERED]"
}
],
"host": "localhost",
"remote_ip": "127.0.0.1",
"ua": "Ruby",
"route": "/api/:version/internal/allowed",
"gitaly_calls": 3,
"gitaly_duration": 5.24,
"correlation_id": "beaca916-fd10-4c3b-9603-b1c511118ae1"
}
Output of checks
This happens on master
.
More info
The bug can be reproduced on GDK using Gitaly version 1.87.0
, so it doesn't seem to be related to the recent production issue: gitlab-com/gl-infra/production#1710 (closed)
Edited by Mark Lapierre