Add Jerma in blacklist logics
[releng.git] / jjb / daisy4nfv / daisy4nfv-build-kolla-image.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 ZTE Coreporation and others.
4 # hu.zhijiang@zte.com.cn
5 # sun.jing22@zte.com.cn
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
13 set -o errexit
14 set -o nounset
15 set -o pipefail
16
17 upload_image_to_opnfv () {
18     image=$1
19
20     sha512sum -b $image > $image.sha512sum
21     gsutil cp $image.sha512sum gs://$GS_URL/upstream/$image.sha512sum
22
23     echo "Uploading $INSTALLER_TYPE artifact. This could take some time..."
24     echo
25     gsutil cp $image gs://$GS_URL/upstream/$image
26     gsutil -m setmeta \
27         -h "Cache-Control:private, max-age=0, no-transform" \
28         gs://$GS_URL/upstream/$image
29
30     # check if we uploaded the file successfully to see if things are fine
31     gsutil ls gs://$GS_URL/upstream/$image
32     if [[ $? -ne 0 ]]; then
33         echo "Problem while uploading artifact!"
34         exit 1
35     fi
36 }
37
38
39
40 echo "--------------------------------------------------------"
41 echo "This is diasy4nfv kolla image build job!"
42 echo "--------------------------------------------------------"
43
44 # start the build
45 cd $WORKSPACE
46 rm -rf docker_build_dir
47 mkdir -p docker_build_dir
48
49 # -j is for deciding which branch will be used when building,
50 # only for OPNFV
51 sudo -E ./ci/kolla-build.sh -j $JOB_NAME -w $WORKSPACE/docker_build_dir
52
53 if [ $? -ne 0 ]; then
54     echo
55     echo "Kolla build failed!"
56     deploy_ret=1
57 else
58     echo
59     echo "--------------------------------------------------------"
60     echo "Kolla build done!"
61 fi
62
63 image=$(ls $WORKSPACE/docker_build_dir/kolla-build-output/kolla-image-*.tgz)
64 upload_image_to_opnfv $image
65
66 echo
67 echo "--------------------------------------------------------"
68 echo "All done!"