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
6d2fe745
Commit
6d2fe745
authored
Mar 02, 2022
by
Mark Lapierre
Committed by
Anastasia McDonald
Mar 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use token with admin access to delete test users
parent
848a02bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
qa/qa/tools/delete_test_users.rb
qa/qa/tools/delete_test_users.rb
+5
-5
No files found.
qa/qa/tools/delete_test_users.rb
View file @
6d2fe745
...
...
@@ -5,8 +5,8 @@
# - If `dry_run` is true the script will list the users to be deleted by username, but it won't delete them
# - Specify `exclude_users` as a comma-separated list of usernames to not delete.
#
# Required environment variables: GITLAB_QA_ACCESS_TOKEN and GITLAB_ADDRESS
# - GITLAB_QA_ACCESS_TOKEN must have admin API access
# Required environment variables: GITLAB_QA_A
DMIN_A
CCESS_TOKEN and GITLAB_ADDRESS
# - GITLAB_QA_A
DMIN_A
CCESS_TOKEN must have admin API access
module
QA
module
Tools
...
...
@@ -19,9 +19,9 @@ module QA
def
initialize
(
delete_before:
(
Date
.
today
-
1
).
to_s
,
dry_run:
'false'
,
exclude_users:
nil
)
raise
ArgumentError
,
"Please provide GITLAB_ADDRESS"
unless
ENV
[
'GITLAB_ADDRESS'
]
raise
ArgumentError
,
"Please provide GITLAB_QA_A
CCESS_TOKEN"
unless
ENV
[
'GITLAB_QA
_ACCESS_TOKEN'
]
raise
ArgumentError
,
"Please provide GITLAB_QA_A
DMIN_ACCESS_TOKEN"
unless
ENV
[
'GITLAB_QA_ADMIN
_ACCESS_TOKEN'
]
@api_client
=
Runtime
::
API
::
Client
.
new
(
ENV
[
'GITLAB_ADDRESS'
],
personal_access_token:
ENV
[
'GITLAB_QA_ACCESS_TOKEN'
])
@api_client
=
Runtime
::
API
::
Client
.
new
(
ENV
[
'GITLAB_ADDRESS'
],
personal_access_token:
ENV
[
'GITLAB_QA_A
DMIN_A
CCESS_TOKEN'
])
@dry_run
=
!
FALSY_VALUES
.
include?
(
dry_run
.
to_s
.
downcase
)
@delete_before
=
Date
.
parse
(
delete_before
)
@page_no
=
'1'
...
...
@@ -29,7 +29,7 @@ module QA
end
def
run
puts
"Deleting users with a username starting with 'qa-user-' created before
#{
@delete_before
}
..."
puts
"Deleting users with a username starting with 'qa-user-'
or 'test-user-'
created before
#{
@delete_before
}
..."
while
page_no
.
present?
users
=
fetch_test_users
...
...
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