Skip to content

Commit

Permalink
fix: update ingressControllerIP to make it compatible to both ec2 k8s…
Browse files Browse the repository at this point in the history
… & eks

Signed-off-by: Shengwen Yu <[email protected]>
  • Loading branch information
Shengwen Yu committed Jul 19, 2023
1 parent 5ebd1e5 commit 9838391
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/e2e/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,27 @@ class HarborChartFreshInstallPipelineExecutor extends FreshInstallPipelineExecut
// the scope of the credential is just inside the "withCredentials" block, so we need to call "withCredentials" again
script.withCredentials([script.file(credentialsId: "kubeconfig", variable: "KUBE_CONFIG_FILE_PATH")]) {
// get the IP address of the ingress controller
ingressControllerIP = script.sh(
ingressControllerIP1 = script.sh(
returnStdout: true,
script:"""
docker run -i --rm -v \${KUBE_CONFIG_FILE_PATH}:/root/.kube/config deployer:dev \
sh -c 'host \$(kubectl get svc ingress-nginx-controller --context ${context} -n ingress-nginx -o jsonpath="{.status.loadBalancer.ingress[0].hostname}") | awk "/has address/ { print \\\$4; exit }"'
""").trim()
ingressControllerIP2 = script.sh(
returnStdout: true,
script:"""
docker run -i --rm -v \${KUBE_CONFIG_FILE_PATH}:/root/.kube/config deployer:dev \
sh -c 'kubectl get svc ingress-nginx-controller --context ${context} -n ingress-nginx -o jsonpath="{.spec.externalIPs[0]}"'
""").trim()
ingressControllerIP = script.sh(
returnStdout: true,
script: """
if [ -n "${ingressControllerIP1}" ]; then
echo -n ${ingressControllerIP1}
elif [ -n "${ingressControllerIP2}" ]; then
echo -n ${ingressControllerIP2}
fi
""").trim()
// install harbor chart
script.sh """
# insert the hostAliases to run the replication test
Expand Down

0 comments on commit 9838391

Please sign in to comment.