diff --git a/sync-all-repos b/sync-all-repos index 40c2f11..ac4cfa5 100755 --- a/sync-all-repos +++ b/sync-all-repos @@ -8,6 +8,16 @@ fi set -e +pullpush_repo() { + repo=$1 + echo $repo + if [ ! -d $repo ]; then echo "Repo $repo does not exist, skipping"; return; fi + + cd $repo + git pull + git push +} + update_repo() { repo=$1 echo $repo @@ -36,27 +46,23 @@ update_repo() { REPOLIST="$HOME/.ctt $HOME/bin $HOME/vcs/notes $HOME/vcs/nico-dot-cdist $HOME/vcs/cdist-workdir/dot-cdist $HOME/vcs/ansible-main" REPOLIST2="$REPOLIST $HOME/.password-store" +PULL_PUSH_REPOS="$HOME/vcs/k8s-config/ $HOME/vcs/ansible-main/" + # First in parallel, then en sequence to spot errors for repo in ${REPOLIST}; do ( update_repo $repo & ) ; done +for repo in ${PULL_PUSH_REPOS}; do ( pull_repo $repo & ) ; done + echo "Waiting for async process to finish ..." wait exit 0 +################################################################################ +# Old stuff skipped atm + echo "Starting for sync process ..." - for repo in ${REPOLIST}; do update_repo $repo ; done - -# Repos we want to sync, but don't want to update the working tree -for repo in \ - ~/vcs/k8s-config/ \ - ~/vcs/ansible-main/ \ - ; do - echo $repo - cd $repo - git pull - git push -done +for repo in ${PULL_PUSH_REPOS}; do pull_repo $repo ; done # Step 2: pull/push all other repos in ~/vcs/ # We cannot commit as we do not know the state, but we