Created
January 11, 2019 11:22
-
-
Save soltysh/eed7c9d74a16abacd2297f280375b9dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#exit 1 | |
kube="${GOPATH}/src/k8s.io/kubernetes" | |
for repo in $(ls "${kube}/staging/src/k8s.io" | grep sample-controller); 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.4; then | |
git branch -D origin-4.0-kubernetes-1.12.4 | |
fi | |
git checkout -b origin-4.0-kubernetes-1.12.4 kubernetes-1.12.4 || continue | |
# push | |
git push -u openshift origin-4.0-kubernetes-1.12.4 | |
# push tag | |
git push openshift kubernetes-1.12.4:kubernetes-1.12.4 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment