gitlab-qa 8.1.0 → 8.3.1
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/jobs/metrics.gitlab-ci.yml +41 -0
- data/.gitlab-ci.yml +1 -0
- data/Gemfile.lock +1 -1
- data/docs/what_tests_can_be_run.md +1 -0
- data/lib/gitlab/qa/component/base.rb +6 -1
- data/lib/gitlab/qa/component/gitlab.rb +11 -6
- data/lib/gitlab/qa/docker/command.rb +4 -0
- data/lib/gitlab/qa/docker/engine.rb +2 -10
- data/lib/gitlab/qa/runtime/env.rb +0 -1
- data/lib/gitlab/qa/scenario/test/integration/metrics.rb +43 -0
- data/lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb +115 -0
- data/lib/gitlab/qa/support/gitlab_upgrade_path.rb +94 -0
- data/lib/gitlab/qa/support/gitlab_version_info.rb +180 -0
- data/lib/gitlab/qa/version.rb +1 -1
- data/scripts/generate-qa-jobs.rb +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de73ba2a256efc0b8a025d1b46c0299fe8f9906b2a1cb06672a11a04702be170
|
4
|
+
data.tar.gz: e11f0ebabe74afe58b2c5b3621c1114d106aa3c8f828a64a506673b91604b77a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa235104c7be55f5b0276133e4a04231939b5dcceaed4e1e454a84ac17539b15c15a9ac09182c9a1ecf3e199105f5b3556fd26d2120370a43e5cfc1777550617
|
7
|
+
data.tar.gz: ccab7c480393683821ffff87aeee541474dcb126ab7a6d77dd24d890eec90a2c2924a178cb2d6dbec46898fdc9ad5f21a328190eb27389e4d6969140e00f481c
|
@@ -0,0 +1,41 @@
|
|
1
|
+
ce:metrics:
|
2
|
+
extends:
|
3
|
+
- .rules:ce-never-when-triggered-by-feature-flag-definition-change
|
4
|
+
- .test
|
5
|
+
- .high-capacity
|
6
|
+
- .ce-variables
|
7
|
+
- .rspec-report-opts
|
8
|
+
variables:
|
9
|
+
QA_SCENARIO: "Test::Integration::Metrics"
|
10
|
+
|
11
|
+
ce:metrics-quarantine:
|
12
|
+
extends:
|
13
|
+
- .rules:ce-never-when-triggered-by-feature-flag-definition-change
|
14
|
+
- .test
|
15
|
+
- .high-capacity
|
16
|
+
- .ce-variables
|
17
|
+
- .quarantine
|
18
|
+
- .rspec-report-opts
|
19
|
+
variables:
|
20
|
+
QA_SCENARIO: "Test::Integration::Metrics"
|
21
|
+
|
22
|
+
ee:metrics:
|
23
|
+
extends:
|
24
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
25
|
+
- .test
|
26
|
+
- .high-capacity
|
27
|
+
- .ee-variables
|
28
|
+
- .rspec-report-opts
|
29
|
+
variables:
|
30
|
+
QA_SCENARIO: "Test::Integration::Metrics"
|
31
|
+
|
32
|
+
ee:metrics-quarantine:
|
33
|
+
extends:
|
34
|
+
- .rules:ee-never-when-triggered-by-feature-flag-definition-change
|
35
|
+
- .test
|
36
|
+
- .high-capacity
|
37
|
+
- .ee-variables
|
38
|
+
- .quarantine
|
39
|
+
- .rspec-report-opts
|
40
|
+
variables:
|
41
|
+
QA_SCENARIO: "Test::Integration::Metrics"
|
data/.gitlab-ci.yml
CHANGED
@@ -105,6 +105,7 @@ generate-jobs:
|
|
105
105
|
- bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag can_use_large_setup
|
106
106
|
- bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag cloud_activation
|
107
107
|
- bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag object_storage
|
108
|
+
- bundle exec bin/qa Test::Instance::All http://dummy.test --count-examples-only -- $QA_TESTS --tag metrics
|
108
109
|
- cp -r no_of_examples $CI_PROJECT_DIR
|
109
110
|
|
110
111
|
# TOP_UPSTREAM_DEFAULT_BRANCH is the default branch name of the original project that triggered a pipeline in this project.
|
data/Gemfile.lock
CHANGED
@@ -84,6 +84,7 @@ All environment variables used by GitLab QA should be defined in [`lib/gitlab/qa
|
|
84
84
|
| `QA_INFLUXDB_TOKEN` |- | Influxdb token for test metrics reporting | No|
|
85
85
|
| `QA_RUN_TYPE` |- | QA run type like `staging-full`, `canary`, `production` etc. Used in test metrics reporting | No|
|
86
86
|
| `QA_VALIDATE_RESOURCE_REUSE` | `false` | Set to `true` to [validate resource reuse](https://docs.gitlab.com/ee/development/testing_guide/end_to_end/resources.html#reusable-resources) after a test suite | No |
|
87
|
+
| `QA_USE_PUBLIC_IP_API` | `false` | When performing Instance tests against a remote/pre-existing instance, use an API to detect the public API for requests coming from gitlab-qa. Used by tests that exercise IP-address restrictions and similar
|
87
88
|
| `GITHUB_USERNAME` |- | Username for authenticating with GitHub. | No|
|
88
89
|
| `GITHUB_PASSWORD` |- | Password for authenticating with GitHub. | No|
|
89
90
|
| `GITLAB_QA_LOOP_RUNNER_MINUTES` | `1` | Minutes to run and repeat a spec while using the '--loop' option; default value is 1 minute. | No|
|
@@ -7,13 +7,14 @@ module Gitlab
|
|
7
7
|
include Scenario::Actable
|
8
8
|
|
9
9
|
attr_reader :docker
|
10
|
-
attr_accessor :volumes, :network, :environment, :runner_network
|
10
|
+
attr_accessor :volumes, :ports, :network, :environment, :runner_network
|
11
11
|
attr_writer :name, :exec_commands
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
@docker = Docker::Engine.new
|
15
15
|
@environment = {}
|
16
16
|
@volumes = {}
|
17
|
+
@ports = []
|
17
18
|
@network_aliases = []
|
18
19
|
@exec_commands = []
|
19
20
|
end
|
@@ -85,6 +86,10 @@ module Gitlab
|
|
85
86
|
command << "--net #{network}"
|
86
87
|
command << "--hostname #{hostname}"
|
87
88
|
|
89
|
+
@ports.each do |mapping|
|
90
|
+
command.port(mapping)
|
91
|
+
end
|
92
|
+
|
88
93
|
@volumes.to_h.each do |to, from|
|
89
94
|
command.volume(to, from, 'Z')
|
90
95
|
end
|
@@ -17,7 +17,7 @@ module Gitlab
|
|
17
17
|
using Rainbow
|
18
18
|
|
19
19
|
attr_reader :release, :omnibus_configuration, :omnibus_gitlab_rails_env
|
20
|
-
attr_accessor :tls, :skip_availability_check, :runner_network, :seed_admin_token, :seed_db
|
20
|
+
attr_accessor :tls, :skip_availability_check, :runner_network, :seed_admin_token, :seed_db, :skip_server_hooks
|
21
21
|
attr_writer :name, :relative_path
|
22
22
|
|
23
23
|
def_delegators :release, :tag, :image, :edition
|
@@ -47,6 +47,7 @@ module Gitlab
|
|
47
47
|
|
48
48
|
@seed_admin_token = Runtime::Scenario.seed_admin_token
|
49
49
|
@seed_db = Runtime::Scenario.seed_db
|
50
|
+
@skip_server_hooks = Runtime::Scenario.skip_server_hooks
|
50
51
|
|
51
52
|
self.release = 'CE'
|
52
53
|
end
|
@@ -84,8 +85,8 @@ module Gitlab
|
|
84
85
|
tls ? 'https' : 'http'
|
85
86
|
end
|
86
87
|
|
87
|
-
def
|
88
|
-
tls ?
|
88
|
+
def gitlab_port
|
89
|
+
tls ? ["443:443"] : ["80"]
|
89
90
|
end
|
90
91
|
|
91
92
|
def gitaly_tls
|
@@ -136,11 +137,15 @@ module Gitlab
|
|
136
137
|
ensure_configured!
|
137
138
|
|
138
139
|
docker.run(image: image, tag: tag) do |command|
|
139
|
-
command << "-d
|
140
|
+
command << "-d"
|
140
141
|
command << "--name #{name}"
|
141
142
|
command << "--net #{network}"
|
142
143
|
command << "--hostname #{hostname}"
|
143
144
|
|
145
|
+
[*@ports, *gitlab_port].each do |mapping|
|
146
|
+
command.port(mapping)
|
147
|
+
end
|
148
|
+
|
144
149
|
@volumes.to_h.each do |to, from|
|
145
150
|
command.volume(to, from, 'Z')
|
146
151
|
end
|
@@ -179,7 +184,7 @@ module Gitlab
|
|
179
184
|
name,
|
180
185
|
relative_path: relative_path,
|
181
186
|
scheme: scheme,
|
182
|
-
protocol_port:
|
187
|
+
protocol_port: gitlab_port.first.to_i
|
183
188
|
)
|
184
189
|
|
185
190
|
Runtime::Logger.info("Waiting for GitLab to become healthy ...")
|
@@ -197,7 +202,7 @@ module Gitlab
|
|
197
202
|
exec_commands << seed_admin_token_command if seed_admin_token
|
198
203
|
exec_commands << seed_test_data_command if seed_db
|
199
204
|
exec_commands << Runtime::Scenario.omnibus_exec_commands
|
200
|
-
exec_commands << add_git_server_hooks unless
|
205
|
+
exec_commands << add_git_server_hooks unless skip_server_hooks
|
201
206
|
|
202
207
|
commands = exec_commands.flatten.uniq
|
203
208
|
return if commands.empty?
|
@@ -119,19 +119,11 @@ module Gitlab
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def container_exists?(name)
|
122
|
-
Docker::Command.execute("container
|
123
|
-
rescue Docker::Shellout::StatusError
|
124
|
-
false
|
125
|
-
else
|
126
|
-
true
|
122
|
+
!Docker::Command.execute("container list --all --format '{{.Names}}' --filter name=^#{name}$").empty?
|
127
123
|
end
|
128
124
|
|
129
125
|
def network_exists?(name)
|
130
|
-
Docker::Command.execute("network
|
131
|
-
rescue Docker::Shellout::StatusError
|
132
|
-
false
|
133
|
-
else
|
134
|
-
true
|
126
|
+
!Docker::Command.execute("network list --format '{{.Name}}' --filter name=^#{name}$").empty?
|
135
127
|
end
|
136
128
|
|
137
129
|
def network_create(name)
|
@@ -36,7 +36,6 @@ module Gitlab
|
|
36
36
|
'QA_SLOW_CONNECTION_LATENCY_MS' => :qa_slow_connection_latency_ms,
|
37
37
|
'QA_SLOW_CONNECTION_THROUGHPUT_KBPS' => :qa_slow_connection_throughput_kbps,
|
38
38
|
'QA_GENERATE_ALLURE_REPORT' => :generate_allure_report,
|
39
|
-
'QA_EE_ACTIVATION_CODE' => :ee_activation_code,
|
40
39
|
'QA_EXPORT_TEST_METRICS' => :qa_export_test_metrics,
|
41
40
|
'QA_INFLUXDB_URL' => :qa_influxdb_url,
|
42
41
|
'QA_INFLUXDB_TOKEN' => :qa_influxdb_token,
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
class Metrics < Scenario::Template
|
9
|
+
PUMA_METRICS_SERVER_PORT = 8083
|
10
|
+
SIDEKIQ_METRICS_SERVER_PORT = 8082
|
11
|
+
|
12
|
+
def perform(release, *rspec_args)
|
13
|
+
Component::Gitlab.perform do |gitlab|
|
14
|
+
gitlab.release = release
|
15
|
+
gitlab.network = 'test'
|
16
|
+
gitlab.name = 'gitlab'
|
17
|
+
gitlab.ports = [PUMA_METRICS_SERVER_PORT, SIDEKIQ_METRICS_SERVER_PORT]
|
18
|
+
|
19
|
+
gitlab.omnibus_configuration << <<~RUBY
|
20
|
+
puma['exporter_enabled'] = true
|
21
|
+
puma['exporter_address'] = '0.0.0.0'
|
22
|
+
puma['exporter_port'] = #{PUMA_METRICS_SERVER_PORT}
|
23
|
+
sidekiq['metrics_enabled'] = true
|
24
|
+
sidekiq['listen_address'] = '0.0.0.0'
|
25
|
+
sidekiq['listen_port'] = #{SIDEKIQ_METRICS_SERVER_PORT}
|
26
|
+
RUBY
|
27
|
+
|
28
|
+
gitlab.instance do
|
29
|
+
Component::Specs.perform do |specs|
|
30
|
+
specs.suite = 'Test::Integration::Metrics'
|
31
|
+
specs.release = gitlab.release
|
32
|
+
specs.network = gitlab.network
|
33
|
+
specs.args = [gitlab.address, *rspec_args]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Omnibus
|
8
|
+
class UpdateFromPrevious < Scenario::Template
|
9
|
+
using Rainbow
|
10
|
+
|
11
|
+
# Test update from N - 1 (major|minor|patch) version to current release
|
12
|
+
# Run smoke test suite on previous release to populate some data in database before update
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# perform(gitlab-ee:dev-tag, 15.3.0-pre, major)
|
16
|
+
# => will perform upgrades 14.9.5 -> 15.0.5 -> gitlab-ee:dev-tag
|
17
|
+
#
|
18
|
+
# @param [String] release current release docker image
|
19
|
+
# @param [String] current_version current gitlab version associated with docker image
|
20
|
+
# @param [String] semver_component semver component for N - 1 version detection, major|minor|patch
|
21
|
+
# @param [Array] *rspec_args rspec arguments
|
22
|
+
# @return [void]
|
23
|
+
def perform(release, current_version, semver_component, *rspec_args)
|
24
|
+
@current_release = QA::Release.new(release)
|
25
|
+
@upgrade_path = Support::GitlabUpgradePath.new(
|
26
|
+
current_version,
|
27
|
+
semver_component,
|
28
|
+
@current_release.edition
|
29
|
+
).fetch
|
30
|
+
|
31
|
+
upgrade_info = "#{[*upgrade_path, current_release].join(' => ')} (#{current_version})".bright
|
32
|
+
Runtime::Logger.info("Performing gitlab update: #{upgrade_info}")
|
33
|
+
|
34
|
+
update(rspec_args)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
attr_reader :current_release, :upgrade_path
|
40
|
+
|
41
|
+
# Perform update
|
42
|
+
#
|
43
|
+
# @param [Array] rspec_args
|
44
|
+
# @return [void]
|
45
|
+
def update(rspec_args)
|
46
|
+
Docker::Volumes.new.with_temporary_volumes do |volumes|
|
47
|
+
# deploy first release in upgrade path and run specs to populate db
|
48
|
+
run_gitlab(upgrade_path.first, volumes, ["--", "--tag", "smoke"])
|
49
|
+
|
50
|
+
# deploy releases in upgrade path
|
51
|
+
upgrade_path[1..].each { |release| run_gitlab(release, volumes, skip_setup: true) }
|
52
|
+
|
53
|
+
# deploy current release and run tests
|
54
|
+
run_gitlab(current_release, volumes, rspec_args, skip_setup: true)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Deploy gitlab instance and optionally run specs
|
59
|
+
#
|
60
|
+
# @param [Gitlab::QA::Release] release
|
61
|
+
# @param [Hash] volumes
|
62
|
+
# @return [void]
|
63
|
+
def run_gitlab(release, volumes, rspec_args = [], skip_setup: false)
|
64
|
+
Runtime::Logger.info("Deploying release: #{release.to_s.bright}")
|
65
|
+
|
66
|
+
Component::Gitlab.perform do |gitlab|
|
67
|
+
gitlab.release = release
|
68
|
+
gitlab.volumes = volumes
|
69
|
+
gitlab.network = 'test'
|
70
|
+
|
71
|
+
if skip_setup
|
72
|
+
gitlab.skip_server_hooks = true
|
73
|
+
gitlab.seed_db = false
|
74
|
+
gitlab.seed_admin_token = false
|
75
|
+
end
|
76
|
+
|
77
|
+
next gitlab.launch_and_teardown_instance unless run_specs?(release)
|
78
|
+
|
79
|
+
gitlab.instance { run_specs(gitlab, release, rspec_args) }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Run specs
|
84
|
+
#
|
85
|
+
# @param [Gitlab::QA::Component::Gitlab] gitlab
|
86
|
+
# @param [Gitlab::QA::Release] release
|
87
|
+
# @param [Array] rspec_args
|
88
|
+
# @return [void]
|
89
|
+
def run_specs(gitlab, release, rspec_args)
|
90
|
+
Component::Specs.perform do |specs|
|
91
|
+
specs.release = release
|
92
|
+
specs.suite = 'Test::Instance::All'
|
93
|
+
specs.hostname = "qa-e2e-specs.#{gitlab.network}"
|
94
|
+
specs.network = gitlab.network
|
95
|
+
specs.args = [gitlab.address, *rspec_args]
|
96
|
+
end
|
97
|
+
rescue Docker::Shellout::StatusError => e
|
98
|
+
raise e if release == current_release # only fail on current release
|
99
|
+
|
100
|
+
Runtime::Logger.warn("Test run for release '#{gitlab.release}' finished with errors!")
|
101
|
+
end
|
102
|
+
|
103
|
+
# Run specs on first release to populate database and release being tested
|
104
|
+
#
|
105
|
+
# @param [Gitlab::QA::Release] release
|
106
|
+
# @return [Boolean]
|
107
|
+
def run_specs?(release)
|
108
|
+
[upgrade_path.first, current_release].any? { |rel| rel == release }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/module/delegation"
|
4
|
+
require "yaml"
|
5
|
+
|
6
|
+
module Gitlab
|
7
|
+
module QA
|
8
|
+
module Support
|
9
|
+
class GitlabUpgradePath
|
10
|
+
# Get upgrade path between N - 1 and current version not including current release
|
11
|
+
#
|
12
|
+
# @param [String] current_version
|
13
|
+
# @param [String] semver_component version number component for previous version detection - major|minor|patch
|
14
|
+
# @param [String] edition GitLab edition - ee or ce
|
15
|
+
def initialize(current_version, semver_component, edition)
|
16
|
+
@version_info = GitlabVersionInfo.new(current_version, edition)
|
17
|
+
@current_version = Gem::Version.new(current_version)
|
18
|
+
@semver_component = semver_component
|
19
|
+
@edition = edition
|
20
|
+
@logger = Runtime::Logger.logger
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get upgrade path between releases
|
24
|
+
#
|
25
|
+
# Return array with only previous version for updates from previous minor, patch versions
|
26
|
+
#
|
27
|
+
# @return [Array<QA::Release>]
|
28
|
+
def fetch
|
29
|
+
return [release(latest_patch(previous_version))] unless major_upgrade?
|
30
|
+
|
31
|
+
# get versions between previous major and current version in gitlab upgrade path
|
32
|
+
path = full_upgrade_path.each_with_object([]) do |ver, arr|
|
33
|
+
next if ver <= previous_version || ver >= current_version
|
34
|
+
|
35
|
+
arr << ver
|
36
|
+
end
|
37
|
+
|
38
|
+
[previous_version, *path].map do |ver|
|
39
|
+
release(version_info.latest_patch(ver))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
delegate :latest_patch, to: :version_info
|
46
|
+
|
47
|
+
attr_reader :version_info, :current_version, :semver_component, :edition, :logger
|
48
|
+
|
49
|
+
# Upgrade from previous major
|
50
|
+
#
|
51
|
+
# @return [Boolean]
|
52
|
+
def major_upgrade?
|
53
|
+
semver_component == "major"
|
54
|
+
end
|
55
|
+
|
56
|
+
# Docker release image
|
57
|
+
#
|
58
|
+
# @param [String] version
|
59
|
+
# @return [QA::Release]
|
60
|
+
def release(version)
|
61
|
+
QA::Release.new("gitlab/gitlab-#{edition}:#{version}-#{edition}.0")
|
62
|
+
end
|
63
|
+
|
64
|
+
# Previous gitlab version
|
65
|
+
#
|
66
|
+
# @return [Gem::Version]
|
67
|
+
def previous_version
|
68
|
+
@previous_version ||= version_info.previous_version(semver_component)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Gitlab upgrade path
|
72
|
+
#
|
73
|
+
# @return [Array<Gem::Version>]
|
74
|
+
def full_upgrade_path
|
75
|
+
@full_upgrade_path ||= ::YAML
|
76
|
+
.safe_load(upgrade_path_yml, symbolize_names: true)
|
77
|
+
.map { |version| Gem::Version.new("#{version[:major]}.#{version[:minor]}") }
|
78
|
+
end
|
79
|
+
|
80
|
+
# Upgrade path yml
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
def upgrade_path_yml
|
84
|
+
@upgrade_path_yml ||= begin
|
85
|
+
logger.info("Fetching gitlab upgrade path from 'gitlab-com/support/toolbox/upgrade-path' project")
|
86
|
+
HttpRequest.make_http_request(
|
87
|
+
url: "https://gitlab.com/gitlab-com/support/toolbox/upgrade-path/-/raw/main/upgrade-path.yml"
|
88
|
+
).body
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Support
|
6
|
+
class GitlabVersionInfo
|
7
|
+
VERSION_PATTERN = /^(?<version>\d+\.\d+\.\d+)/.freeze
|
8
|
+
COMPONENT_PATTERN = /^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/.freeze
|
9
|
+
|
10
|
+
# Get previous gitlab version
|
11
|
+
#
|
12
|
+
# @param [String] current_version
|
13
|
+
# @param [String] edition GitLab edition - ee or ce
|
14
|
+
def initialize(current_version, edition)
|
15
|
+
@current_version = current_version
|
16
|
+
@edition = edition
|
17
|
+
@logger = Runtime::Logger.logger
|
18
|
+
end
|
19
|
+
|
20
|
+
# Get N - 1 version number
|
21
|
+
#
|
22
|
+
# @param [String] semver_component version number component for previous version detection - major|minor|patch
|
23
|
+
# @return [Gem::Version]
|
24
|
+
def previous_version(semver_component)
|
25
|
+
case semver_component
|
26
|
+
when "major"
|
27
|
+
previous_major
|
28
|
+
when "minor"
|
29
|
+
previous_minor
|
30
|
+
when "patch"
|
31
|
+
previous_patch
|
32
|
+
else
|
33
|
+
raise("Unsupported semver component, must be major|minor|patch")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Get latest patch for specific version number
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# latest_patch(Gem::Version.new("14.10")) => "14.10.5"
|
41
|
+
#
|
42
|
+
# @param [Gem::Version] version
|
43
|
+
# @return [String]
|
44
|
+
def latest_patch(version)
|
45
|
+
versions.find { |ver| ver.to_s.match?(/^#{version}/) }
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
attr_reader :current_version, :edition, :logger
|
51
|
+
|
52
|
+
# Current versions major version
|
53
|
+
#
|
54
|
+
# @return [Integer]
|
55
|
+
def current_major
|
56
|
+
@current_major ||= current_version.match(COMPONENT_PATTERN)[:major].to_i
|
57
|
+
end
|
58
|
+
|
59
|
+
# Current versions minor version
|
60
|
+
#
|
61
|
+
# @return [Integer]
|
62
|
+
def current_minor
|
63
|
+
@current_minor ||= current_version.match(COMPONENT_PATTERN)[:minor].to_i
|
64
|
+
end
|
65
|
+
|
66
|
+
# Current versions patch version
|
67
|
+
#
|
68
|
+
# @return [Integer]
|
69
|
+
def current_patch
|
70
|
+
@current_patch ||= current_version.match(COMPONENT_PATTERN)[:patch].to_i
|
71
|
+
end
|
72
|
+
|
73
|
+
# Previous major version
|
74
|
+
#
|
75
|
+
# @return [String]
|
76
|
+
def previous_major
|
77
|
+
return fallback_major unless tags
|
78
|
+
|
79
|
+
versions.find { |version| version.to_s.start_with?((current_major - 1).to_s) }
|
80
|
+
end
|
81
|
+
|
82
|
+
# Previous first major version image
|
83
|
+
#
|
84
|
+
# @return [String]
|
85
|
+
def fallback_major
|
86
|
+
previous_fallback_version(current_major - 1)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Previous minor version
|
90
|
+
#
|
91
|
+
# @return [String]
|
92
|
+
def previous_minor
|
93
|
+
return fallback_minor unless tags
|
94
|
+
return previous_major if current_minor.zero?
|
95
|
+
|
96
|
+
versions.find { |version| version.to_s.match?(/^#{current_major}\.#{current_minor - 1}/) }
|
97
|
+
end
|
98
|
+
|
99
|
+
# Previous first minor version
|
100
|
+
#
|
101
|
+
# @return [String]
|
102
|
+
def fallback_minor
|
103
|
+
return previous_fallback_version(current_major, current_minor - 1) unless current_minor.zero?
|
104
|
+
|
105
|
+
previous_major
|
106
|
+
end
|
107
|
+
|
108
|
+
# Previous patch version
|
109
|
+
#
|
110
|
+
# @return [String]
|
111
|
+
def previous_patch
|
112
|
+
return fallback_patch unless tags
|
113
|
+
return previous_minor if current_patch.zero?
|
114
|
+
|
115
|
+
versions.find { |version| version.to_s.match?(/^#{current_major}\.#{current_minor}\.#{current_patch - 1}/) }
|
116
|
+
end
|
117
|
+
|
118
|
+
# Previous first patch version
|
119
|
+
#
|
120
|
+
# @return [String]
|
121
|
+
def fallback_patch
|
122
|
+
return previous_fallback_version(current_major, current_minor, current_patch - 1) unless current_patch.zero?
|
123
|
+
|
124
|
+
previous_minor
|
125
|
+
end
|
126
|
+
|
127
|
+
# Version number from docker tag
|
128
|
+
#
|
129
|
+
# @param [String] tag
|
130
|
+
# @return [String]
|
131
|
+
def version(tag)
|
132
|
+
tag.match(VERSION_PATTERN)[:version]
|
133
|
+
end
|
134
|
+
|
135
|
+
# Fallback version
|
136
|
+
#
|
137
|
+
# @param [Integer] major_component
|
138
|
+
# @param [Integer] minor_component
|
139
|
+
# @param [Integer] patch_component
|
140
|
+
# @return [Gem::Version]
|
141
|
+
def previous_fallback_version(major_component, minor_component = 0, patch_component = 0)
|
142
|
+
Gem::Version.new("#{major_component}.#{minor_component}.#{patch_component}")
|
143
|
+
end
|
144
|
+
|
145
|
+
# All available gitlab versions
|
146
|
+
#
|
147
|
+
# @return [Array<String>]
|
148
|
+
def versions
|
149
|
+
@versions = tags
|
150
|
+
.map { |tag| Gem::Version.new(tag.match(VERSION_PATTERN)[:version]) }
|
151
|
+
.sort
|
152
|
+
.reverse # reverse array so first match by .find always returns latest version
|
153
|
+
end
|
154
|
+
|
155
|
+
# All available docker tags
|
156
|
+
#
|
157
|
+
# @return [Array<String>]
|
158
|
+
def tags
|
159
|
+
return @tags if defined?(@tags)
|
160
|
+
|
161
|
+
logger.info("Fetching docker tags from 'gitlab/gitlab-#{edition}' registry")
|
162
|
+
response = HttpRequest.make_http_request(
|
163
|
+
url: "https://registry.hub.docker.com/v1/repositories/gitlab/gitlab-#{edition}/tags",
|
164
|
+
fail_on_error: false
|
165
|
+
)
|
166
|
+
|
167
|
+
unless response.code == 200
|
168
|
+
logger.error(" failed to fetch docker tags - code: #{response.code}, response: '#{response.body}'")
|
169
|
+
return @tags = nil
|
170
|
+
end
|
171
|
+
|
172
|
+
@tags = JSON
|
173
|
+
.parse(response.body, symbolize_names: true)
|
174
|
+
.map { |tag| tag[:name] }
|
175
|
+
.select { |tag| tag.match?(VERSION_PATTERN) }
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
data/lib/gitlab/qa/version.rb
CHANGED
data/scripts/generate-qa-jobs.rb
CHANGED
@@ -48,6 +48,7 @@ class GenerateQAJobs
|
|
48
48
|
jobs.merge!(load_yml_contents('cloud_activation', should_automatically_run?('test_instance_all_cloud_activation')))
|
49
49
|
jobs.merge!(load_yml_contents('registry_with_cdn', should_automatically_run?('test_integration_registrywithcdn')))
|
50
50
|
jobs.merge!(load_yml_contents('staging'))
|
51
|
+
jobs.merge!(load_yml_contents('metrics', should_automatically_run?('test_instance_all_metrics')))
|
51
52
|
|
52
53
|
# Disabling geo jobs temporarily due to https://gitlab.com/gitlab-org/quality/team-tasks/-/issues/774
|
53
54
|
# jobs.merge!(load_yml_contents('geo', should_automatically_run?('scenario_test_geo')))
|
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: 8.1
|
4
|
+
version: 8.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitLab Quality
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -251,6 +251,7 @@ files:
|
|
251
251
|
- ".gitlab/ci/jobs/ldap_no_tls.gitlab-ci.yml"
|
252
252
|
- ".gitlab/ci/jobs/ldap_tls.gitlab-ci.yml"
|
253
253
|
- ".gitlab/ci/jobs/mattermost.gitlab-ci.yml"
|
254
|
+
- ".gitlab/ci/jobs/metrics.gitlab-ci.yml"
|
254
255
|
- ".gitlab/ci/jobs/mtls.gitlab-ci.yml"
|
255
256
|
- ".gitlab/ci/jobs/object_storage.gitlab-ci.yml"
|
256
257
|
- ".gitlab/ci/jobs/object_storage_aws.gitlab-ci.yml"
|
@@ -396,6 +397,7 @@ files:
|
|
396
397
|
- lib/gitlab/qa/scenario/test/integration/ldap_no_tls.rb
|
397
398
|
- lib/gitlab/qa/scenario/test/integration/ldap_tls.rb
|
398
399
|
- lib/gitlab/qa/scenario/test/integration/mattermost.rb
|
400
|
+
- lib/gitlab/qa/scenario/test/integration/metrics.rb
|
399
401
|
- lib/gitlab/qa/scenario/test/integration/mtls.rb
|
400
402
|
- lib/gitlab/qa/scenario/test/integration/opensearch.rb
|
401
403
|
- lib/gitlab/qa/scenario/test/integration/praefect.rb
|
@@ -408,11 +410,14 @@ files:
|
|
408
410
|
- lib/gitlab/qa/scenario/test/integration/ssh_tunnel.rb
|
409
411
|
- lib/gitlab/qa/scenario/test/omnibus/image.rb
|
410
412
|
- lib/gitlab/qa/scenario/test/omnibus/update.rb
|
413
|
+
- lib/gitlab/qa/scenario/test/omnibus/update_from_previous.rb
|
411
414
|
- lib/gitlab/qa/scenario/test/omnibus/upgrade.rb
|
412
415
|
- lib/gitlab/qa/scenario/test/sanity/version.rb
|
413
416
|
- lib/gitlab/qa/slack/post_to_slack.rb
|
414
417
|
- lib/gitlab/qa/support/dev_ee_qa_image.rb
|
415
418
|
- lib/gitlab/qa/support/get_request.rb
|
419
|
+
- lib/gitlab/qa/support/gitlab_upgrade_path.rb
|
420
|
+
- lib/gitlab/qa/support/gitlab_version_info.rb
|
416
421
|
- lib/gitlab/qa/support/http_request.rb
|
417
422
|
- lib/gitlab/qa/support/invalid_response_error.rb
|
418
423
|
- lib/gitlab/qa/test_logger.rb
|