summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/build/credentials/registry/gitlab_registry.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/build/credentials/registry/gitlab_registry.rb')
-rw-r--r--lib/gitlab/ci/build/credentials/registry/gitlab_registry.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/gitlab/ci/build/credentials/registry/gitlab_registry.rb b/lib/gitlab/ci/build/credentials/registry/gitlab_registry.rb
new file mode 100644
index 00000000000..5bd30e677e9
--- /dev/null
+++ b/lib/gitlab/ci/build/credentials/registry/gitlab_registry.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Build
+ module Credentials
+ module Registry
+ class GitlabRegistry < Credentials::Base
+ attr_reader :username, :password
+
+ def initialize(build)
+ @username = Gitlab::Auth::CI_JOB_USER
+ @password = build.token
+ end
+
+ def url
+ Gitlab.config.registry.host_port
+ end
+
+ def valid?
+ Gitlab.config.registry.enabled
+ end
+
+ def type
+ 'registry'
+ end
+ end
+ end
+ end
+ end
+ end
+end