Delete Gitlab Backup Automatically

Viewed 714

Hello wonderful people,

I am new in gitlab, jenkins and all this.

I am taking backup of whole gitlab everything including projects, branches and everything in backup . tar file with the help of jenkins everyday automatically.

I want to delete the backup periodically. Like I want to delete the backup after every 30 days. I want the last backup to be deleted automatically.

Your help is highly appreciated.

1 Answers

First, as mentioned in this issue, if you uncomment gitlab_rails['backup_keep_time'] = 604800 in /etc/gitlab/gitlab.rb and reconfigure your GitLab, any backup command (like, For GitLab 12.2+, sudo gitlab-backup create) would delete old backups.

If you are able to ssh to your GitLab server, configure a Jenkins job which will execute that command

ssh <gitlabUSer>@gitlabServer sudo gitlab-backup create

Note: in your case, the setting backup_keep_time should be to to 2 592 000 (for 30 days instead of 7).

Related