flush dns cache to get new dhcp lease on vm
This commit is contained in:
7
Jenkinsfile
vendored
7
Jenkinsfile
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user