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
c62a0085
Commit
c62a0085
authored
Nov 08, 2021
by
Mark Lapierre
Committed by
Rémy Coutable
Nov 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always run `package-and-qa` in scheduled pipelines
parent
a97ccbe5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
23 deletions
+64
-23
.gitlab/ci/qa.gitlab-ci.yml
.gitlab/ci/qa.gitlab-ci.yml
+6
-3
tooling/bin/find_change_diffs
tooling/bin/find_change_diffs
+13
-2
tooling/bin/qa/check_if_only_quarantined_specs
tooling/bin/qa/check_if_only_quarantined_specs
+0
-18
tooling/bin/qa/package_and_qa_check
tooling/bin/qa/package_and_qa_check
+45
-0
No files found.
.gitlab/ci/qa.gitlab-ci.yml
View file @
c62a0085
...
...
@@ -58,10 +58,13 @@ update-qa-cache:
-
tooling/bin/find_change_diffs ${CHANGES_DIFFS_DIR}
script
:
-
|
if tooling/bin/qa/check_if_only_quarantined_specs ${CHANGES_DIFFS_DIR}; then
exit 0
else
tooling/bin/qa/package_and_qa_check ${CHANGES_DIFFS_DIR} && exit_code=$?
if [ $exit_code -eq 0 ]; then
./scripts/trigger-build omnibus
elif [ $exit_code -eq 1 ]; then
exit 1
else
echo "Downstream jobs will not be triggered because package_and_qa_check exited with code: $exit_code"
fi
# These jobs often time out, so temporarily use private runners and a long timeout: https://gitlab.com/gitlab-org/gitlab/-/issues/238563
tags
:
...
...
tooling/bin/find_change_diffs
View file @
c62a0085
...
...
@@ -5,11 +5,22 @@ require 'gitlab'
require
'pathname'
# This script saves the diffs of changes in an MR to the directory specified as the first argument
#
# It exits with a success code if diffs are found and saved, or if there are no changes, including if the script runs in
# a pipeline that is not for a merge request.
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'
)
mr_project_path
=
ENV
[
'CI_MERGE_REQUEST_PROJECT_PATH'
]
mr_iid
=
ENV
[
'CI_MERGE_REQUEST_IID'
]
puts
"CI_MERGE_REQUEST_PROJECT_PATH is missing."
if
mr_project_path
.
to_s
.
empty?
puts
"CI_MERGE_REQUEST_IID is missing."
if
mr_iid
.
to_s
.
empty?
unless
mr_project_path
&&
mr_iid
puts
"Exiting as this does not appear to be a merge request pipeline."
exit
end
abort
(
"ERROR: Please specify a directory to write MR diffs into."
)
if
ARGV
.
empty?
output_diffs_dir
=
Pathname
.
new
(
ARGV
.
shift
).
expand_path
...
...
tooling/bin/qa/check_if_only_quarantined_specs
deleted
100755 → 0
View file @
a97ccbe5
#!/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
tooling/bin/qa/package_and_qa_check
0 → 100755
View file @
c62a0085
#!/usr/bin/env ruby
# frozen_string_literal: true
require
'pathname'
# This script checks if the package-and-qa job should trigger downstream pipelines to run the QA suite.
#
# It assumes the first argument is a directory of files containing diffs of changes from an MR
# (e.g., created by tooling/bin/find_change_diffs). It exits with a success code if there are no diffs, or if the diffs
# are suitable to run QA tests.
#
# The script will abort (exit code 1) if the argument is missing.
#
# The following condition will result in a failure code (2), indicating that package-and-qa should not run:
#
# - If the changes only include tests being put in quarantine
abort
(
"ERROR: Please specify the directory containing MR diffs."
)
if
ARGV
.
empty?
diffs_dir
=
Pathname
.
new
(
ARGV
.
shift
).
expand_path
# Run package-and-qa if there are no diffs. E.g., in scheduled pipelines
exit
0
if
diffs_dir
.
glob
(
'**/*'
).
empty?
files_count
=
0
specs_count
=
0
quarantine_specs_count
=
0
diffs_dir
.
glob
(
'**/*'
).
each
do
|
path
|
next
if
path
.
directory?
files_count
+=
1
next
unless
path
.
to_s
.
end_with?
(
'_spec.rb.diff'
)
specs_count
+=
1
quarantine_specs_count
+=
1
if
path
.
read
.
match?
(
/^\+.*, quarantine:/
)
end
# Run package-and-qa if there are no specs. E.g., when the MR changes QA framework files.
exit
0
if
specs_count
==
0
# Skip package-and-qa if there are only specs being put in quarantine.
exit
2
if
quarantine_specs_count
==
specs_count
&&
quarantine_specs_count
==
files_count
# Run package-and-qa under any other circumstances. E.g., if there are specs being put in quarantine but there are also
# other changes that might need to be tested.
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