aboutsummaryrefslogtreecommitdiff
path: root/scripts/BuildFarm.job
blob: a2e9166f3d86f99f6bd45f6174565340e376b8dc (plain)
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
57
#!/bin/bash
set -e

cat << EOF > ${WORKSPACE}/BUILD-INFO.txt
Format-Version: 0.5

Files-Pattern: *
License-Type: open
EOF

export CONFIG_SHELL="/bin/bash"
shared="/home/buildslave/workspace/shared"
abe_dir="$(dirname $0)/.."
user_snapshots="${WORKSPACE}/snapshots"
snapshots_ref="${shared}/snapshots"
fileserver="${fileserver:-148.251.136.42}"

mkdir -p ${snapshots_ref}/
rsync -az --update ${fileserver}:snapshots/ ${snapshots_ref}/
rm -rf ${snapshots_ref}/*~*

rm -rf ${WORKSPACE}/_build ${user_snapshots}

mkdir -p ${user_snapshots}/
rsync -a ${snapshots_ref}/infrastructure/ ${user_snapshots}/infrastructure/

case ${target} in
    schroot-*)
	schroot_arch=$(echo ${target} | sed -e "s/^schroot-\([^-]*\)-\(.*\)/\1/")
	target=$(echo ${target} | sed -e "s/^schroot-\([^-]*\)-\(.*\)/\2/")
	CONFIG_SHELL="schroot -c tcwg-build-${schroot_arch}-trusty --preserve-environment -- ${CONFIG_SHELL}"
	;;
esac

if test x"${bootstrap}" = x"true"; then
    bootstrap="--bootstrap"
else
    bootstrap=""
fi

rm -fr ${WORKSPACE}/_build
mkdir -p ${WORKSPACE}/_build

cd ${WORKSPACE}/_build
$CONFIG_SHELL -x ${abe_dir}/jenkins.sh --runtests -l ${languages} -f ${fileserver} ${release} ${bootstrap}${excludecheck:+ --excludecheck ${excludecheck}}

# force a failure of abe has build problems.
if test $? -gt 0; then
  exit 1
fi

# Leave source and build trees for *Farm jobs; delete for all other jobs
echo "JOB_NAME = ${JOB_NAME}"
case "${JOB_NAME}" in
    *"Farm"*) ;;
    *) rm -rf ${WORKSPACE}/_build ${user_snapshots} ;;
esac