Dependency proxy is unavailable for a normal user
Summary
Dependency proxy is unavailable when building within a repo which belongs to a normal user, not a group.
Steps to reproduce
-
Install (self-hosted) Gitlab with dependency proxy enabled, add a runner with a docker executor
-
Create
myuseruser andmygroupgroup (in my casemyuseris a member ofmygroup) -
Create
mygroup/testreporepo with.gitlab-ci.ymlimage: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/alpine:latest job: script: - echo ok -
Observe pipeline success
-
Observe lines in job output:
Using Docker executor with image gitlab.example.com:443/mygroup/dependency_proxy/containers/alpine:latest ... Authenticating with credentials from job payload (GitLab Registry) Pulling docker image gitlab.example.com:443/mygroup/dependency_proxy/containers/alpine:latest ... -
Fork
testrepobymyuser -
Trigger pipeline by pushing to
myuser/testrepo -
Observe pipeline failure
-
Observe lines in job output:
Using Docker executor with image gitlab.example.com:443/myuser/dependency_proxy/containers/alpine:latest ... Authenticating with credentials from job payload (GitLab Registry) Pulling docker image gitlab.example.com:443/myuser/dependency_proxy/containers/alpine:latest ... WARNING: Failed to pull image with policy "always": Error response from daemon: error parsing HTTP 404 response body: unexpected end of JSON input: "" (manager.go:214:0s) ERROR: Job failed (system failure): failed to pull image "gitlab.example.com:443/myuser/dependency_proxy/containers/alpine:latest" with specified policies [always]: Error response from daemon: error parsing HTTP 404 response body: unexpected end of JSON input: "" (manager.go:214:0s) -
Observe
.../gitlab-rails/production.logcontainsFilter chain halted as :verify_dependency_proxy_enabled! rendered or redirected
What is the current bug behavior?
Build fails due to dependency proxy returning HTTP 404
What is the expected correct behavior?
Building under myuser/testrepo should succeed just like building under mygroup/testrepo
Relevant logs and/or screenshots
A relevant snippet from gitlab-rails/production.log
Started HEAD "/v2/myuser/dependency_proxy/containers/alpine/manifests/latest" for 192.168.200.247 at 2021-10-05 13:09:37 +0000
Processing by Groups::DependencyProxyForContainersController#manifest as JSON
Parameters: {"group_id"=>"myuser", "image"=>"alpine", "tag"=>"latest"}
Filter chain halted as :verify_dependency_proxy_enabled! rendered or redirected
Completed 404 Not Found in 8ms (ActiveRecord: 1.6ms | Elasticsearch: 0.0ms | Allocations: 3889)
Started GET "/v2/myuser/dependency_proxy/containers/alpine/manifests/latest" for 192.168.200.247 at 2021-10-05 13:09:37 +0000
Processing by Groups::DependencyProxyForContainersController#manifest as JSON
Parameters: {"group_id"=>"myuser", "image"=>"alpine", "tag"=>"latest"}
Filter chain halted as :verify_dependency_proxy_enabled! rendered or redirected
Completed 404 Not Found in 10ms (ActiveRecord: 2.7ms | Elasticsearch: 0.0ms | Allocations: 4339)
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Current User: git Using RVM: no Ruby Version: 2.7.4p191 Gem Version: 3.1.4 Bundler Version:2.1.4 Rake Version: 13.0.6 Redis Version: 6.0.14 Git Version: 2.33.0. Sidekiq Version:5.2.9 Go Version: unknown GitLab information Version: 14.3.0 Revision: ceec8accb09 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.7 URL: https://gitlab.example.com HTTP Clone URL: https://gitlab.example.com/some-group/some-project.git SSH Clone URL: git@gitlab.example.com:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2 GitLab Shell Version: 13.21.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.21.0 ? ... OK (13.21.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes 4/2 ... yes 3/3 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.4) Git version >= 2.31.0 ? ... yes (2.33.0) Git user has default SSH configuration? ... yes Active users: ... 2 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished