Last active
September 7, 2020 14:14
Airship repositories updater
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 | |
# Pulls/updates local Airship repositories | |
airship_git_repo_root="https://opendev.org/airship" | |
airship_projects=( | |
'airshipctl' | |
'armada' | |
'berth' | |
'deckhand' | |
'divingbell' | |
'docs' | |
'drydock' | |
'election' | |
'governance' | |
'maas' | |
'pegleg' | |
'promenade' | |
'shipyard' | |
'specs' | |
'spyglass' | |
'spyglass-plugin-xls' | |
'tempest-plugin' | |
'treasuremap' | |
'utils' | |
) | |
function clone () { | |
for p in "${airship_projects[@]}"; do | |
if [[ "${1}" == "-f" ]]; then | |
echo "Removing "airship-${p}" directory" | |
rm -rf ./"airship-${p}" | |
fi | |
echo "Cloning project: "${p}"" | |
git clone "${airship_git_repo_root}"/"${p}".git "${p}" & | |
done | |
} | |
function update () | |
{ | |
for p in "${airship_projects[@]}"; do | |
echo "Updating project: "airship-${p}"" | |
pushd "airship-${p}" | |
git remote update | |
git checkout master | |
git pull --ff-only origin master | |
popd | |
done | |
} | |
function usage () | |
{ | |
echo "Usage: $(basename "$0") [-h] {clone [-f]|update}" 1>&2 | |
echo " -h this help" 1>&2 | |
echo " clone [-f] clone all Airship projects; -f removes project directories before cloning" 1>&2 | |
echo " update update all Airship projects" 1>&2 | |
} | |
# See how we were called. | |
case "${1}" in | |
"clone" ) clone "${2}";; | |
"update" ) update;; | |
"-h"|* ) usage; exit 1;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment