[buildbot] Provide SSH key via cloud-init
This change adds an SSH key to the ubuntu image via cloud-init to avoid
having to use ssh-copy-id since ssh-copy-id requires user input which is
difficult to automate in CI.
This change does not pose a security risk since access to the LUCI
bots is tightly controlled, and the key itself only allows access to
a short-lived testing VM.
Bug: 283085397
Change-Id: I90cc7074bd5cbf87c85c75e37a8b60054243f2a2
diff --git a/tools/buildbot-utils.sh b/tools/buildbot-utils.sh
index adbf8dd..70fa01a 100755
--- a/tools/buildbot-utils.sh
+++ b/tools/buildbot-utils.sh
@@ -81,10 +81,10 @@
export ART_TEST_CHROOT_BASENAME="art-test-chroot"
export ART_TEST_CHROOT="/home/$ART_TEST_SSH_USER/$ART_TEST_CHROOT_BASENAME"
export ART_CHROOT_CMD="unshare --user --map-root-user chroot $ART_TEST_CHROOT_BASENAME"
- export ART_SSH_CMD="ssh -q -p $ART_TEST_SSH_PORT $ART_TEST_SSH_USER@$ART_TEST_SSH_HOST -o IdentityAgent=none"
- export ART_SCP_CMD="scp -P $ART_TEST_SSH_PORT -p -r -o IdentityAgent=none"
+ export ART_SSH_CMD="ssh -q -i ~/.ssh/ubuntu -p $ART_TEST_SSH_PORT -o StrictHostKeyChecking=no $ART_TEST_SSH_USER@$ART_TEST_SSH_HOST"
+ export ART_SCP_CMD="scp -i ~/.ssh/ubuntu -o StrictHostKeyChecking=no -P $ART_TEST_SSH_PORT -p -r"
export ART_RSYNC_CMD="rsync -az"
- export RSYNC_RSH="ssh -p $ART_TEST_SSH_PORT -o IdentityAgent=none" # don't prefix with "ART_", rsync expects this name
+ export RSYNC_RSH="ssh -i ~/.ssh/ubuntu -p $ART_TEST_SSH_PORT -o StrictHostKeyChecking=no" # don't prefix with "ART_", rsync expects this name
if [[ "$TARGET_ARCH" =~ ^(arm64|riscv64)$ ]]; then
export ART_TEST_VM_IMG="ubuntu-22.04-server-cloudimg-$TARGET_ARCH.img"