Add Rake task to show/edit token expiration info
What does this MR do and why?
This merge request adds two Rake tasks:
gitlab:tokens:analyzegitlab:tokens:edit
Both tasks give a readout to the admin about:
-
When the migration in 16.0 for #369123 (closed) started and finished
-
The top 10 expiration dates (!157782 (merged)) #467313 (closed)
There should be a strong correlation with the migration dates and the
expiration dates. Seeing both of them together helps focus on the
tokens that were assigned an expires_at field in the background
migration.
The second task allows admins to easily update the groups to either extend or remove the expiration date entirely.
Relates to #467313 (closed) and #467416 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
rake gitlab:tokens:analyze
rake gitlab:tokens:edit
How to set up and validate locally
I seed my database this way:
expiry = Date.parse('2024-06-14')
user = User.find(1)
1_000_000.times.each do |index|
token = PersonalAccessToken.new(name: "random-#{index}", expires_at: expiry, user: user, scopes: ["api"])
token.save
end
Then run gitlab rake gitlab:tokens:edit.

