flush dns cache to get new dhcp lease on vm

This commit is contained in:
2026-02-02 20:22:56 -05:00
parent 246ae0a340
commit e1af1a862d

7
Jenkinsfile vendored
View File

@@ -102,9 +102,12 @@ pipeline {
def targetHost = "${templateHost}.lan" def targetHost = "${templateHost}.lan"
echo "Waiting for ${targetHost} (template hostname) to become available..." echo "Waiting for ${targetHost} (template hostname) to become available..."
// Wait up to 3 minutes for the machine to respond to ping // Wait up to 5 minutes for the machine to respond to ping
timeout(time: 3, unit: 'MINUTES') { timeout(time: 5, unit: 'MINUTES') {
waitUntil { 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( def result = sh(
script: "ping -c 1 ${targetHost} > /dev/null 2>&1", script: "ping -c 1 ${targetHost} > /dev/null 2>&1",
returnStatus: true returnStatus: true