LAVA: update canary job to 2.8.6
[lttng-ci.git] / scripts / system-tests / check-build-needs.sh
CommitLineData
b3d73c46
FD
1#!/bin/bash -xeu
2# Copyright (C) 2016 - Francis Deslauriers <francis.deslauriers@efficios.com>
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17mkdir -p "$DEPLOYDIR"
18
19NEED_MODULES_BUILD=0
20NEED_KERNEL_BUILD=0
21
22set +e
23$SSH_COMMAND "$STORAGE_USER@$STORAGE_HOST" ls "$STORAGE_KERNEL_IMAGE"
24if [ $? -ne 0 ]; then
25 NEED_KERNEL_BUILD=1
26 # We need to build the lttng modules if the kernel has changed.
27 NEED_MODULES_BUILD=1
28fi
29
6d5c3948 30$S3_COMMAND info "s3://$S3_STORAGE_KERNEL_IMAGE"
6252703b
JR
31if [ $? -ne 0 ]; then
32 NEED_KERNEL_BUILD=1
33 # We need to build the lttng modules if the kernel has changed.
34 NEED_MODULES_BUILD=1
35fi
36
b3d73c46
FD
37$SSH_COMMAND "$STORAGE_USER@$STORAGE_HOST" ls "$STORAGE_LTTNG_MODULES"
38if [ $? -ne 0 ]; then
39 NEED_MODULES_BUILD=1
40fi
6252703b 41
6d5c3948 42$S3_COMMAND info "s3://$S3_STORAGE_LTTNG_MODULES"
6252703b
JR
43if [ $? -ne 0 ]; then
44 NEED_MODULES_BUILD=1
45fi
46
b3d73c46
FD
47set -e
48
49# We need to fetch the kernel source and lttng-modules to build either the
50# kernel or modules
51if [ $NEED_MODULES_BUILD -eq 1 ] || [ $NEED_KERNEL_BUILD -eq 1 ] ; then
6d2d0c69
JR
52 mkdir -p "$LINUX_PATH"
53 pushd "$LINUX_PATH"
54 git init
55 git remote add origin "$KGITREPO"
56 git fetch --depth 1 origin "$KERNEL_COMMIT_ID"
57 git checkout FETCH_HEAD
58 popd
b3d73c46 59
b33f21f4 60 cp src/lttng-ci/lava/kernel/vanilla/x86_64_server.config "$LINUX_PATH/.config"
b3d73c46 61 make --directory="$LINUX_PATH" olddefconfig
dc9700c9
FD
62
63 if [ $BUILD_DEVICE = 'kvm' ] ; then
64 make --directory="$LINUX_PATH" kvmconfig
65 fi
66
41725171 67 make --directory="$LINUX_PATH" modules_prepare
b3d73c46
FD
68fi
69
70#We create files to specify what needs to be built for the subsequent build steps
71if [ $NEED_MODULES_BUILD -eq 0 ] ; then
72 touch modules-built.txt
73fi
74if [ $NEED_KERNEL_BUILD -eq 0 ] ; then
75 touch kernel-built.txt
76fi
This page took 0.025306 seconds and 4 git commands to generate.