Skip to content

Instantly share code, notes, and snippets.

@soltysh
Created November 8, 2018 09:51
Show Gist options
  • Save soltysh/526e0fda32e322ac08128a0e300b9052 to your computer and use it in GitHub Desktop.
Save soltysh/526e0fda32e322ac08128a0e300b9052 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#exit 1
kube="${GOPATH}/src/k8s.io/kubernetes"
for repo in $(ls "${kube}/staging/src/k8s.io"); do
echo ====================
echo $repo
echo ====================
cd "${GOPATH}/src/k8s.io"
# clone if needed
if [[ ! -d $repo ]]; then
git clone -o openshift git@github.com:openshift/kubernetes-$repo.git $repo || continue
fi
# enter
cd $repo || continue
# add upstreams if needed
if ! git remote | grep openshift; then
git remote add openshift git@github.com:openshift/kubernetes-$repo.git
fi
if ! git remote | grep upstream; then
git remote add upstream https://github.com/kubernetes/$repo.git
fi
# fetch
git fetch openshift --tags || continue
git fetch upstream --tags || continue
git checkout master
# create branch
if git branch | grep origin-4.0-kubernetes-1.12.2; then
git branch -D origin-4.0-kubernetes-1.12.2
fi
git checkout -b origin-4.0-kubernetes-1.12.2 kubernetes-1.12.2 || continue
# push
git push -u openshift origin-4.0-kubernetes-1.12.2
# push tag
git push openshift kubernetes-1.12.2:kubernetes-1.12.2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment