From 0002afbb0130ef1afe502bfbf4940e007c64c3b0 Mon Sep 17 00:00:00 2001 From: jerick Date: Tue, 3 Feb 2026 21:42:31 -0500 Subject: [PATCH] LXC specific steps --- Jenkinsfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 40b865e..9aff464 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -99,8 +99,9 @@ pipeline { steps { withCredentials([usernamePassword(credentialsId: 'opnsense-api', usernameVariable: 'OPNSENSE_KEY', passwordVariable: 'OPNSENSE_SECRET')]) { script { - def templateHost = params.PROVISION_TYPE == 'VM' ? 'ubuntu24vm' : 'ubuntu24lxc' - echo "Looking up DHCP lease for hostname: ${templateHost}" + // LXC gets the correct hostname at clone time, VM uses template hostname + def lookupHost = params.PROVISION_TYPE == 'VM' ? 'ubuntu24vm' : params.HOSTNAME + echo "Looking up DHCP lease for hostname: ${lookupHost}" // Wait for DHCP lease to appear def vmIp = '' @@ -116,7 +117,7 @@ pipeline { python3 -c " import sys, json data = json.load(sys.stdin) -hostname = '${templateHost}' +hostname = '${lookupHost}' for row in data.get('rows', []): if row.get('hostname') == hostname or row.get('client-hostname') == hostname: print(row.get('address', '')) @@ -127,7 +128,7 @@ for row in data.get('rows', []): ).trim() if (vmIp) { - echo "Found IP address: ${vmIp} for hostname: ${templateHost}" + echo "Found IP address: ${vmIp} for hostname: ${lookupHost}" return true } echo "DHCP lease not found yet, retrying..." @@ -156,6 +157,9 @@ for row in data.get('rows', []): } stage('Set Hostname') { + when { + expression { params.PROVISION_TYPE == 'VM' } + } steps { script { def newHostname = params.HOSTNAME