As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • idrozdov/gitlab-shell
  • mmj/gitlab-shell
2 results
Show changes
Commits on Source (1)
require 'json' require 'json'
class GitAccessStatus class GitAccessStatus
attr_reader :message, :repository_path attr_reader :message, :repository_path, :gitaly_address
def initialize(status, message, repository_path) def initialize(status, message, repository_path, gitaly_address = nil)
@status = status @status = status
@message = message @message = message
@repository_path = repository_path @repository_path = repository_path
@gitaly_address = gitaly_address
end end
def self.create_from_json(json) def self.create_from_json(json)
values = JSON.parse(json) values = JSON.parse(json)
self.new(values["status"], values["message"], values["repository_path"]) self.new(values["status"], values["message"], values["repository_path"], values["gitaly_address"])
end end
def allowed? def allowed?
Loading
Loading
Loading
@@ -13,7 +13,7 @@ class GitlabShell
Loading
@@ -13,7 +13,7 @@ class GitlabShell
API_COMMANDS = %w(2fa_recovery_codes) API_COMMANDS = %w(2fa_recovery_codes)
GL_PROTOCOL = 'ssh'.freeze GL_PROTOCOL = 'ssh'.freeze
attr_accessor :key_id, :repo_name, :command, :git_access attr_accessor :key_id, :repo_name, :command, :git_access, :gitaly_address
attr_reader :repo_path attr_reader :repo_path
def initialize(key_id) def initialize(key_id)
Loading
@@ -98,6 +98,7 @@ class GitlabShell
Loading
@@ -98,6 +98,7 @@ class GitlabShell
raise AccessDeniedError, status.message unless status.allowed? raise AccessDeniedError, status.message unless status.allowed?
self.repo_path = status.repository_path self.repo_path = status.repository_path
self.gitaly_address = status.gitaly_address
end end
def process_cmd(args) def process_cmd(args)
Loading
@@ -126,9 +127,14 @@ class GitlabShell
Loading
@@ -126,9 +127,14 @@ class GitlabShell
$logger.info "gitlab-shell: Processing LFS authentication for #{log_username}." $logger.info "gitlab-shell: Processing LFS authentication for #{log_username}."
lfs_authenticate lfs_authenticate
end end
else end
if gitaly_address.nil?
$logger.info "gitlab-shell: executing git command <#{@command} #{repo_path}> for #{log_username}." $logger.info "gitlab-shell: executing git command <#{@command} #{repo_path}> for #{log_username}."
exec_cmd(@command, repo_path) exec_cmd(@command, repo_path)
else
$logger.info "gitlab-shell: processing with gitaly <#{gitaly_address}> command: <#{@command}> repo: <#{repo_path}> for <#{log_username}>."
process_cmd_with_gitaly(@command, repo_path)
end end
end end
Loading
@@ -165,6 +171,10 @@ class GitlabShell
Loading
@@ -165,6 +171,10 @@ class GitlabShell
Kernel::exec(env, *args, unsetenv_others: true) Kernel::exec(env, *args, unsetenv_others: true)
end end
def process_cmd_with_gitaly(cmd, repo_path)
# To be implemented
end
def api def api
GitlabNet.new GitlabNet.new
end end
Loading
Loading