7c6cb60dbd97548b664cab5ffefa1a67e894391f
[fuel.git] / build / fuel_build_loop
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 LATEST_MIRROR_ID_URL=http://mirror.seed-cz1.fuel-infra.org
13
14 LATEST_TARGET_UBUNTU=$(curl -sSf "${LATEST_MIRROR_ID_URL}/mos-repos/ubuntu/8.0.target.txt" | head -1)
15 export MIRROR_MOS_UBUNTU_ROOT="/mos-repos/ubuntu/${LATEST_TARGET_UBUNTU}"
16
17 LATEST_TARGET_CENTOS=$(curl -sSf "${LATEST_MIRROR_ID_URL}/mos-repos/centos/mos8.0-centos7-fuel/os.target.txt" | head -1)
18 export MIRROR_FUEL="${LATEST_MIRROR_ID_URL}/mos-repos/centos/mos8.0-centos7-fuel/${LATEST_TARGET_CENTOS}/x86_64"
19
20 echo "MIRROR_MOS_UBUNTU_ROOT=${MIRROR_MOS_UBUNTU_ROOT}"
21 echo "MIRROR_FUEL=${MIRROR_FUEL}"
22
23 maxcount=10
24 cnt=0
25 rc=1
26 while [ $cnt -lt $maxcount ] && [ $rc -ne 0 ]
27 do
28     cnt=$[cnt + 1]
29     echo -e "\n\n\n*** Starting build attempt # $cnt"
30     cd /tmp/fuel-main
31     make clean
32     make iso
33     rc=$?
34     if [ $rc -ne 0 ]; then
35         echo "### Build failed with rc $rc ###"
36     else
37         echo "### Build successful at attempt # $cnt"
38     fi
39 done
40 exit $rc