Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

git - Delete Gitlab Backup Automatically

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.

question from:https://stackoverflow.com/questions/65932571/delete-gitlab-backup-automatically

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...