Update output of backup timestamps of rake task gitlab:backup:restore
What does this MR do and why?
GitLab Omnibus command gitlab-backup restore
and rake task gitlab:backup:restore
restore a previously created GitLab backup.
If multiple GitLab backups exist in the backup directory, it is required to provide the timestamp of the backup to restore.
If the timestamp of the backup to restore is not given with multiple backups in the backup directory, the command and rake task print the timestamps of all backups in the backup directory.
The output of the timestamps is a bit difficult to read:
The first timestamp is printed prefixed with the current date and time.
The second and subsequent backup timestamps are printed without the current date and time prefix.
With this MR (related to #404897 (closed)), I propose a modification of the output of the second and subsequent backup timestamps to be prefixed with the current date and time, as it is done for the first backup timestamp.
The output of the available backup timestamps of rake task gitlab:backup:restore
is defined in lib/backup/manager.rb line 440.
Screenshots or screen recordings
This MR is changing the output of command line commands gitlab-backup restore
and rake task gitlab:backup:restore
. Please see the below for examples of the pre-MR and post-MR output.
How to set up and validate locally
- Start GitLab, for example with the GitLab Development Toolkit (GDK) or GitPod
$ gdk start
- Create two or more GitLab backups with rake task
gitlab:backup:create
(In the example below, I create three backups with abash
for loop.)$ for INDEX in {1..3}; do gdk rails gitlab:backup:create ; done [...] 2023-04-05 19:02:59 UTC -- Backup 1680721373_2023_04_05_15.11.0-pre is done. [...] 2023-04-05 19:03:20 UTC -- Backup 1680721395_2023_04_05_15.11.0-pre is done. [...] 2023-04-05 19:03:41 UTC -- Backup 1680721416_2023_04_05_15.11.0-pre is done.
$ ls -lh tmp/backups/ -rw-------@ 1 daniel staff 91M 5 Apr 21:02 1680721373_2023_04_05_15.11.0-pre_gitlab_backup.tar -rw-------@ 1 daniel staff 91M 5 Apr 21:03 1680721395_2023_04_05_15.11.0-pre_gitlab_backup.tar -rw-------@ 1 daniel staff 91M 5 Apr 21:03 1680721416_2023_04_05_15.11.0-pre_gitlab_backup.tar
- Run rake task
gitlab:backup:restore
(without parameterBACKUP
) to list backup timestamps$ gdk rails gitlab:backup:restore
Pre-MR result
The first backup timestamp is printed prefixed by the current date and time. Subsequent backup timestamps are printed without the current date and time.
$ gdk rails gitlab:backup:restore
2023-04-05 19:08:42 UTC -- Found more than one backup:
2023-04-05 19:08:42 UTC -- 1680721373_2023_04_05_15.11.0-pre
1680721395_2023_04_05_15.11.0-pre
1680721416_2023_04_05_15.11.0-pre
2023-04-05 19:08:42 UTC -- Please specify which one you want to restore:
2023-04-05 19:08:42 UTC -- rake gitlab:backup:restore BACKUP=timestamp_of_backup
2023-04-05 21:08:42 +0200 -- Deleting backup and restore lock file
Post-MR result
Each backup timestamp is printed prefixed by the current date and time.
$ gdk rails gitlab:backup:restore
2023-04-05 19:11:54 UTC -- Found more than one backup:
2023-04-05 19:11:54 UTC -- 1680721373_2023_04_05_15.11.0-pre
2023-04-05 19:11:54 UTC -- 1680721395_2023_04_05_15.11.0-pre
2023-04-05 19:11:54 UTC -- 1680721416_2023_04_05_15.11.0-pre
2023-04-05 19:11:54 UTC -- Please specify which one you want to restore:
2023-04-05 19:11:54 UTC -- rake gitlab:backup:restore BACKUP=timestamp_of_backup
2023-04-05 21:11:54 +0200 -- Deleting backup and restore lock file
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #404897 (closed)