Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
825124f4
Commit
825124f4
authored
Nov 04, 2021
by
Mark Lapierre
Committed by
Rémy Coutable
Nov 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip package-and-qa if an MR only quarantines tests
parent
6c0e8406
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
8 deletions
+64
-8
.gitlab/ci/qa.gitlab-ci.yml
.gitlab/ci/qa.gitlab-ci.yml
+17
-6
.gitlab/ci/rules.gitlab-ci.yml
.gitlab/ci/rules.gitlab-ci.yml
+1
-1
.rubocop.yml
.rubocop.yml
+1
-1
tooling/bin/find_change_diffs
tooling/bin/find_change_diffs
+27
-0
tooling/bin/qa/check_if_only_quarantined_specs
tooling/bin/qa/check_if_only_quarantined_specs
+18
-0
No files found.
.gitlab/ci/qa.gitlab-ci.yml
View file @
825124f4
...
...
@@ -55,8 +55,14 @@ update-qa-cache:
before_script
:
-
source scripts/utils.sh
-
install_gitlab_gem
-
tooling/bin/find_change_diffs ${CHANGES_DIFFS_DIR}
script
:
-
./scripts/trigger-build omnibus
-
|
if tooling/bin/qa/check_if_only_quarantined_specs ${CHANGES_DIFFS_DIR}; then
exit 0
else
./scripts/trigger-build omnibus
fi
# These jobs often time out, so temporarily use private runners and a long timeout: https://gitlab.com/gitlab-org/gitlab/-/issues/238563
tags
:
-
prm
...
...
@@ -66,14 +72,19 @@ update-qa-cache:
artifacts
:
false
-
job
:
build-assets-image
artifacts
:
false
.package-and-qa-ff-base
:
needs
:
-
detect-tests
artifacts
:
expire_in
:
7d
paths
:
-
${CHANGES_FILE}
-
${CHANGES_DIFFS_DIR}/*
variables
:
CHANGED_FILES
:
tmp/changed_files.txt
CHANGES_FILE
:
tmp/changed_files.txt
CHANGES_DIFFS_DIR
:
tmp/diffs
.package-and-qa-ff-base
:
script
:
-
export GITLAB_QA_OPTIONS="--set-feature-flags $(scripts/changed-feature-flags --files $(cat $CHANGE
D_FILES
| tr ' ' ',') --state $QA_FF_STATE)"
-
export GITLAB_QA_OPTIONS="--set-feature-flags $(scripts/changed-feature-flags --files $(cat $CHANGE
S_FILE
| tr ' ' ',') --state $QA_FF_STATE)"
-
echo $GITLAB_QA_OPTIONS
-
./scripts/trigger-build omnibus
...
...
.gitlab/ci/rules.gitlab-ci.yml
View file @
825124f4
...
...
@@ -1258,7 +1258,7 @@
.rails:rules:detect-tests:
rules
:
-
changes
:
*code-backstage-patterns
-
changes
:
*code-backstage-
qa-
patterns
-
<<
:
*if-merge-request-labels-run-all-rspec
.rails:rules:detect-previous-failed-tests:
...
...
.rubocop.yml
View file @
825124f4
...
...
@@ -123,7 +123,7 @@ Naming/FileName:
-
'
ee/lib/generators/**/*'
-
'
scripts/**/*'
-
'
spec/**/*'
-
'
tooling/bin/*'
-
'
tooling/bin/*
*/*
'
-
'
ee/spec/**/*'
-
'
jh/spec/**/*'
-
'
qa/bin/*'
...
...
tooling/bin/find_change_diffs
0 → 100755
View file @
825124f4
#!/usr/bin/env ruby
# frozen_string_literal: true
require
'gitlab'
require
'pathname'
# This script saves the diffs of changes in an MR to the directory specified as the first argument
gitlab_token
=
ENV
.
fetch
(
'PROJECT_TOKEN_FOR_CI_SCRIPTS_API_USAGE'
)
gitlab_endpoint
=
ENV
.
fetch
(
'CI_API_V4_URL'
)
mr_project_path
=
ENV
.
fetch
(
'CI_MERGE_REQUEST_PROJECT_PATH'
)
mr_iid
=
ENV
.
fetch
(
'CI_MERGE_REQUEST_IID'
)
abort
(
"ERROR: Please specify a directory to write MR diffs into."
)
if
ARGV
.
empty?
output_diffs_dir
=
Pathname
.
new
(
ARGV
.
shift
).
expand_path
Gitlab
.
configure
do
|
config
|
config
.
endpoint
=
gitlab_endpoint
config
.
private_token
=
gitlab_token
end
Gitlab
.
merge_request_changes
(
mr_project_path
,
mr_iid
).
changes
.
each
do
|
change
|
next
if
change
[
'diff'
].
empty?
output_diffs_dir
.
join
(
File
.
dirname
(
change
[
'new_path'
])).
mkpath
output_diffs_dir
.
join
(
"
#{
change
[
'new_path'
]
}
.diff"
).
write
(
change
[
'diff'
])
end
tooling/bin/qa/check_if_only_quarantined_specs
0 → 100755
View file @
825124f4
#!/usr/bin/env ruby
# frozen_string_literal: true
require
'pathname'
# This script assumes the first argument is a directory of files containing diffs of changes from an MR. It exits with a
# success code if all diffs add a line that quarantines a test. If any diffs are not specs, or they are specs that don't
# quarantine a test, it exits with code 1 to indicate failure (i.e., there was _not_ only quarantined specs).
abort
(
"ERROR: Please specify the directory containing MR diffs."
)
if
ARGV
.
empty?
diffs_dir
=
Pathname
.
new
(
ARGV
.
shift
).
expand_path
diffs_dir
.
glob
(
'**/*'
).
each
do
|
path
|
next
if
path
.
directory?
exit
1
unless
path
.
to_s
.
end_with?
(
'_spec.rb.diff'
)
exit
1
unless
path
.
read
.
match?
(
/^\+.*, quarantine:/
)
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment