3 # Copyright (C) The Arvados Authors. All rights reserved.
5 # SPDX-License-Identifier: Apache-2.0
9 # Wait for cloud-init to finish
10 cloud-init status --wait
12 sudo tee -a ~jenkins/.ssh/authorized_keys >/dev/null <<EOF
13 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDH8swFWEfEfHhA+C5ezV8SXO/PkzGD1SH5VAQP/XDIrtnUocBZ3CE30lSyqYJI/EVKVqVa/ICQ0YpUwiMK6+3Jr9QQJwVyTmPji2nY3InL+1XAucN6HFJGKY9bYSsNOuKooj22GwBWw3gfJNLg/8qtpVykEq1yRpyh6pGsXT+J5nUZ723vZZTh//sxdN4CM8D8zoDgHc4RbL+zvESnCDrDbtMhg2u1h14RWiFOBAnzYuWcgtVDy2HA9iS0hJFB2UOV50byXLrEetxJ84PTwRsV2irq1y63g58VxwYOUrVZ08MY5qFvHExBjPqeqhRMzE7GufWM5F1CcUuGviOGFWfqMnfG4VOirPkFtRoK2oKRxH+NVPoUXWWxItJQ1dZ9hLDDWgAbxAvLS4Nnl2hvOVAbC7RVpXfoAhIPpL48oS1UprbsZIMxk2ZmRSJB1ykD3aLUvoO4zoD6xADt8uLiPvVYgFWUy1doLxHZqdY1Omc91owgQVPKvQ4vhqsJehQl4ZDS+O+8S7aC5m8sQ/V+NqiiXLH22vN58K7qNrkHWdb1n+rhilMbA5zp3cSKBgwmmNdupyPkJOKvf3IS7i4El+c8RFmRQv4FzGrdjGXAP8LPtt1dWPgHTFYjmrkOHLmfWM/y8cuyPWW/HEp3Y/msPQRlS3Gymce//vAWgN4T9yN46w== lucas@notebook
16 # Install a few dependency packages
18 PREINSTALL_CMD='echo "error: unknown distro" >&2; false'
19 for OS_ID in ${ID:-} ${ID_LIKE:-}; do
22 PREINSTALL_CMD="/bin/true"
23 INSTALL_CMD="yum install -y"
24 POSTINSTALL_CMD="/bin/true"
25 PKGS="git java-11-openjdk jq nmap-ncat python39"
26 SSH_SERVICES="sshd.service sshd.socket"
30 if [[ "$VERSION_CODENAME" == buster ]]; then
31 echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee /etc/apt/sources.list.d/buster-backports.list
33 PREINSTALL_CMD="env DEBIAN_FRONTEND=noninteractive apt-get update"
34 INSTALL_CMD="env DEBIAN_FRONTEND=noninteractive apt-get install -y"
35 POSTINSTALL_CMD="env DEBIAN_FRONTEND=noninteractive apt-get purge --autoremove -y"
36 # SUFFIX packages with - to remove them
37 # Remove unattended-upgrades so that it doesn't interfere with our nodes at startup
38 PKGS="default-jdk git jq netcat-traditional python3-venv unattended-upgrades-"
39 SSH_SERVICES="ssh.service"
45 sudo ${PREINSTALL_CMD}
46 sudo ${INSTALL_CMD} ${PKGS}
47 sudo ${POSTINSTALL_CMD}
49 # create a reference repository (bare git repo)
50 # jenkins will use this to speed up the checkout for each job
52 sudo git clone --mirror git://git.arvados.org/arvados.git
53 sudo chown jenkins:jenkins arvados.git -R
55 # Jenkins will use this script to determine when the node is ready for use
56 sudo mv /tmp/node-ready.sh /usr/local/bin/
58 # make sure sshd does not start on boot (yes, this is nasty). Jenkins will call
59 # /tmp/node-ready.sh as a GCP `startup script`, which gets run on node start.
60 # That script loops until it can connect to git.arvados.org, and then starts
61 # sshd so that the Jenkins agent can connect. This avoids the race where Jenkins
62 # tries to start a job before the GCP outbound routing is working, and fails on
63 # the first thing it needs internet for, the checkout from git.arvados.org
64 sudo systemctl disable $SSH_SERVICES