-
Notifications
You must be signed in to change notification settings - Fork 4
CodeCommit
This page runs through the why and the how of having a Github backup.
A noted risk for Notify is if Github is unavailable then Notify cannot be deployed. This work aims to mitigate that risk. CodeCommit (CC) is intended as a break-glass replacement for Github and not for a 'normal' development process. See limitations for further details.
Concourse has a job which runs daily which syncs Github's main branch of each in-use Notify repo to the main branch of this repo within CodeCommit (CC).
NOTE: You can re use your existing SSH key with CC, if it is RSA. If not then you must create a new one.
- Create a new key with no passkey
ssh-keygen -t rsa -b 2048 -C "your_work_email@example.com"- Copy the public key. This assumes default location and name.
cat ~/.ssh/id_rsa.pub | pbcopy-
Add your Github username and public key here, merge the change and note down your SSH key ID.
-
Add your new ssh key to your ssh config file.
vi ~/.ssh.config
# You should currently have this
Host github.com
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
# Add this
Host git-codecommit.*.amazonaws.com
User <SSH Key ID in your IAM user>
IdentityFile ~/.ssh/id_rsa- Check you can interact with CC
ADD CODE HERE - Currently untested.Needs testing
NOTE: you only need to do this for the repos you want to push to.
-
Go to the desired repo which already exists locally e.g.
notifications-antivirus -
Set up the remote
git remote add codecommit ssh://git-codecommit.eu-west-2.amazonaws.com/v1/repos/notifications-antivirus- Check you can push to the remote
git push codecommitEngineers currently sign into Concourse using Github SSO. We must instead sign in using... TBC
CC will only be used for pushing to in the event that GH is down and we need to make an emergency deploy.
CC use is intended to be used for deploying only emergency fixes in the case that Github is down.
CC does not allow demo images to be built, meaning that any merges will be tested for the first time in when they hit the staging pipeline. There are no plans for CC to be a wholesale replacement for GH.
- You must pause the Github sync repos job
- etc
- Manually create a PR from any CC repos which have had new commits to
mainin the time when GH was down and merge. - Unpause the Github sync repos job.
This will often return you the error send-pack: unexpected disconnect while reading sideband packet fatal: the remote end hung up unexpectedly.
To overcome this use git tag | head -500 | xargs git push <codecommit remote name>.
Start with head -500 then increase this by 500 and re run the command. Eventually you will have pushed all tags. At the time of writing there are over 5000 tags.
If you are pushing with HTTPS then use git-remote-connect as this works better then just HTTPS.
- Q: Which repos are kept in-sync? A: Defined here