diff --git a/Jenkinsfile b/Jenkinsfile index a4ecdfb..b1fd001 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -102,9 +102,12 @@ pipeline { def targetHost = "${templateHost}.lan" echo "Waiting for ${targetHost} (template hostname) to become available..." - // Wait up to 3 minutes for the machine to respond to ping - timeout(time: 3, unit: 'MINUTES') { + // Wait up to 5 minutes for the machine to respond to ping + timeout(time: 5, unit: 'MINUTES') { waitUntil { + // Flush DNS cache before each ping attempt + sh(script: "sudo systemd-resolve --flush-caches 2>/dev/null || sudo resolvectl flush-caches 2>/dev/null || sudo nscd -i hosts 2>/dev/null || true", returnStatus: true) + def result = sh( script: "ping -c 1 ${targetHost} > /dev/null 2>&1", returnStatus: true