LXC specific steps

This commit is contained in:
2026-02-03 21:42:31 -05:00
parent 7277d00008
commit 0002afbb01

12
Jenkinsfile vendored
View File

@@ -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