Replace echo command and get the ip
testing/og-dhcp-API/pipeline/head This commit looks good Details

testing
Nicolas Arenas 2024-10-01 08:51:22 +02:00
parent 6973eb7d67
commit 8e2f093da1
1 changed files with 2 additions and 4 deletions

View File

@ -26,14 +26,12 @@ pipeline {
echo "Get IP of API server for DHCP with Vagrant" echo "Get IP of API server for DHCP with Vagrant"
sh ''' sh '''
set -e set -e
new_ip=$(vagrant ssh -c "ip a | grep inet | grep eth0 | awk \'{print $2}\' | cut -d/ -f1") new_ip=$(vagrant ssh -c "hostname -I" | tr -d '\r')
echo "$new_ip test-api" | sudo -S tee -a /etc/hosts <<<$QINDEL_PASS echo "$QINDEL_PASS" | sudo -S bash -c "echo '$new_ip api-test' >> /etc/hosts"
echo "IP: $new_ip" echo "IP: $new_ip"
curl -L -X 'GET' -H 'accept: application/json' "http://api-test/opengnsys3/rest/dhcp/subnets/" curl -L -X 'GET' -H 'accept: application/json' "http://api-test/opengnsys3/rest/dhcp/subnets/"
''' '''
} }
} }
} }
stage ('Run API tests') { stage ('Run API tests') {