gitlab-qa 6.15.1 → 6.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +53 -37
- data/lib/gitlab/qa.rb +1 -0
- data/lib/gitlab/qa/report/generate_test_session.rb +14 -4
- data/lib/gitlab/qa/report/gitlab_issue_client.rb +1 -1
- data/lib/gitlab/qa/report/prepare_stage_reports.rb +4 -1
- data/lib/gitlab/qa/report/relate_failure_issue.rb +3 -2
- data/lib/gitlab/qa/report/report_as_issue.rb +5 -5
- data/lib/gitlab/qa/runtime/env.rb +29 -1
- data/lib/gitlab/qa/scenario/test/integration/ssh_tunnel.rb +59 -0
- data/lib/gitlab/qa/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc3ae23427dadce6649bb30dbc58dada153af79f60efb265edd5f7439facc56f
|
4
|
+
data.tar.gz: 9308ba475631df203f08503929787c1015fb4313b455d30a8fee2175016b1429
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89c9c13ae10ff6e8f0076fb02d365cb45ede7320901bc5b4e4ca25ae935b9af26bc7da4d48bdab172ea6c3b74092032e5c9c5f04704ee7f98b38b67a594f81e5
|
7
|
+
data.tar.gz: 246f02d2389dd6db83ee1aac5e7dbc3e95ebfb12f9524f11181decf68ec5c9906adaa88531da62f66c2037c800de86084e4741193c3eaced1229ce135610fb1b
|
data/.gitlab-ci.yml
CHANGED
@@ -28,7 +28,7 @@ workflow:
|
|
28
28
|
rules:
|
29
29
|
# For merge requests, create a pipeline.
|
30
30
|
- if: '$CI_MERGE_REQUEST_IID'
|
31
|
-
# For
|
31
|
+
# For the default branch, create a pipeline (this includes on schedules, pushes, merges, etc.).
|
32
32
|
- if: '$CI_COMMIT_BRANCH == "master"'
|
33
33
|
# For tags, create a pipeline.
|
34
34
|
- if: '$CI_COMMIT_TAG'
|
@@ -42,10 +42,11 @@ variables:
|
|
42
42
|
QA_CAN_TEST_GIT_PROTOCOL_V2: "true"
|
43
43
|
QA_CAN_TEST_PRAEFECT: "false"
|
44
44
|
QA_TESTCASES_REPORTING_PROJECT: "gitlab-org/quality/testcases"
|
45
|
-
QA_FAILURES_REPORTING_PROJECT: "rymai/gitlab-qa-issues"
|
46
|
-
# The --dry-run or --max-diff-ratio option can be set to modify the behavior of `exe/gitlab-qa-report --relate-failure-issue` without releasing a new gem version.
|
47
|
-
QA_FAILURES_REPORTER_OPTIONS: ""
|
48
45
|
QA_TESTCASE_SESSIONS_PROJECT: "gitlab-org/quality/testcase-sessions"
|
46
|
+
# QA_DEFAULT_BRANCH is the default branch name of the instance under test.
|
47
|
+
QA_DEFAULT_BRANCH: "master"
|
48
|
+
# TOP_UPSTREAM_DEFAULT_BRANCH is the default branch name of the original project that triggered a pipeline in this project.
|
49
|
+
TOP_UPSTREAM_DEFAULT_BRANCH: "master"
|
49
50
|
|
50
51
|
.check-base:
|
51
52
|
stage: check
|
@@ -77,8 +78,7 @@ rspec:
|
|
77
78
|
- exe/gitlab-qa ${QA_SCENARIO:=Test::Instance::Image} ${RELEASE:=$DEFAULT_RELEASE} $GITLAB_QA_OPTS -- $QA_TESTS $QA_RSPEC_TAGS $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
78
79
|
- exe/gitlab-qa-report --update-screenshot-path "gitlab-qa-run-*/**/rspec-*.xml"
|
79
80
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
80
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" ==
|
81
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --relate-failure-issue "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_FAILURES_REPORTING_PROJECT" $QA_FAILURES_REPORTER_OPTIONS || true; fi
|
81
|
+
- if [ "$TOP_UPSTREAM_SOURCE_REF" == $TOP_UPSTREAM_DEFAULT_BRANCH ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
|
82
82
|
- exit $test_run_exit_code
|
83
83
|
|
84
84
|
.ce-qa:
|
@@ -86,7 +86,8 @@ rspec:
|
|
86
86
|
DEFAULT_RELEASE: "CE"
|
87
87
|
rules:
|
88
88
|
# Don't run E2E jobs on release pipelines
|
89
|
-
-
|
89
|
+
- if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab-qa" && $RELEASE == null'
|
90
|
+
changes: ["lib/**/version.rb"]
|
90
91
|
when: never
|
91
92
|
- if: '$CI_COMMIT_TAG || $RELEASE =~ /gitlab-ee/'
|
92
93
|
when: never
|
@@ -103,7 +104,8 @@ rspec:
|
|
103
104
|
DEFAULT_RELEASE: "EE"
|
104
105
|
rules:
|
105
106
|
# Don't run E2E jobs on release pipelines
|
106
|
-
-
|
107
|
+
- if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab-qa" && $RELEASE == null'
|
108
|
+
changes: ["lib/**/version.rb"]
|
107
109
|
when: never
|
108
110
|
- if: '$CI_COMMIT_TAG || $RELEASE =~ /gitlab-ce/'
|
109
111
|
when: never
|
@@ -118,7 +120,8 @@ rspec:
|
|
118
120
|
.only-qa:
|
119
121
|
rules:
|
120
122
|
# Don't run E2E jobs on release pipelines
|
121
|
-
-
|
123
|
+
- if: '$CI_SERVER_HOST == "gitlab.com" && $CI_PROJECT_PATH == "gitlab-org/gitlab-qa" && $RELEASE == null'
|
124
|
+
changes: ["lib/**/version.rb"]
|
122
125
|
when: never
|
123
126
|
- if: '$CI_COMMIT_TAG || $RELEASE'
|
124
127
|
when: never
|
@@ -329,8 +332,7 @@ ce:update:
|
|
329
332
|
script:
|
330
333
|
- exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=CE} ${RELEASE:=CE} -- $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
331
334
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
332
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" ==
|
333
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --relate-failure-issue "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_FAILURES_REPORTING_PROJECT" $QA_FAILURES_REPORTER_OPTIONS || true; fi
|
335
|
+
- if [ "$TOP_UPSTREAM_SOURCE_REF" == $TOP_UPSTREAM_DEFAULT_BRANCH ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
|
334
336
|
- exit $test_run_exit_code
|
335
337
|
extends:
|
336
338
|
- .test
|
@@ -344,8 +346,7 @@ ce:update-quarantine:
|
|
344
346
|
script:
|
345
347
|
- exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=CE} ${RELEASE:=CE} -- --tag quarantine --tag ~orchestrated $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
346
348
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
347
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" ==
|
348
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --relate-failure-issue "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_FAILURES_REPORTING_PROJECT" $QA_FAILURES_REPORTER_OPTIONS || true; fi
|
349
|
+
- if [ "$TOP_UPSTREAM_SOURCE_REF" == $TOP_UPSTREAM_DEFAULT_BRANCH ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
|
349
350
|
- exit $test_run_exit_code
|
350
351
|
extends:
|
351
352
|
- .test
|
@@ -358,8 +359,7 @@ ee:update:
|
|
358
359
|
script:
|
359
360
|
- exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=EE} ${RELEASE:=EE} -- $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
360
361
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
361
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" ==
|
362
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --relate-failure-issue "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_FAILURES_REPORTING_PROJECT" $QA_FAILURES_REPORTER_OPTIONS || true; fi
|
362
|
+
- if [ "$TOP_UPSTREAM_SOURCE_REF" == $TOP_UPSTREAM_DEFAULT_BRANCH ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
|
363
363
|
- exit $test_run_exit_code
|
364
364
|
extends:
|
365
365
|
- .test
|
@@ -373,8 +373,7 @@ ee:update-quarantine:
|
|
373
373
|
script:
|
374
374
|
- exe/gitlab-qa Test::Omnibus::Update ${RELEASE:=EE} ${RELEASE:=EE} -- --tag quarantine --tag ~orchestrated $RSPEC_REPORT_OPTS || test_run_exit_code=$?
|
375
375
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
376
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" ==
|
377
|
-
- if [ "$TOP_UPSTREAM_SOURCE_REF" == "master" ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --relate-failure-issue "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_FAILURES_REPORTING_PROJECT" $QA_FAILURES_REPORTER_OPTIONS || true; fi
|
376
|
+
- if [ "$TOP_UPSTREAM_SOURCE_REF" == $TOP_UPSTREAM_DEFAULT_BRANCH ] || [[ "$TOP_UPSTREAM_SOURCE_JOB" == https://ops.gitlab.net* ]]; then exe/gitlab-qa-report --report-in-issues "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASES_REPORTING_PROJECT" || true; fi
|
378
377
|
- exit $test_run_exit_code
|
379
378
|
extends:
|
380
379
|
- .test
|
@@ -462,24 +461,23 @@ ee:mattermost-quarantine:
|
|
462
461
|
variables:
|
463
462
|
QA_SCENARIO: "Test::Integration::Mattermost"
|
464
463
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
ee:geo-quarantine:
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
QA_SCENARIO: "Test::Integration::Geo"
|
464
|
+
# Disabling geo jobs temporarily due to https://gitlab.com/gitlab-org/gitlab/-/issues/273063
|
465
|
+
# ee:geo:
|
466
|
+
# extends:
|
467
|
+
# - .test
|
468
|
+
# - .ee-qa
|
469
|
+
# - .rspec-report-opts
|
470
|
+
# variables:
|
471
|
+
# QA_SCENARIO: "Test::Integration::Geo"
|
472
|
+
|
473
|
+
# ee:geo-quarantine:
|
474
|
+
# extends:
|
475
|
+
# - .test
|
476
|
+
# - .ee-qa
|
477
|
+
# - .quarantine
|
478
|
+
# - .rspec-report-opts
|
479
|
+
# variables:
|
480
|
+
# QA_SCENARIO: "Test::Integration::Geo"
|
483
481
|
|
484
482
|
ce:ldap_no_tls:
|
485
483
|
extends:
|
@@ -945,7 +943,7 @@ staging:
|
|
945
943
|
generate_test_session:
|
946
944
|
stage: report
|
947
945
|
rules:
|
948
|
-
- if: '$TOP_UPSTREAM_SOURCE_JOB && $TOP_UPSTREAM_SOURCE_REF ==
|
946
|
+
- if: '$TOP_UPSTREAM_SOURCE_JOB && $TOP_UPSTREAM_SOURCE_REF == $TOP_UPSTREAM_DEFAULT_BRANCH'
|
949
947
|
when: always
|
950
948
|
- if: '$TOP_UPSTREAM_SOURCE_JOB =~ /\Ahttps:\/\/ops.gitlab.net\//'
|
951
949
|
when: always
|
@@ -958,6 +956,24 @@ generate_test_session:
|
|
958
956
|
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
959
957
|
- exe/gitlab-qa-report --generate-test-session "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_TESTCASE_SESSIONS_PROJECT"
|
960
958
|
|
959
|
+
relate_test_failures:
|
960
|
+
stage: report
|
961
|
+
rules:
|
962
|
+
- if: '$DISABLE_RELATING_FAILURE_ISSUES'
|
963
|
+
when: never
|
964
|
+
- if: '$TOP_UPSTREAM_SOURCE_JOB && $TOP_UPSTREAM_SOURCE_REF == $TOP_UPSTREAM_DEFAULT_BRANCH'
|
965
|
+
when: always
|
966
|
+
- if: '$TOP_UPSTREAM_SOURCE_JOB =~ /\Ahttps:\/\/ops.gitlab.net\//'
|
967
|
+
when: always
|
968
|
+
variables:
|
969
|
+
QA_FAILURES_REPORTING_PROJECT: "gitlab-org/gitlab"
|
970
|
+
QA_FAILURES_MAX_DIFF_RATIO: "0.05"
|
971
|
+
# The --dry-run can be set to modify the behavior of `exe/gitlab-qa-report --relate-failure-issue` without releasing a new gem version.
|
972
|
+
QA_FAILURES_REPORTER_OPTIONS: ""
|
973
|
+
script:
|
974
|
+
- export GITLAB_QA_ACCESS_TOKEN="$GITLAB_QA_PRODUCTION_ACCESS_TOKEN"
|
975
|
+
- exe/gitlab-qa-report --relate-failure-issue "gitlab-qa-run-*/**/rspec-*.json" --project "$QA_FAILURES_REPORTING_PROJECT" --max-diff-ratio "$QA_FAILURES_MAX_DIFF_RATIO" $QA_FAILURES_REPORTER_OPTIONS
|
976
|
+
|
961
977
|
.notify_upstream_commit:
|
962
978
|
stage: notify
|
963
979
|
image: ruby:2.6
|
@@ -994,7 +1010,7 @@ notify_slack:
|
|
994
1010
|
rules:
|
995
1011
|
- if: '$TOP_UPSTREAM_SOURCE_JOB && $NOTIFY_CHANNEL'
|
996
1012
|
when: on_failure
|
997
|
-
- if: '$TOP_UPSTREAM_SOURCE_JOB && $TOP_UPSTREAM_SOURCE_REF ==
|
1013
|
+
- if: '$TOP_UPSTREAM_SOURCE_JOB && $TOP_UPSTREAM_SOURCE_REF == $TOP_UPSTREAM_DEFAULT_BRANCH'
|
998
1014
|
when: on_failure
|
999
1015
|
script:
|
1000
1016
|
- export RELEASE=${TOP_UPSTREAM_SOURCE_REF:-$RELEASE}
|
data/lib/gitlab/qa.rb
CHANGED
@@ -57,6 +57,7 @@ module Gitlab
|
|
57
57
|
autoload :SMTP, 'gitlab/qa/scenario/test/integration/smtp'
|
58
58
|
autoload :GitalyCluster, 'gitlab/qa/scenario/test/integration/gitaly_cluster'
|
59
59
|
autoload :Jira, 'gitlab/qa/scenario/test/integration/jira'
|
60
|
+
autoload :SSHTunnel, 'gitlab/qa/scenario/test/integration/ssh_tunnel'
|
60
61
|
end
|
61
62
|
|
62
63
|
module Sanity
|
@@ -27,7 +27,7 @@ module Gitlab
|
|
27
27
|
# rubocop:enable Metrics/AbcSize
|
28
28
|
|
29
29
|
def generate_description(tests)
|
30
|
-
<<~MARKDOWN
|
30
|
+
<<~MARKDOWN.rstrip
|
31
31
|
## Session summary
|
32
32
|
|
33
33
|
* Deploy version: #{Runtime::Env.deploy_version}
|
@@ -39,9 +39,7 @@ module Gitlab
|
|
39
39
|
|
40
40
|
#{generate_stages_listing(tests)}
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
* #{Runtime::Env.qa_issue_url}
|
42
|
+
#{generate_qa_issue_relation}
|
45
43
|
MARKDOWN
|
46
44
|
end
|
47
45
|
|
@@ -229,6 +227,18 @@ module Gitlab
|
|
229
227
|
'-'
|
230
228
|
end
|
231
229
|
end
|
230
|
+
|
231
|
+
def generate_qa_issue_relation
|
232
|
+
return unless Runtime::Env.qa_issue_url
|
233
|
+
|
234
|
+
<<~MARKDOWN.chomp
|
235
|
+
## Release QA issue
|
236
|
+
|
237
|
+
* #{Runtime::Env.qa_issue_url}
|
238
|
+
|
239
|
+
/relate #{Runtime::Env.qa_issue_url}
|
240
|
+
MARKDOWN
|
241
|
+
end
|
232
242
|
end
|
233
243
|
end
|
234
244
|
end
|
@@ -110,7 +110,7 @@ module Gitlab
|
|
110
110
|
channel = pipeline == "canary" ? "qa-production" : "qa-#{pipeline}"
|
111
111
|
error_msg = warn_exception(e)
|
112
112
|
|
113
|
-
return unless QA::Runtime::Env.ci_commit_ref_name ==
|
113
|
+
return unless QA::Runtime::Env.ci_commit_ref_name == QA::Runtime::Env.default_branch
|
114
114
|
|
115
115
|
slack_options = {
|
116
116
|
channel: channel,
|
@@ -34,7 +34,10 @@ module Gitlab
|
|
34
34
|
# /qa/specs/features/ee/api/<stage>
|
35
35
|
# /qa/specs/features/ee/browser_ui/<stage>
|
36
36
|
# For now we assume the Stage is whatever follows api/ or browser_ui/
|
37
|
-
|
37
|
+
test_path_match = test['file'].match(%r{(api|browser_ui)/([a-z0-9_]+)}i)
|
38
|
+
next unless test_path_match
|
39
|
+
|
40
|
+
stage = strip_number_prefix(test_path_match[2])
|
38
41
|
testcases[stage] = [] unless testcases.key?(stage)
|
39
42
|
testcases[stage] << test
|
40
43
|
end
|
@@ -10,7 +10,7 @@ module Gitlab
|
|
10
10
|
# Uses the API to create or update GitLab issues with the results of tests from RSpec report files.
|
11
11
|
class RelateFailureIssue < ReportAsIssue
|
12
12
|
DEFAULT_MAX_DIFF_RATIO_FOR_DETECTION = 0.05
|
13
|
-
STACKTRACE_REGEX = %r{### Stack trace\s*(```)\s
|
13
|
+
STACKTRACE_REGEX = %r{### Stack trace\s*(```)\s*(?!.*Failure/Error:)?(.+)(\1)}m.freeze
|
14
14
|
NEW_ISSUE_LABELS = Set.new(%w[QA Quality test failure::investigating priority::2]).freeze
|
15
15
|
|
16
16
|
MultipleIssuesFound = Class.new(StandardError)
|
@@ -85,7 +85,8 @@ module Gitlab
|
|
85
85
|
next unless relevant_issue_stacktrace
|
86
86
|
|
87
87
|
distance = ld.call(first_test_failure_stacktrace, relevant_issue_stacktrace)
|
88
|
-
diff_ratio = (distance.to_f / first_test_failure_stacktrace.size).round(3)
|
88
|
+
diff_ratio = distance.zero? ? 0.0 : (distance.to_f / first_test_failure_stacktrace.size).round(3)
|
89
|
+
|
89
90
|
if diff_ratio <= max_diff_ratio
|
90
91
|
puts " => [DEBUG] Issue #{issue} has an acceptable diff ratio of #{(diff_ratio * 100).round(2)}%."
|
91
92
|
# The `Gitlab::ObjectifiedHash` class overrides `#hash` which is used by `Hash#[]=` to compute the hash key.
|
@@ -112,7 +112,7 @@ module Gitlab
|
|
112
112
|
"found:#{pipeline}.gitlab.com"
|
113
113
|
when 'preprod'
|
114
114
|
'found:pre.gitlab.com'
|
115
|
-
when 'staging-orchestrated', 'nightly',
|
115
|
+
when 'staging-orchestrated', 'nightly', QA::Runtime::Env.default_branch
|
116
116
|
"found:#{pipeline}"
|
117
117
|
else
|
118
118
|
raise "No `found:*` label for the `#{pipeline}` pipeline!"
|
@@ -147,14 +147,14 @@ module Gitlab
|
|
147
147
|
# Gets the name of the pipeline the test was run in, to be used as the key of a scoped label
|
148
148
|
#
|
149
149
|
# Tests can be run in several pipelines:
|
150
|
-
# gitlab-qa, nightly,
|
150
|
+
# gitlab-qa, nightly, staging, canary, production, preprod, MRs, and the default branch (master/main)
|
151
151
|
#
|
152
152
|
# Some of those run in their own project, so CI_PROJECT_NAME is the name we need. Those are:
|
153
153
|
# nightly, staging, canary, production, and preprod
|
154
154
|
#
|
155
|
-
# MR, master, and gitlab-qa tests run in gitlab-qa, but we only want to report tests run on
|
156
|
-
# because the other pipelines will be monitored by the author of the MR that triggered them.
|
157
|
-
# So we assume that we're reporting a master pipeline if the project name is 'gitlab-qa'.
|
155
|
+
# MR, master/main, and gitlab-qa tests run in gitlab-qa, but we only want to report tests run on
|
156
|
+
# master/main because the other pipelines will be monitored by the author of the MR that triggered them.
|
157
|
+
# So we assume that we're reporting a master/main pipeline if the project name is 'gitlab-qa'.
|
158
158
|
|
159
159
|
@pipeline ||= Runtime::Env.pipeline_from_project_name
|
160
160
|
end
|
@@ -44,6 +44,7 @@ module Gitlab
|
|
44
44
|
'QA_GITALY_NON_CLUSTER_STORAGE' => :qa_gitaly_non_cluster_storage,
|
45
45
|
'QA_COOKIES' => :qa_cookie,
|
46
46
|
'QA_DEBUG' => :qa_debug,
|
47
|
+
'QA_DEFAULT_BRANCH' => :qa_default_branch,
|
47
48
|
'QA_LOG_PATH' => :qa_log_path,
|
48
49
|
'QA_CAN_TEST_ADMIN_FEATURES' => :qa_can_test_admin_features,
|
49
50
|
'QA_CAN_TEST_GIT_PROTOCOL_V2' => :qa_can_test_git_protocol_v2,
|
@@ -100,6 +101,10 @@ module Gitlab
|
|
100
101
|
end
|
101
102
|
end
|
102
103
|
|
104
|
+
def default_branch
|
105
|
+
ENV['QA_DEFAULT_BRANCH'] || 'master'
|
106
|
+
end
|
107
|
+
|
103
108
|
def gitlab_username
|
104
109
|
ENV['GITLAB_USERNAME'] || 'gitlab-qa'
|
105
110
|
end
|
@@ -157,7 +162,7 @@ module Gitlab
|
|
157
162
|
if ENV['TOP_UPSTREAM_SOURCE_JOB'].to_s.start_with?('https://ops.gitlab.net')
|
158
163
|
'staging-orchestrated'
|
159
164
|
else
|
160
|
-
|
165
|
+
QA::Runtime::Env.default_branch
|
161
166
|
end
|
162
167
|
else
|
163
168
|
ci_project_name
|
@@ -176,6 +181,10 @@ module Gitlab
|
|
176
181
|
ENV['GITLAB_QA_DEV_ACCESS_TOKEN']
|
177
182
|
end
|
178
183
|
|
184
|
+
def initial_root_password
|
185
|
+
ENV['GITLAB_INITIAL_ROOT_PASSWORD']
|
186
|
+
end
|
187
|
+
|
179
188
|
def qa_container_registry_access_token
|
180
189
|
ENV['GITLAB_QA_CONTAINER_REGISTRY_ACCESS_TOKEN']
|
181
190
|
end
|
@@ -251,6 +260,25 @@ module Gitlab
|
|
251
260
|
end
|
252
261
|
end
|
253
262
|
|
263
|
+
def require_initial_password!
|
264
|
+
return unless ENV['GITLAB_INITIAL_ROOT_PASSWORD'].to_s.strip.empty?
|
265
|
+
|
266
|
+
raise ArgumentError, "Environment variable GITLAB_INITIAL_ROOT_PASSWORD must be provided to set an initial root password."
|
267
|
+
end
|
268
|
+
|
269
|
+
def require_ssh_tunnel!
|
270
|
+
%w[TUNNEL_SSH_PRIVATE_KEY TUNNEL_SERVER_HOSTNAME TUNNEL_SSH_USER].each do |env_key|
|
271
|
+
raise ArgumentError, "Environment variable #{env_key} must be set to run tunnel specs" unless ENV.key?(env_key)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
def override_default_password!
|
276
|
+
require_initial_password!
|
277
|
+
|
278
|
+
ENV['GITLAB_PASSWORD'] = initial_root_password
|
279
|
+
ENV['GITLAB_ADMIN_PASSWORD'] = initial_root_password
|
280
|
+
end
|
281
|
+
|
254
282
|
def skip_pull?
|
255
283
|
enabled?(ENV['QA_SKIP_PULL'], default: false)
|
256
284
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Gitlab
|
4
|
+
module QA
|
5
|
+
module Scenario
|
6
|
+
module Test
|
7
|
+
module Integration
|
8
|
+
class SSHTunnel < Scenario::Template
|
9
|
+
# rubocop:disable Metrics/AbcSize
|
10
|
+
def perform(release, *rspec_args)
|
11
|
+
Runtime::Env.override_default_password!
|
12
|
+
Runtime::Env.require_ssh_tunnel!
|
13
|
+
|
14
|
+
Component::Gitlab.perform do |gitlab|
|
15
|
+
gitlab.release = release
|
16
|
+
gitlab.network = 'test'
|
17
|
+
|
18
|
+
Component::InternetTunnel.perform do |tunnel_gitlab|
|
19
|
+
Component::InternetTunnel.perform do |tunnel_registry|
|
20
|
+
tunnel_gitlab.gitlab_hostname = gitlab.hostname
|
21
|
+
tunnel_gitlab.network = 'test'
|
22
|
+
tunnel_registry.gitlab_hostname = gitlab.hostname
|
23
|
+
tunnel_registry.network = 'test'
|
24
|
+
|
25
|
+
gitlab.omnibus_config = <<~OMNIBUS
|
26
|
+
external_url '#{tunnel_gitlab.url}';
|
27
|
+
nginx['listen_port'] = 80;
|
28
|
+
nginx['listen_https'] = false;
|
29
|
+
# documentation: https://docs.gitlab.com/omnibus/settings/database.html#seed-the-database-fresh-installs-only
|
30
|
+
gitlab_rails['initial_root_password'] = '#{Runtime::Env.require_initial_password}'
|
31
|
+
|
32
|
+
registry_external_url '#{tunnel_registry.url}';
|
33
|
+
registry_nginx['listen_port'] = 80;
|
34
|
+
registry_nginx['listen_https'] = false;
|
35
|
+
OMNIBUS
|
36
|
+
|
37
|
+
tunnel_gitlab.instance do
|
38
|
+
tunnel_registry.instance do
|
39
|
+
gitlab.instance do
|
40
|
+
Component::Specs.perform do |specs|
|
41
|
+
specs.suite = 'Test::Integration::SSHTunnel'
|
42
|
+
specs.release = gitlab.release
|
43
|
+
specs.network = gitlab.network
|
44
|
+
specs.args = [tunnel_gitlab.url, *rspec_args]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
# rubocop:enable Metrics/AbcSize
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
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: 6.
|
4
|
+
version: 6.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grzegorz Bizon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -310,6 +310,7 @@ files:
|
|
310
310
|
- lib/gitlab/qa/scenario/test/integration/praefect.rb
|
311
311
|
- lib/gitlab/qa/scenario/test/integration/saml.rb
|
312
312
|
- lib/gitlab/qa/scenario/test/integration/smtp.rb
|
313
|
+
- lib/gitlab/qa/scenario/test/integration/ssh_tunnel.rb
|
313
314
|
- lib/gitlab/qa/scenario/test/omnibus/image.rb
|
314
315
|
- lib/gitlab/qa/scenario/test/omnibus/update.rb
|
315
316
|
- lib/gitlab/qa/scenario/test/omnibus/upgrade.rb
|