summaryrefslogtreecommitdiffstats
path: root/ci/build_rpm/build_rpms_docker.sh
blob: 9b2454d5a1c1fcb93cce52998c6bbbea4799394b (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
#!/bin/bash

OPNFV_ARTIFACT_VERSION=$1
rpm_build_dir=/opt/escalator
rpm_output_dir=$rpm_build_dir/build_output
tmp_rpm_build_dir=/root/escalator

cp -r $rpm_build_dir $tmp_rpm_build_dir
cd $tmp_rpm_build_dir

echo "#########################################################"
echo "               systemctl info:                   "
echo "#########################################################"
echo "###Uname: $(uname)"
echo "###Hostname: $(hostname)"

maxcount=3
cnt=0
rc=1
while [ $cnt -lt $maxcount ] && [ $rc -ne 0 ]
do
    cnt=$[cnt + 1]
    echo -e "\n\n\n*** Starting build attempt # $cnt"

    cd api
    python setup.py sdist

    cd ..
    cd client
    python setup.py sdist

    echo "######################################################"
    echo "          done              "
    echo "######################################################"
    if [ $rc -ne 0 ]; then
        echo "### Build failed with rc $rc ###"
    else
        echo "### Build successfully at attempt # $cnt"
    fi
done
cd $rpm_output_dir
mkdir upload_artifacts
cp api/dist/escalator-* $rpm_output_dir/upload_artifacts
cp client/dist/escalatorclient-* $rpm_output_dir/upload_artifacts
tar zcvf opnfv-$OPNFV_ARTIFACT_VERSION.tar.gz upload_artifacts
exit $rc