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.



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

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.



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

def uri
  @uri
end

Instance Method Details

#major_minor_revisionObject



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

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



68
69
70
# File 'lib/gitlab/qa/component/staging.rb', line 68

def tag_end
  official? ? version : revision
end