22383: Install Ansible in Docker image
[arvados-dev.git] / jenkins / packer-images / jenkins-image-with-docker.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 the package building/testing jobs
10 sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io make wget dpkg-dev createrepo-c unzip
11 sudo usermod -a -G docker jenkins
12
13 # Ansible install
14 sudo install -d -o "$(id -nu)" -g "$(id -ng)" /opt/ansible
15 python3 -m venv /opt/ansible
16 /opt/ansible/bin/pip config --quiet --site set global.no-input true
17 /opt/ansible/bin/pip config --quiet --site set install.no-cache-dir true
18 /opt/ansible/bin/pip config --quiet --site set install.progress-bar off
19 /opt/ansible/bin/pip install "pip>=20.3" wheel
20 /opt/ansible/bin/pip install "ansible~=8.7" "yq~=3.4"
21 sudo chown -R root: /opt/ansible
22
23 # Packer install
24 cd /tmp
25 wget https://releases.hashicorp.com/packer/1.8.0/packer_1.8.0_linux_amd64.zip
26 unzip packer_1.8.0_linux_amd64.zip packer
27 sudo mv packer /usr/local/bin/
28
29 # Install the arvados-dev repo where the Jenkins job expects it
30 cd /usr/local
31 sudo git clone --depth 1 https://github.com/arvados/arvados-dev
32 sudo chown -R jenkins:jenkins /usr/local/arvados-dev/
33
34 # React uses a lot of filesystem watchers (via inotify). Increase the default
35 # so we have a higher limit at runtime.
36 echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
37 sudo sysctl -p
38
39 # Use 'docker-hub-mirror.arvados.org' instead of pulling directly from
40 # docker hub to avoid getting rate limit errors from docker.io.
41 echo '{ "registry-mirrors": ["https://docker-hub-mirror.arvados.org"] }' | sudo tee -a /etc/docker/daemon.json