From 2a1a488abfbeb305ffbed84ddd2bbff02df1b0c7 Mon Sep 17 00:00:00 2001
From: Kristian Klausen <kristian@klausen.dk>
Date: Sun, 27 Oct 2024 14:08:41 +0100
Subject: [PATCH] gitlab_runner: Reduce libvirt-executor noise in the job log

This removes 13 instances of [1] and 1 instance of the IP address from
the job log.

The latter was fixed by no longer waiting for SSH in the "run" stage,
which is unnecessary as we wait for SSH in the "prepare" stage.

[1] Warning: Permanently added '192.168.122.xxx' (ED25519) to the list of known hosts.
---
 roles/gitlab_runner/files/libvirt-executor | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/roles/gitlab_runner/files/libvirt-executor b/roles/gitlab_runner/files/libvirt-executor
index 7f6a2162a..c39d15b8b 100755
--- a/roles/gitlab_runner/files/libvirt-executor
+++ b/roles/gitlab_runner/files/libvirt-executor
@@ -10,6 +10,7 @@ ssh() {
     -o ServerAliveInterval=15 \
     -o UserKnownHostsFile=/dev/null \
     -o StrictHostKeyChecking=off \
+    -o LogLevel=error \
     "root@${1}" "${@:2}"
 }
 
@@ -39,7 +40,6 @@ wait_for_ssh() {
       sleep 1
       continue
     fi
-    printf "%s" "${ip}"
     return 0
   done
   echo 'Waited 30 seconds for VM to start, exiting...'
@@ -68,7 +68,7 @@ prepare() {
 # https://docs.gitlab.com/runner/executors/custom.html#run
 run() {
   local ip
-  ip="$(wait_for_ssh "$(vm_name)")"
+  ip="$(vm_ip "$(vm_name)")"
   ssh "${ip}" bash < "${1}" || exit "${BUILD_FAILURE_EXIT_CODE:-1}"
 }
 
-- 
GitLab