Class: Gitlab::QA::Component::Staging::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/component/staging.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address) ⇒ Version

Returns a new instance of Version.



60
61
62
63
64
# File 'lib/gitlab/qa/component/staging.rb', line 60

def initialize(address)
  @uri = URI.join(address, '/api/v4/version')

  Runtime::Env.require_qa_access_token!
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



58
59
60
# File 'lib/gitlab/qa/component/staging.rb', line 58

def uri
  @uri
end

Instance Method Details

#major_minor_revisionObject



70
71
72
73
74
75
76
# File 'lib/gitlab/qa/component/staging.rb', line 70

def major_minor_revision
  api_response = api_get!
  version_regexp = /^v?(?<major>\d+)\.(?<minor>\d+)\.\d+/
  match = version_regexp.match(api_response.fetch('version'))

  "#{match[:major]}.#{match[:minor]}-#{api_response.fetch('revision')}"
end

#tag_endObject



66
67
68
# File 'lib/gitlab/qa/component/staging.rb', line 66

def tag_end
  official? ? version : revision
end