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)
Loading
Loading
@@ -6,6 +6,7 @@ require 'json'
class GitlabAccess
class AccessDeniedError < StandardError; end
class MemoryLimitReachedError < StandardError; end
include NamesHelper
Loading
Loading
@@ -24,6 +25,7 @@ class GitlabAccess
status = api.check_access('git-receive-pack', @repo_name, @actor, @changes, @protocol)
raise AccessDeniedError, status.message unless status.allowed?
raise MemoryLimitReachedError, status.memory_message if status.memory_limit?
true
rescue GitlabNet::ApiUnreachableError
Loading
Loading
@@ -32,6 +34,9 @@ class GitlabAccess
rescue AccessDeniedError => ex
$stderr.puts "GitLab: #{ex.message}"
false
rescue MemoryLimitReachedError => ex
$stderr.puts "Gitlab: Project has reached the memory limit by: #{ex.message}MB please free some memory in Gitlab's UI to be able to push."
false
end
protected
Loading
Loading
require 'json'
class GitAccessStatus
attr_reader :message, :repository_path
attr_reader :message, :repository_path, :memory_status, :memory_message
def initialize(status, message, repository_path)
def initialize(status, message, repository_path, memory = nil)
@status = status
@message = message
@repository_path = repository_path
if memory
@memory_status = memory["status"]
@memory_message = memory["message"]
end
end
def self.create_from_json(json)
values = JSON.parse(json)
self.new(values["status"], values["message"], values["repository_path"])
self.new(values["status"], values["message"],
values["repository_path"], values["memory"])
end
def allowed?
@status
end
def memory_limit?
@memory_status
end
end