All things git (except gitops)
@RB (Ronak) (Cloud Posse) has joined the channel
wish we had a github backup for when they have issues. if we had something that synchronized all of our org, we could have our remotes all point to that which would redirect to github, but if github was having issues, it would point to its own cache until the issues get resolved.
does anything like that exist?
we use simple script for backup to AWS CodeCommit:
$ cat git_sync.sh #!/bin/bash FAIL=true cd /home/ubuntu/$1 && git fetch origin --prune && git push --mirror && FAIL=false if $FAIL then /usr/local/bin/slack.sh "WARNING: hourly repository sync *failed!!!*..." "#alerts" fi
you have to have a bare repo for that, maybe I’ll find some doc…
extracted from ansible:
• you need to clone in mirror mode:
git clone --mirror URL
• and set second remote to the repo:
git remote set-url --push origin BACKUP_URL
how does the script run? is it a commit hook ?
how do you do this for an entire org on github ?
we run that once per hour on a server
for each repo separately
makes sense so when github is down or intermittent, are all of your remotes sent to the sync’ed mirror
how does the mirror switch between github and aws codecommit ?
and when things are committed to codecommit instead of github, how do you pull those changes back to github ?
or is codecommit only intended to be a readonly mirror ?
yup, codecommit is just readonly mirror for cases you need to deploy
quite interested in smarter solutions though
ah ok seems like a good fallback for readonly
ideally - mirror syncs ever 15 min every branch and repo in org
- all repos remote is set to urls that point to github
- github problem is detected, all repos remotes dont have to change, the urls now redirect to the mirror
- devs change code in branches, commit, push code
- devs still have access to pr system, comments, etc
- github is no longer having issues, system now syncs differences with github
- urls now redirect back to github
basically a github enterprise onprem lol
with some logic to sync it with the cloud solution
github being down for me right now is a bummer. God help those pipelines that have code that manually goes out and pulls resources from it as a regular (bad) practice. Pointed reminder to keep your build/deploy base containers cached in your container repos.
For those of you that mostly get gitflow but could use a visualization once in a while to grok the 10+ year old model that everyone seems smitten over: https://veerasundar.com/blog/2018/03/gitflow-animated/
@ has joined the channel
The way I’m understanding Go modules it appears that git tags are pretty much mandatory for any real projects, anyone care to tell me that is a misconception?