#git (2020-04)

All things git (except gitops)

2020-04-23

RB avatar
RB
01:47:56 PM

@RB has joined the channel

RB avatar

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?

ikar avatar

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
ikar avatar

you have to have a bare repo for that, maybe I’ll find some doc…

ikar avatar

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

RB avatar

how does the script run? is it a commit hook ?

RB avatar

how do you do this for an entire org on github ?

ikar avatar

we run that once per hour on a server

ikar avatar

for each repo separately

RB avatar

makes sense so when github is down or intermittent, are all of your remotes sent to the sync’ed mirror

RB avatar

how does the mirror switch between github and aws codecommit ?

RB avatar

and when things are committed to codecommit instead of github, how do you pull those changes back to github ?

RB avatar

or is codecommit only intended to be a readonly mirror ?

ikar avatar

yup, codecommit is just readonly mirror for cases you need to deploy

ikar avatar

quite interested in smarter solutions though

RB avatar

ah ok seems like a good fallback for readonly

RB avatar

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

¯_(ツ)_/¯

:--1:1

2020-04-21

Zachary Loeber avatar
Zachary Loeber

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.

2020-04-13

Zachary Loeber avatar
Zachary Loeber

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/

:--1:1

2020-04-10

Alan Jenkins avatar
Alan Jenkins
08:05:16 AM

@ has joined the channel

2020-04-08

Zachary Loeber avatar
Zachary Loeber

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?

    keyboard_arrow_up