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
f5e22d6f
Commit
f5e22d6f
authored
Jan 10, 2022
by
Andrejs Cunskis
Committed by
Mark Lapierre
Jan 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy regenerated knasack report last
Extract repeated code to variables
parent
82253cc6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
qa/qa/tools/knapsack_report.rb
qa/qa/tools/knapsack_report.rb
+10
-5
qa/spec/spec_helper.rb
qa/spec/spec_helper.rb
+4
-2
No files found.
qa/qa/tools/knapsack_report.rb
View file @
f5e22d6f
...
...
@@ -9,6 +9,7 @@ module QA
PROJECT
=
"gitlab-qa-resources"
BUCKET
=
"knapsack-reports"
FALLBACK_REPORT
=
"knapsack/master_report.json"
def_delegators
:new
,
:configure!
,
:move_regenerated_report
,
:download_report
,
:upload_report
...
...
@@ -35,9 +36,9 @@ module QA
file
=
client
.
get_object
(
BUCKET
,
report_file
)
File
.
write
(
report_path
,
file
[
:body
])
rescue
StandardError
=>
e
ENV
[
"KNAPSACK_REPORT_PATH"
]
=
"knapsack/master_report.json"
ENV
[
"KNAPSACK_REPORT_PATH"
]
=
FALLBACK_REPORT
logger
.
warn
(
"Failed to fetch latest knapsack report:
#{
e
}
"
)
logger
.
warn
(
"Falling back to '
knapsack/master_report.json
'"
)
logger
.
warn
(
"Falling back to '
#{
FALLBACK_REPORT
}
'"
)
end
# Rename and move new regenerated report to a separate folder used to indicate report name
...
...
@@ -46,11 +47,13 @@ module QA
def
move_regenerated_report
return
unless
ENV
[
"KNAPSACK_GENERATE_REPORT"
]
==
"true"
path
=
"tmp/knapsack/
#{
report_name
}
"
FileUtils
.
mkdir_p
(
path
)
tmp_
path
=
"tmp/knapsack/
#{
report_name
}
"
FileUtils
.
mkdir_p
(
tmp_
path
)
# Use path from knapsack config in case of fallback to master_report.json
FileUtils
.
cp
(
Knapsack
.
report
.
report_path
,
"
#{
path
}
/
#{
ENV
[
'CI_NODE_INDEX'
]
}
.json"
)
knapsack_report_path
=
Knapsack
.
report
.
report_path
logger
.
debug
(
"Moving regenerated
#{
knapsack_report_path
}
to save as artifact"
)
FileUtils
.
cp
(
knapsack_report_path
,
"
#{
tmp_path
}
/
#{
ENV
[
'CI_NODE_INDEX'
]
}
.json"
)
end
# Merge and upload knapsack report to gcs bucket
...
...
@@ -73,6 +76,8 @@ module QA
report
=
jsons
.
map
{
|
json
|
JSON
.
parse
(
File
.
read
(
json
))
}
.
reduce
({},
:merge
)
.
sort_by
{
|
k
,
v
|
v
}
# sort report by execution time
.
to_h
next
logger
.
warn
(
"Knapsack generated empty report for '
#{
name
}
', skipping upload!"
)
if
report
.
empty?
logger
.
info
(
"Uploading latest knapsack report '
#{
file
}
'"
)
...
...
qa/spec/spec_helper.rb
View file @
f5e22d6f
...
...
@@ -65,12 +65,14 @@ RSpec.configure do |config|
end
config
.
after
(
:suite
)
do
|
suite
|
QA
::
Tools
::
KnapsackReport
.
move_regenerated_report
if
QA
::
Runtime
::
Env
.
knapsack?
# If any tests failed, leave the resources behind to help troubleshoot
QA
::
Resource
::
ReusableProject
.
remove_all_via_api!
unless
suite
.
reporter
.
failed_examples
.
present?
end
config
.
append_after
(
:suite
)
do
QA
::
Tools
::
KnapsackReport
.
move_regenerated_report
if
QA
::
Runtime
::
Env
.
knapsack?
end
config
.
expect_with
:rspec
do
|
expectations
|
expectations
.
include_chain_clauses_in_custom_matcher_descriptions
=
true
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