-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·37 lines (29 loc) · 902 Bytes
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# deploy.sh: deploy a new version of our puppet environment from git
#
# Merges r10k and other repositories for private stuff
#
set -e
PUPPET_ENV_PATH=$(puppet config print environmentpath)
declare -A GIT_REPOS_TO_MERGE
GIT_REPOS_TO_MERGE+=(
["data/private"]="[email protected]:infra-private/puppet-swh-private-data.git"
)
GIT=/usr/bin/git
/usr/bin/r10k deploy environment -p "$@"
for environmentdir in $PUPPET_ENV_PATH/*; do
pushd $environmentdir
for dest in ${!GIT_REPOS_TO_MERGE[@]}; do
if [ -d $dest/.git ]; then
pushd $dest
$GIT remote set-url origin ${GIT_REPOS_TO_MERGE[${dest}]}
$GIT reset --hard HEAD
$GIT pull
popd
else
$GIT clone ${GIT_REPOS_TO_MERGE[${dest}]} $dest
fi
done
popd
done
cp $PUPPET_ENV_PATH/production/deploy.sh /usr/local/bin