Merge "bug fix: Rally duration not correct due to result format change"
[releng.git] / jjb / armband / build.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2016 Ericsson AB and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 set -o errexit
10 set -o nounset
11 set -o pipefail
12
13 cd $WORKSPACE
14
15 # get current SHA1
16 CURRENT_SHA1=$(git rev-parse HEAD)
17
18 # log info to console
19 echo "Starting the build of Armband. This could take some time..."
20 echo "-----------------------------------------------------------"
21 echo
22
23 # set OPNFV_ARTIFACT_VERSION
24 if [[ "$JOB_NAME" =~ "merge" ]]; then
25     echo "Building Fuel ISO for a merged change"
26     export OPNFV_ARTIFACT_VERSION="gerrit-$GERRIT_CHANGE_NUMBER"
27     echo "Not supported"
28     exit 1
29 else
30     export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
31 fi
32
33 NOCACHE_PATTERN="verify: no-cache"
34 if [[ "$JOB_NAME" =~ "verify" && "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "$NOCACHE_PATTERN" ]]; then
35     echo "The cache will not be used for this build!"
36     NOCACHE_ARG="-f P"
37 fi
38 NOCACHE_ARG=${NOCACHE_ARG:-}
39
40 # start the build
41 cd $WORKSPACE/ci
42 ./build.sh $BUILD_DIRECTORY
43
44 # list the build artifacts
45 ls -al $BUILD_DIRECTORY
46
47 # save information regarding artifact into file
48 (
49     echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
50     echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
51     echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
52     echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
53     echo "OPNFV_BUILD_URL=$BUILD_URL"
54 ) > $WORKSPACE/opnfv.properties
55
56 echo
57 echo "--------------------------------------------------------"
58 echo "Done!"