Closed jclusso closed 1 year ago
What exactly do you mean by that? Like cloning the repository and adding the clone date and time to the path? /clone-path/repo-$DATE
Or creating a zip file with the date after the cloning is done
Both would be great! If path was evaluated one could do anything they want regarding date and time control.
Having a compressed or zip option would be awesome for storage savings too if you could have it compress each repo. Having each one separate would be ideal vs one big zip.
We were just going to dump everything in a folder that's mounted to AWS S3 but right now we'd have to do some post processing in a separate script or something and can't use your built in cron .
Ex: /backup/2023/01/06/github.com/username/repo.zip
I really like this idea. I'll look into it
I just added the function to add the date to the backup path. I used the same structure as in your example. it's in the time_to_path_and_zip branch, if you want to try it out.
Awesome! Building from source now!
@cooperspencer I think that does the trick. I'm debating if we should add the time, but I'm not sure if that's overkill on this. I just tried it out and I can't decide.
Having daily backups probably suffices for my usecase, but I don't know about others. I think that if time was included it would be best to have date
like you have and time
as another option. If you don't think it's necessary I completely understand! This change is huge as it is. I would've made a PR myself, but I don't really know any Go and wasn't sure where to start looking here.
Looking forward to the zip functionality!
just pushed the zip functionality. regarding date, I am thinking about adding date to the zip-file and maybe also add a keep parameter to delete old backups.
@cooperspencer I'm indifferent as long as the functionality is there. How would the keep parameter work? I was just going to rely on an S3 policy to delete old files that were older than a certain date, but if you did something that was like keep the last X number backups that would simplify things!
That's what I planned. It would be like keep X backups
That sounds great! Zip works nicely too.
Awesome! I'll add the keep
parameter tomorrow. I'll keep you posted
@jclusso Just implemented the keep
parameter. It just keeps X backups
I might remove the date
parameter again. I think it is sufficient to have the keep
option because it adds the unix timestamp to the backup path.
What about something like this with keep enabled and no date option.
/backup-path/github.com/[repo-name]/[timestamp].git
This sounds good
@jclusso just removed the date
parameter and implemented that keep
creates a directory/zip file with the timestamp as name.
/backup-path/github.com/[owner]/[repo-name]/[timestamp]
@cooperspencer nice! Appears to work as expected!
released with v0.10.10
I'm confused how this is really considered a backup without this functionality. If any repository is compromised and receives a bad commit of some sort, the backup will reflect that rendering it useless. It would be nice if
path
was evaluated so you could include the date in it some how.