Restoring from a backup doesn't cleanup the backups directory
Summary
Restoring from a backup leaves behind the unpacked files and directories in the backup directory
Steps to reproduce
- Spin up a new environment
- Take a backup using the gitlab-backup create command
- Take a look at the backup location and observe the only file is the backup you just created are present
- Restore the backup using the restore process
- Take another look at the backup location and observe the unpacked tarball's contents are leftover in the directory
What is the current bug behavior?
Restoring a backup leaves the files it extracted from the tarball behind when it's done
What is the expected correct behavior?
The restore should clean up any files it untars in that directory
Relevant logs and/or screenshots
root@127:~# ls -lah /var/opt/gitlab/backups/
total 3.4M
drwx------ 4 git root 4.0K Dec 13 20:20 .
drwxr-xr-x 20 root root 4.0K Dec 13 19:52 ..
-rw------- 1 git git 320K Dec 13 19:57 1639425471_2021_12_13_14.4.1-ee_gitlab_backup.tar
-rw------- 1 git git 3.0M Dec 13 20:09 1639426193_2021_12_13_14.4.1-ee_gitlab_backup.tar
-rw------- 1 git git 146 Dec 13 20:09 artifacts.tar.gz
-rw-r--r-- 1 git git 192 Dec 13 20:09 backup_information.yml
-rw------- 1 git git 146 Dec 13 20:09 builds.tar.gz
drwxr-xr-x 2 git git 4.0K Dec 13 20:09 db
-rw------- 1 git git 146 Dec 13 20:09 lfs.tar.gz
-rw------- 1 git git 154 Dec 13 20:09 pages.tar.gz
drwx------ 3 git git 4.0K Dec 13 20:09 repositories
-rw------- 1 git git 306 Dec 13 20:09 uploads.tar.gz
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
root@127:~# gitlab-rake gitlab:env:info System information System: Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.4p191 Gem Version: 3.1.4 Bundler Version:2.1.4 Rake Version: 13.0.6 Redis Version: 6.0.16 Git Version: 2.33.0. Sidekiq Version:6.2.2 Go Version: unknown GitLab information Version: 14.4.1-ee Revision: abc23a14bac Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.7 URL: http://127.0.0.1 HTTP Clone URL: http://127.0.0.1/some-group/some-project.git SSH Clone URL: git@127.0.0.1:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 13.21.1 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git root@127:~#
Results of GitLab application Check
Expand for output related to the GitLab application check
root@127:~# gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.21.1 ? ... OK (13.21.1) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes 1/2 ... yes 1/3 ... yes 1/4 ... yes 1/5 ... yes 1/6 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.4) Git version >= 2.33.0 ? ... yes (2.33.0) Git user has default SSH configuration? ... yes Active users: ... 1 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
root@127:~#