Permissions fix.
[arvados-dev.git] / jenkins / packer-images / jenkins-image-common.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 sudo su -c "echo ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEA3nzI6T6Lpd5xFoRewcx91Dv9sUzNNmdYfwOleemBFz0y3RaQElehUWasyjuIURZw7RL5EjvrqeQq9pe/lO99dO0F9yMuMsMH2t88YrVJQ/z/5Aa4I2zYQotKb/9CCfynsy41y5xywxtOwXiDk2kpo+c9VZCyCeW8Hnc9HaIpkKSLnkqDVhESzlrkYyNKZvUAL1hiFIzmmw/veFgRb7/ol76Ze3xsWugbHUECEIAKoz/8uaevOAAoJrMFhffFIQ8IfClqDZv2lnBBhvh1O9TO0Mg4klcieyQ1RZhMjeP4WnAa9PXP7xZlQHLgO9qO1jDd2sOdkX6EedCfX5jO4Y51HPJpV35uYumw3veftMlpIJFmA2eIQxU19SCYpojWRGXZ5v9WtFIHX2nGy+Gi1bk7TR+HBsCDXOPhhQk4ceIM4OonqEb1NJ57elxh6mFbDAQCZtYhRLqYvcyGpuBdVdLNOJbOZ7vBJY3Kfjxa87rvFIJheT6DXhpdRayeOovLm0vuJ53bZoWxWOqjpuigQqHtSB3OmintrKB916BhNFsHwPeZpK0ahZGFygV63REM/X8m0nOlHqyAY69uzLHyYXM83zAI1L5Y4wuzsVqO+1tnK6PMcfg5/DArjBrn7YqA5tzJY9EgdVVPjpgjD2yYYTOP6b3UUw4uFj3asnOX24dfVzk= ward@countzero" >> /home/jenkins/.ssh/authorized_keys
10 sudo su -c "echo ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCfRJenfxGPFuJ/W2KUs6Wf0waiFsSaxd8WUTFXi4ophH2qkUMxd8xvoex/Z+Iq1fA8QCe4DfFnhUOMViP9bBB6+Va/x1Jx521P+DfN8ILqM2kcug0OoC4c5gTyFecJaKIyX6jMeidQTh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k2ZmRSJB1ykD3aLUvoO4zoD6xADt8uLiPvVYgFWUy1doLxHZqdY1Omc91owgQVPKvQ4vhqsJehQl4ZDS+O+8S7aC5m8sQ/V+NqiiXLH22vN58K7qNrkHWdb1n+rhilMbA5zp3cSKBgwmmNdupyPkJOKvf3IS7i4El+c8RFmRQv4FzGrdjGXAP8LPtt1dWPgHTFYjmrkOHLmfWM/y8cuyPWW/HEp3Y/msPQRlS3Gymce//vAWgN4T9yN46w== lucas@notebook" >> /home/jenkins/.ssh/authorized_keys
12
13 echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee /etc/apt/sources.list.d/buster-backports.list
14
15 # Install a few dependency packages
16 sudo su -c "apt-get update"
17 sudo su -c "DEBIAN_FRONTEND=noninteractive apt install -y git netcat default-jdk"
18 # Remove unattended-upgrades so that it doesn't interfere with our nodes at startup
19 sudo su -c "DEBIAN_FRONTEND=noninteractive apt-get remove -y unattended-upgrades"
20 sudo su -c "DEBIAN_FRONTEND=noninteractive apt-get autoremove -y"
21
22 # create a reference repository (bare git repo)
23 # jenkins will use this to speed up the checkout for each job
24 cd /usr/src
25 sudo git clone --mirror https://git.arvados.org/arvados.git
26 sudo chown jenkins:jenkins arvados.git -R
27
28 # Jenkins will use this script to determine when the node is ready for use
29 sudo mv /tmp/node-ready.sh /usr/local/bin/
30
31 # make sure sshd does not start on boot (yes, this is nasty). Jenkins will call
32 # /tmp/node-ready.sh as a GCP `startup script`, which gets run on node start.
33 # That script loops until it can connect to git.arvados.org, and then starts
34 # sshd so that the Jenkins agent can connect. This avoids the race where Jenkins
35 # tries to start a job before the GCP outbound routing is working, and fails on
36 # the first thing it needs internet for, the checkout from git.arvados.org
37 sudo /bin/systemctl disable sshd