aboutsummaryrefslogtreecommitdiff
path: root/node/lava-submit
blob: d3e7a1155977db9f75bfb31326b507319e2bcf7d (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
#!/bin/bash

###############################################################################
# Copyright (c) 2011 Linaro
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################

set -xe

if [ -z "$LAVA_SUBMIT" || "$LAVA_SUBMIT" == 0]; then
    exit;
fi


BUILD_SCRIPT_ROOT=$(readlink -f "$(dirname "${0}")/../build-scripts")

cd build
sudo -E -H -u jenkins-build bash -xes "${BUILD_SCRIPT_ROOT}" "$@" <<\EOF
export BUILD_SCRIPT_ROOT="${1}"
export CONFIGURATION="$(echo "${2}" | base64 -id)"
set -a
eval "$CONFIGURATION"
set +a

if ! "${BUILD_SCRIPT_ROOT}"/post-build-lava.py; then
    if [ "$LAVA_SUBMIT_FATAL" != "0" ]; then
        exit 1
    else
        echo "warning: LAVA submission failed"
    fi
fi

EOF