gitlab-qa 4.2.1 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +11 -0
- data/gitlab-qa.gemspec +1 -0
- data/lib/gitlab/qa/component/internet_tunnel.rb +2 -2
- data/lib/gitlab/qa/component/staging.rb +125 -39
- data/lib/gitlab/qa/runtime/env.rb +10 -0
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b28724b26e74b052e4d47355d5b3c1436caafc8ede501d897435f2775df3a3e
|
4
|
+
data.tar.gz: e3309b6a55190d743cb35577345987802d5b239bdede3e2fc17b2bb9f5685465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 270b33c36d00ddc23b14abd5a3b9f0f58b00782bcfd0f39afb530194a52a37335cd98eb1756d358a2fdd4420abd25fc423a98f2e57c5fe9e39e24e3b9c40c5da
|
7
|
+
data.tar.gz: 5723399e6aeb0980f050d05ce640616224f4e66b5f4c50311e21440e5430dff840751aba88ecf2276cfd60b5276c6029f0079182a0e7db37ca4d776ff8097dcb
|
data/.gitlab-ci.yml
CHANGED
@@ -522,3 +522,14 @@ notify_upstream_commit:failure:
|
|
522
522
|
script:
|
523
523
|
- bin/notify_upstream_commit failure
|
524
524
|
when: on_failure
|
525
|
+
|
526
|
+
# This job requires the `GITLAB_QA_ACCESS_TOKEN` and `GITLAB_QA_DEV_ACCESS_TOKEN`
|
527
|
+
# variable to be passed when triggered.
|
528
|
+
staging:
|
529
|
+
script:
|
530
|
+
- unset EE_LICENSE
|
531
|
+
- exe/gitlab-qa Test::Instance::Staging
|
532
|
+
<<: *test
|
533
|
+
<<: *high-capacity
|
534
|
+
<<: *only-qa
|
535
|
+
when: manual
|
data/gitlab-qa.gemspec
CHANGED
@@ -6,8 +6,8 @@ module Gitlab
|
|
6
6
|
class InternetTunnel
|
7
7
|
include Scenario::Actable
|
8
8
|
|
9
|
-
DOCKER_IMAGE = '
|
10
|
-
DOCKER_IMAGE_TAG = '
|
9
|
+
DOCKER_IMAGE = 'gitlab/ssh-tunnel'.freeze
|
10
|
+
DOCKER_IMAGE_TAG = '1.0.0'.freeze
|
11
11
|
|
12
12
|
attr_writer :gitlab_hostname, :name
|
13
13
|
attr_accessor :network
|
@@ -7,21 +7,18 @@ module Gitlab
|
|
7
7
|
module Component
|
8
8
|
class Staging
|
9
9
|
ADDRESS = 'https://staging.gitlab.com'.freeze
|
10
|
-
def self.release
|
11
|
-
# Auto-deploy builds have a tag formatted like 12.0.12345+5159f2949cb.59c9fa631
|
12
|
-
# but the version api returns a semver version like 12.0.1
|
13
|
-
# so images are tagged using minor and major semver components plus
|
14
|
-
# the EE commit ref, which is the 'revision' returned by the API
|
15
|
-
# and so the version used for the docker image tag is like 12.0-5159f2949cb
|
16
|
-
# See: https://gitlab.com/gitlab-org/quality/staging/issues/56
|
17
|
-
version = Version.new(address).major_minor_revision
|
18
|
-
image =
|
19
|
-
if Runtime::Env.dev_access_token_variable
|
20
|
-
"dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ee:#{version}"
|
21
|
-
else
|
22
|
-
"ee:#{version}"
|
23
|
-
end
|
24
10
|
|
11
|
+
class InvalidResponseError < StandardError
|
12
|
+
attr_reader :response
|
13
|
+
|
14
|
+
def initialize(address, response)
|
15
|
+
@response = response
|
16
|
+
|
17
|
+
super "Invalid response received from #{address}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.release
|
25
22
|
Release.new(image)
|
26
23
|
rescue InvalidResponseError => ex
|
27
24
|
warn ex.message
|
@@ -29,41 +26,55 @@ module Gitlab
|
|
29
26
|
exit 1
|
30
27
|
end
|
31
28
|
|
29
|
+
def self.image
|
30
|
+
if Runtime::Env.dev_access_token_variable
|
31
|
+
# Auto-deploy builds have a tag formatted like 12.1.12345+5159f2949cb.59c9fa631
|
32
|
+
# where `5159f2949cb` is the EE commit SHA. QA images are tagged using
|
33
|
+
# the version from the VERSION file and this commit SHA, e.g.
|
34
|
+
# `12.0-5159f2949cb` (note that the `major.minor` doesn't necessarily match).
|
35
|
+
# To work around that, we're fetching the `revision` from the version API
|
36
|
+
# and then find the corresponding QA image in the
|
37
|
+
# `dev.gitlab.org:5005/gitlab/omnibus-gitlab/gitlab-ee-qa` container
|
38
|
+
# registry, based on this revision.
|
39
|
+
# See:
|
40
|
+
# - https://gitlab.com/gitlab-org/quality/staging/issues/56
|
41
|
+
# - https://gitlab.com/gitlab-org/release/framework/issues/421
|
42
|
+
# - https://gitlab.com/gitlab-org/gitlab-qa/issues/398
|
43
|
+
DevEEQAImage.new.retrieve_image_from_container_registry!(staging_revision)
|
44
|
+
else
|
45
|
+
# Auto-deploy builds have a tag formatted like 12.0.12345+5159f2949cb.59c9fa631
|
46
|
+
# but the version api returns a semver version like 12.0.1
|
47
|
+
# so images are tagged using minor and major semver components plus
|
48
|
+
# the EE commit ref, which is the 'revision' returned by the API
|
49
|
+
# and so the version used for the docker image tag is like 12.0-5159f2949cb
|
50
|
+
# See: https://gitlab.com/gitlab-org/quality/staging/issues/56
|
51
|
+
"ee:#{Version.new(address).major_minor_revision}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
32
55
|
def self.address
|
33
56
|
self::ADDRESS
|
34
57
|
end
|
35
58
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
def initialize(address, response)
|
40
|
-
@response = response
|
41
|
-
|
42
|
-
super "Invalid response received from #{address}"
|
43
|
-
end
|
59
|
+
def self.staging_revision
|
60
|
+
@staging_revision ||= Version.new(address).revision
|
44
61
|
end
|
45
62
|
|
46
63
|
class Version
|
64
|
+
attr_reader :uri
|
65
|
+
|
47
66
|
def initialize(address)
|
48
67
|
@uri = URI.join(address, '/api/v4/version')
|
49
|
-
end
|
50
68
|
|
51
|
-
|
52
|
-
|
53
|
-
Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|
|
54
|
-
http.request(request)
|
55
|
-
end
|
69
|
+
Runtime::Env.require_qa_access_token!
|
70
|
+
end
|
56
71
|
|
57
|
-
|
58
|
-
|
59
|
-
JSON.parse(response.body)
|
60
|
-
else
|
61
|
-
raise InvalidResponseError.new(@uri.to_s, response)
|
62
|
-
end
|
72
|
+
def revision
|
73
|
+
api_get!.fetch('revision')
|
63
74
|
end
|
64
75
|
|
65
76
|
def major_minor_revision
|
66
|
-
api_response =
|
77
|
+
api_response = api_get!
|
67
78
|
version_regexp = /^v?(?<major>\d+)\.(?<minor>\d+)\.\d+/
|
68
79
|
match = version_regexp.match(api_response.fetch('version'))
|
69
80
|
|
@@ -72,11 +83,86 @@ module Gitlab
|
|
72
83
|
|
73
84
|
private
|
74
85
|
|
75
|
-
def
|
76
|
-
|
86
|
+
def api_get!
|
87
|
+
@response_body ||=
|
88
|
+
begin
|
89
|
+
response = GetRequest.new(uri, Runtime::Env.qa_access_token).execute!
|
90
|
+
JSON.parse(response.body)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class DevEEQAImage
|
96
|
+
attr_reader :base_url
|
97
|
+
|
98
|
+
DEV_ADDRESS = 'https://dev.gitlab.org'.freeze
|
99
|
+
GITLAB_EE_QA_REPOSITORY_ID = 55
|
100
|
+
QAImageNotFoundError = Class.new(StandardError)
|
101
|
+
|
102
|
+
def initialize
|
103
|
+
@base_url = "#{DEV_ADDRESS}/api/v4/projects/gitlab%2Fomnibus-gitlab/registry/repositories/#{GITLAB_EE_QA_REPOSITORY_ID}/tags?per_page=100"
|
104
|
+
|
105
|
+
Runtime::Env.require_qa_dev_access_token!
|
106
|
+
end
|
107
|
+
|
108
|
+
def retrieve_image_from_container_registry!(revision)
|
109
|
+
request_url = base_url
|
110
|
+
|
111
|
+
begin
|
112
|
+
response = api_get!(URI.parse(request_url))
|
113
|
+
tags = JSON.parse(response.body)
|
114
|
+
|
115
|
+
matching_qa_image_tag = find_matching_qa_image_tag(tags, revision)
|
116
|
+
return matching_qa_image_tag['location'] if matching_qa_image_tag
|
117
|
+
|
118
|
+
request_url = next_page_url_from_response(response)
|
119
|
+
end while request_url
|
120
|
+
|
121
|
+
raise QAImageNotFoundError, "No `gitlab-ee-qa` image could be found for the revision `#{revision}`."
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def api_get!(uri)
|
127
|
+
GetRequest.new(uri, Runtime::Env.qa_dev_access_token).execute!
|
128
|
+
end
|
129
|
+
|
130
|
+
def next_page_url_from_response(response)
|
131
|
+
response['x-next-page'].to_s != '' ? "#{base_url}&page=#{response['x-next-page']}" : nil
|
132
|
+
end
|
133
|
+
|
134
|
+
def find_matching_qa_image_tag(tags, revision)
|
135
|
+
tags.find { |tag| tag['name'].end_with?(revision) }
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class GetRequest
|
140
|
+
attr_reader :uri, :token
|
141
|
+
|
142
|
+
def initialize(uri, token)
|
143
|
+
@uri = uri
|
144
|
+
@token = token
|
145
|
+
end
|
146
|
+
|
147
|
+
def execute!
|
148
|
+
response =
|
149
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
150
|
+
http.request(build_request)
|
151
|
+
end
|
152
|
+
|
153
|
+
case response
|
154
|
+
when Net::HTTPSuccess
|
155
|
+
response
|
156
|
+
else
|
157
|
+
raise InvalidResponseError.new(uri.to_s, response)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
private
|
77
162
|
|
78
|
-
|
79
|
-
|
163
|
+
def build_request
|
164
|
+
Net::HTTP::Get.new(uri).tap do |req|
|
165
|
+
req['PRIVATE-TOKEN'] = token
|
80
166
|
end
|
81
167
|
end
|
82
168
|
end
|
@@ -74,6 +74,10 @@ module Gitlab
|
|
74
74
|
env_value_if_defined('GITLAB_QA_DEV_ACCESS_TOKEN')
|
75
75
|
end
|
76
76
|
|
77
|
+
def qa_dev_access_token
|
78
|
+
ENV['GITLAB_QA_DEV_ACCESS_TOKEN']
|
79
|
+
end
|
80
|
+
|
77
81
|
def host_artifacts_dir
|
78
82
|
@host_artifacts_dir ||= File.join(ENV['QA_ARTIFACTS_DIR'] || '/tmp/gitlab-qa', Runtime::Env.run_id)
|
79
83
|
end
|
@@ -109,6 +113,12 @@ module Gitlab
|
|
109
113
|
raise ArgumentError, "Please provide GITLAB_QA_ACCESS_TOKEN"
|
110
114
|
end
|
111
115
|
|
116
|
+
def require_qa_dev_access_token!
|
117
|
+
return unless ENV['GITLAB_QA_DEV_ACCESS_TOKEN'].to_s.strip.empty?
|
118
|
+
|
119
|
+
raise ArgumentError, "Please provide GITLAB_QA_DEV_ACCESS_TOKEN"
|
120
|
+
end
|
121
|
+
|
112
122
|
def require_oauth_environment!
|
113
123
|
%w[GITHUB_OAUTH_APP_ID GITHUB_OAUTH_APP_SECRET GITHUB_USERNAME GITHUB_PASSWORD].each do |env_key|
|
114
124
|
raise ArgumentError, "Environment variable #{env_key} must be set to run OAuth specs" unless ENV.key?(env_key)
|
data/lib/gitlab/qa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Bizon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 1.20.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.7.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.7.0
|
111
125
|
description:
|
112
126
|
email:
|
113
127
|
- grzesiek.bizon@gmail.com
|