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
463775cb
Commit
463775cb
authored
Mar 16, 2022
by
Tiffany Rea
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove default file pattern value
parent
f52ed489
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
qa/Rakefile
qa/Rakefile
+5
-6
qa/qa/tools/test_resources_handler.rb
qa/qa/tools/test_resources_handler.rb
+6
-7
No files found.
qa/Rakefile
View file @
463775cb
...
...
@@ -67,19 +67,18 @@ end
namespace
:test_resources
do
desc
"Deletes resources created during E2E test runs"
task
:delete
,
:file_pattern
do
|
t
,
args
|
args
.
with_defaults
(
file_pattern:
QA
::
Runtime
::
Env
.
test_resources_created_filepath
)
task
:delete
,
[
:file_pattern
]
do
|
t
,
args
|
QA
::
Tools
::
TestResourcesHandler
.
new
(
args
[
:file_pattern
]).
run_delete
end
desc
"Upload test resources JSON files to GCS"
task
:upload
,
[
:file_pattern
,
:
environmen
t_name
]
do
|
t
,
args
|
QA
::
Tools
::
TestResourcesHandler
.
new
(
args
[
:file_pattern
]).
upload
(
args
[
:
environmen
t_name
])
task
:upload
,
[
:file_pattern
,
:
ci_projec
t_name
]
do
|
t
,
args
|
QA
::
Tools
::
TestResourcesHandler
.
new
(
args
[
:file_pattern
]).
upload
(
args
[
:
ci_projec
t_name
])
end
desc
"Download test resources JSON files from GCS"
task
:download
,
[
:
environmen
t_name
]
do
|
t
,
args
|
QA
::
Tools
::
TestResourcesHandler
.
new
.
download
(
args
[
:
environmen
t_name
])
task
:download
,
[
:
ci_projec
t_name
]
do
|
t
,
args
|
QA
::
Tools
::
TestResourcesHandler
.
new
.
download
(
args
[
:
ci_projec
t_name
])
end
end
# rubocop:enable Rails/RakeEnvironment
qa/qa/tools/test_resources_handler.rb
View file @
463775cb
...
...
@@ -5,16 +5,15 @@ require "fog/google"
# This script handles resources created during E2E test runs
#
# Delete: find all matching file pattern, read file and delete resources
# rake test_resources:delete
# rake test_resources:delete[<file_pattern>]
#
# Upload: find all matching file pattern for failed test resources
# upload these files to GCS bucket `failed-test-resources` under specific environment name
# rake test_resources:upload[<file_pattern>,<
environmen
t_name>]
# rake test_resources:upload[<file_pattern>,<
ci_projec
t_name>]
#
# Download: download JSON files under a given environment name (bucket directory)
# save to local under `tmp/`
# rake test_resources:download[<
environmen
t_name>]
# rake test_resources:download[<
ci_projec
t_name>]
#
# Required environment variables:
# GITLAB_ADDRESS, required for delete task
...
...
@@ -61,11 +60,11 @@ module QA
# Files are organized by environment in which tests were executed
#
# E.g: staging/failed-test-resources-<randomhex>.json
def
upload
(
environmen
t_name
)
def
upload
(
ci_projec
t_name
)
return
puts
"
\n
Nothing to upload!"
if
files
.
empty?
files
.
each
do
|
file
|
file_name
=
"
#{
environmen
t_name
}
/
#{
file
.
split
(
'/'
).
last
}
"
file_name
=
"
#{
ci_projec
t_name
}
/
#{
file
.
split
(
'/'
).
last
}
"
Runtime
::
Logger
.
info
(
"Uploading
#{
file_name
}
..."
)
gcs_storage
.
put_object
(
BUCKET
,
file_name
,
File
.
read
(
file
))
end
...
...
@@ -75,8 +74,8 @@ module QA
# Download files from GCS bucket by environment name
# Delete the files afterward
def
download
(
environmen
t_name
)
files_list
=
gcs_storage
.
list_objects
(
BUCKET
,
prefix:
environmen
t_name
).
items
.
each_with_object
([])
do
|
obj
,
arr
|
def
download
(
ci_projec
t_name
)
files_list
=
gcs_storage
.
list_objects
(
BUCKET
,
prefix:
ci_projec
t_name
).
items
.
each_with_object
([])
do
|
obj
,
arr
|
arr
<<
obj
.
name
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