-
Notifications
You must be signed in to change notification settings - Fork 3
/
fetch-roles
executable file
·56 lines (43 loc) · 1.25 KB
/
fetch-roles
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -eux
TMPDIR='/tmp/dci-tmp-dir'
BASEDIR=$(pwd)
if [ $# -ne 2 ] || [ "$1" != "--rhgerrit-user" ]; then
echo "Missing '--rhgerrit-user <your_username>'"
exit 1
fi
RHGERRIT_USER=$2
get_repo() {
repo=${1}
roles=${2}
pushd ${TMPDIR}
git clone https://code.engineering.redhat.com/gerrit/${repo}.git ${repo}
cd ${repo}
branch="origin/master"
target=${BASEDIR}/roles/
mkdir -p ${target}
git checkout ${branch}
if [ "${repo}" == "tripleo-quickstart-extras" ]; then
git review -x 824899
fi
for i in ${roles}; do
cp -av roles/${i} ${target}/${i}
done
git reset --hard
git clean -ffdx
popd
}
#
# main()
#
# Do some cleanup
rm -Rf ${TMPDIR} ${BASEDIR}/roles
mkdir -p ${TMPDIR}
# Fetch the required roles into each release folder
get_repo tripleo-quickstart "common tripleo-inventory"
get_repo tripleo-quickstart-extras "extras-common validate-tempest"
# We're using the same collect-logs role for all versions, keep only the latest one
git clone --depth=1 --branch=master https://github.com/openstack/ansible-role-collect-logs "${BASEDIR}"/roles/collect-logs
rm -rf "${BASEDIR}"/roles/collect-logs/.git
# Finally add everything to staged area for review before commiting
git add roles