diff --git a/update.sh b/update.sh index 08b006b29d03d62218031080591dfa3f9cc8deaa..69ccbc3447eff2961ef3fb7455836b3484e64642 100755 --- a/update.sh +++ b/update.sh @@ -1,20 +1,50 @@ #!/bin/bash # This intended for updating the tested repos and their dependencies to the -# latest versions before running the integration test. +# latest versions before running the integration test. All runtime options are +# set via environemnt variables: +# defaultBranch sets branch to use for all projects +# clientBranch sets branch to use for the client repository +# serverBranch sets branch to use for the server repository +# gatewayBranch sets branch to use for the gateway repository +# udbBranch sets branch to use for the user-discovery-bot repository +# regBranch sets branch to use for the registration repository + +# Default branch to use when no explicit project branch is set. If not set, then +# it defaults to "master". +default="${defaultBranch-"master"}" + +# Array of project names. +project_arr=( + client + server + gateway + user-discovery-bot + registration +) + +# Array of each project's branch. If a branch is not explicitly set via an +# environemnt variable, then it defaults to defaultBranch. +branch_arr=( + "${clientBranch-$default}" + "${serverBranch-$default}" + "${gatewayBranch-$default}" + "${udbBranch-$default}" + "${regBranch-$default}" +) update() { git stash git clean -ffdx - git checkout master + git checkout "$1" git pull - glide cc && glide up + glide cache-clear && glide update } -for DIR in client server gateway user-discovery-bot registration; do - echo $DIR - pushd $GOPATH/src/gitlab.com/elixxir/client - update +for ((i=0; i<${#project_arr[@]}; ++i)); do + printf "\n\033[1m%s\033[0m\n" "${project_arr[i]}" + pushd "$GOPATH"/src/gitlab.com/elixxir/client || exit + update "${branch_arr[i]}" go test ./... - popd + popd || exit done