Why? Jenkins (not that I remember much about it) is for CI/CD not backing up other stuff. And GitLab comes with gitlab-backup that makes a nice backup, and configuration options for running it periodically and for removing backups made using it that have reached a certain age - the check of old backups happens after it has taken a new, so you need space for one more backup than you wish to keep, and as taking a new backup might be faster (it might also be slower, but thatβs not an issue here) than taking the one you want to delete did, be aware that the old backup might not be n*86400 seconds (86400 is the number of seconds in a day).
The documentation on taking backups is quite good, and also covers a lot of what needs to be done alternatively, so you should read that.
replace $BACKUPDIR with the location of your tar files, and change ctime +1 to for example +30 to delete over 30 days of backups.
In fact I use something like this (some of it depends on the distro I use Debian/Ubuntu hence dpkg command for getting version info this would have to be substituted with yum/rpm on a RHEL based distro):