Merge branch '21521-aptly-flock'
[arvados-dev.git] / jenkins / packer-images / jenkins-image-arvados-tests.sh
1 #!/bin/bash
2
3 # Copyright (C) The Arvados Authors. All rights reserved.
4 #
5 # SPDX-License-Identifier: Apache-2.0
6
7 set -eo pipefail
8
9 # Install the dependencies for arvados-server
10 sudo su -c "DEBIAN_FRONTEND=noninteractive apt-get install -y libpam0g-dev wget build-essential"
11
12 # Install docker (used in our tests and also for package building/testing)
13 sudo su -c "DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io make wget dpkg-dev createrepo-c unzip"
14 sudo usermod -a -G docker jenkins
15
16 # Check out a local copy of the arvados repo so we can use it to install the dependencies
17 cd /usr/src
18 sudo git clone arvados.git
19
20 if [[ "$GIT_HASH" != "" ]]; then
21   echo "GIT_HASH is set to $GIT_HASH, checking out that revision..."
22   (cd arvados && sudo git checkout $GIT_HASH)
23 fi
24
25 # Install the correct version of Go
26 GO_VERSION=`grep 'const goversion =' /usr/src/arvados/lib/install/deps.go |awk -F'"' '{print $2}'`
27 cd /usr/src
28 sudo wget https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz
29 sudo tar xzf go${GO_VERSION}.linux-amd64.tar.gz
30 sudo ln -s /usr/src/go/bin/go /usr/local/bin/go-${GO_VERSION}
31 sudo ln -s /usr/src/go/bin/gofmt /usr/local/bin/gofmt-${GO_VERSION}
32 sudo ln -s /usr/local/bin/go-${GO_VERSION} /usr/local/bin/go
33 sudo ln -s /usr/local/bin/gofmt-${GO_VERSION} /usr/local/bin/gofmt
34
35 # Preseed our dependencies
36 cd arvados
37 sudo go mod download
38 sudo go run ./cmd/arvados-server install -type test
39
40 # FUSE must be configured with the 'user_allow_other' option enabled for Crunch to set up Keep mounts that are readable by containers.
41 # This is used in our test suite.
42 echo user_allow_other | sudo tee -a /etc/fuse.conf
43
44 # React uses a lot of filesystem watchers (via inotify). Increase the default
45 # so we have a higher limit at runtime.
46 echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
47
48 # Our Jenkins jobs use this directory to store the temporary files for the tests
49 mkdir /home/jenkins/tmp
50
51 # Preseed the run-tests.sh cache. This is a little bit silly (a lot of this
52 # stuff was already done by the call to `./cmd/arvados-server install -type
53 # test` above, but they do not share a cache.
54 sudo chown jenkins:jenkins /home/jenkins -R
55 sudo chown jenkins:jenkins /usr/src/arvados -R
56 sudo -u jenkins ./build/run-tests.sh WORKSPACE=/usr/src/arvados --temp /home/jenkins/tmp --only install
57
58 # Install the arvados-dev repo where the jenkins `test-provision-multinode` job
59 # expects it
60 cd /usr/local
61 sudo git clone --depth 1 https://github.com/arvados/arvados-dev
62 sudo chown -R jenkins:jenkins /usr/local/arvados-dev/