Skip to content

Instantly share code, notes, and snippets.

@logan2211
Created October 13, 2017 14:15
Show Gist options
  • Save logan2211/528a7fd661e759181875d6edf4dd7c3f to your computer and use it in GitHub Desktop.
Save logan2211/528a7fd661e759181875d6edf4dd7c3f to your computer and use it in GitHub Desktop.
ceph-ansible role breakout update job
#!/bin/bash
set -x -e
function abort_filter {
git checkout master
git branch -D $1
}
sudo apt-get update && sudo apt-get install -y openssh-client git
mkdir -m 0700 ~/.ssh || true
ssh-keyscan -t rsa git.lstn.net >> ~/.ssh/known_hosts
git config push.followTags true
STABLE_BRANCHES=$(git ls-remote --heads origin | grep refs/heads/stable- | awk '{ print $2 }' | sed 's#^refs/heads/##g')
for ROLE in common docker-common mon osd rgw defaults mgr config fetch-keys; do
git checkout master
git reset --hard origin/master
git pull origin --tags
git remote add $ROLE git@git.lstn.net:mirror/ansible-ceph-$ROLE.git
for BRANCH in master $STABLE_BRANCHES; do
git checkout -B $BRANCH origin/$BRANCH
git filter-branch -f --prune-empty --subdirectory-filter roles/ceph-$ROLE $BRANCH || abort_filter $BRANCH
done
for TAG in $(git tag -l); do
git filter-branch -f --prune-empty --subdirectory-filter roles/ceph-$ROLE $TAG || continue
done
git push --all $ROLE
git push --tags $ROLE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment