List of available backups is printed inconsistently by command "gitlab-backup restore" and rake task gitlab:backup:restore

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.

I propose to modify 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.

Steps to reproduce

  1. Start GitLab, for example with the GitLab Development Toolkit (GDK) or GitPod
    $ gdk start
  2. Create two or more GitLab backups with rake task gitlab:backup:create (In the example below, I create three backups with a bash 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
  3. Run rake task gitlab:backup:restore (without parameter BACKUP) to list backup timestamps
    $ gdk rails gitlab:backup:restore

Actual 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

Expected 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
Edited by Daniel Schömer