From 4e202839343e5671f420a2d4af3dcc03749d732e Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Wed, 27 Nov 2024 11:10:50 +0700 Subject: [PATCH] [ci] Update command to get host ip in runners Signed-off-by: Viet Nguyen Duc --- Makefile | 8 ++++---- charts/selenium-grid/README.md | 4 ++-- charts/selenium-grid/certs/gen-cert-helper.sh | 2 +- tests/charts/make/chart_test.sh | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index a2384f977..5477e7f6a 100644 --- a/Makefile +++ b/Makefile @@ -910,7 +910,7 @@ chart_render_template: chart_test_autoscaling_disabled: PLATFORMS=$(PLATFORMS) TEST_CHROMIUM=true RELEASE_NAME=selenium SELENIUM_GRID_AUTOSCALING=false CHART_ENABLE_TRACING=true \ - SECURE_INGRESS_ONLY_GENERATE=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -i) SELENIUM_GRID_PORT=443 EXTERNAL_UPLOADER_CONFIG=true \ + SECURE_INGRESS_ONLY_GENERATE=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=443 EXTERNAL_UPLOADER_CONFIG=true \ VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \ TEMPLATE_OUTPUT_FILENAME="k8s_nodeChromium_enableTracing_secureIngress_generateCerts_ingressPublicIP_subPath.yaml" \ ./tests/charts/make/chart_test.sh NoAutoscaling @@ -925,7 +925,7 @@ chart_test_autoscaling_deployment_https: chart_test_autoscaling_deployment: PLATFORMS=$(PLATFORMS) TEST_EXISTING_KEDA=true RELEASE_NAME=selenium CHART_ENABLE_TRACING=true TEST_PATCHED_KEDA=false \ - SECURE_CONNECTION_SERVER=true SECURE_USE_EXTERNAL_CERT=true SERVICE_TYPE_NODEPORT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -i) SELENIUM_GRID_PORT=31444 \ + SECURE_CONNECTION_SERVER=true SECURE_USE_EXTERNAL_CERT=true SERVICE_TYPE_NODEPORT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=31444 \ SELENIUM_GRID_AUTOSCALING_MIN_REPLICA=1 SET_MAX_REPLICAS=3 TEST_DELAY_AFTER_TEST=2 SELENIUM_GRID_MONITORING=false \ VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \ TEMPLATE_OUTPUT_FILENAME="k8s_prefixSelenium_enableTracing_secureServer_externalCerts_nodePort_autoScaling_scaledObject_existingKEDA_subPath.yaml" \ @@ -941,7 +941,7 @@ chart_test_autoscaling_job_https: chart_test_autoscaling_job_hostname: PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true BASIC_AUTH_EMBEDDED_URL=true TEST_PATCHED_KEDA=false \ - SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -i) SELENIUM_GRID_PORT=443 \ + SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=443 \ VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \ TEMPLATE_OUTPUT_FILENAME="k8s_enableTracing_basicAuth_secureIngress_externalCerts_ingressPublicIP_autoScaling_originKEDA_scaledJob_subPath.yaml" \ ./tests/charts/make/chart_test.sh JobAutoscaling @@ -956,7 +956,7 @@ chart_test_autoscaling_job: chart_test_autoscaling_playwright_connect_grid: PLATFORMS=$(PLATFORMS) CHART_ENABLE_TRACING=true CHART_ENABLE_BASIC_AUTH=true MATRIX_TESTS=CDPTests \ BASIC_AUTH_USERNAME=docker-selenium BASIC_AUTH_PASSWORD=2NMI4jdBi6k7bENoeUfV25295VvzwAE9chM24a+2VL95uOHozo \ - SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -i) SELENIUM_GRID_PORT=443 \ + SECURE_INGRESS_ONLY_DEFAULT=true SECURE_USE_EXTERNAL_CERT=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_HOST=$$(hostname -I | cut -d' ' -f1) SELENIUM_GRID_PORT=443 \ VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) KEDA_BASED_NAME=$(KEDA_BASED_NAME) KEDA_BASED_TAG=$(KEDA_BASED_TAG) NAMESPACE=$(NAMESPACE) BINDING_VERSION=$(BINDING_VERSION) BASE_VERSION=$(BASE_VERSION) \ TEMPLATE_OUTPUT_FILENAME="k8s_playwright_connect_grid_basicAuth_secureIngress_ingressPublicIP_autoScaling_patchKEDA.yaml" \ ./tests/charts/make/chart_test.sh JobAutoscaling diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index 1d63e7267..3511429ed 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -84,7 +84,7 @@ helm install selenium-grid --set ingress.hostname=selenium-grid.k8s.local docker # Verify ingress configuration via kubectl get ingress # Notes: In case you want to set hostname is selenium-grid.local. You need to add the IP and hostname to the local host file in `/etc/hosts` -sudo -- sh -c -e "echo \"$(hostname -i) selenium-grid.local\" >> /etc/hosts" +sudo -- sh -c -e "echo \"$(hostname -I | cut -d' ' -f1) selenium-grid.local\" >> /etc/hosts" ``` ### Installing the Nightly chart @@ -795,7 +795,7 @@ For example (replace `$RELEASENAME` and `$NAMESPACE` with your values): ```bash helm upgrade -i $RELEASENAME -n $NAMESPACE docker-selenium/selenium-grid \ - --set global.K8S_PUBLIC_IP=$(hostname -i) \ + --set global.K8S_PUBLIC_IP=$(hostname -I | cut -d' ' -f1) \ --set tls.ingress.enableWithController=true \ --set tls.create=false \ --set tls.nameOverride=my-external-tls-secret \ diff --git a/charts/selenium-grid/certs/gen-cert-helper.sh b/charts/selenium-grid/certs/gen-cert-helper.sh index 91a6fc618..0f4a57723 100755 --- a/charts/selenium-grid/certs/gen-cert-helper.sh +++ b/charts/selenium-grid/certs/gen-cert-helper.sh @@ -30,7 +30,7 @@ SERVER_KEYSTORE=${SERVER_KEYSTORE:-server.jks} SERVER_KEYSTORE_PASSPWD=${SERVER_KEYSTORE_PASSPWD:-server.pass} BASE64_ONLY=${BASE64_ONLY:-0} if [ -n "${ADD_IP_ADDRESS}" ] && [ "${ADD_IP_ADDRESS}" = "hostname" ]; then - ADD_IP_ADDRESS=",IP:$(hostname -I | awk '{print $1}')" + ADD_IP_ADDRESS=",IP:$(hostname -I | cut -d' ' -f1)" else ADD_IP_ADDRESS=${ADD_IP_ADDRESS} fi diff --git a/tests/charts/make/chart_test.sh b/tests/charts/make/chart_test.sh index 825b55519..a5e11cd74 100755 --- a/tests/charts/make/chart_test.sh +++ b/tests/charts/make/chart_test.sh @@ -191,16 +191,16 @@ fi if [ "${CHART_ENABLE_INGRESS_HOSTNAME}" = "true" ]; then if [[ ! $(cat /etc/hosts) == *"${HOSTNAME_ADDRESS}"* ]]; then - sudo -- sh -c -e "echo \"$(hostname -i) ${HOSTNAME_ADDRESS}\" >> /etc/hosts" + sudo -- sh -c -e "echo \"$(hostname -I | cut -d' ' -f1) ${HOSTNAME_ADDRESS}\" >> /etc/hosts" fi if [[ ! $(cat /etc/hosts) == *"alertmanager.${HOSTNAME_ADDRESS}"* ]]; then - sudo -- sh -c -e "echo \"$(hostname -i) alertmanager.${HOSTNAME_ADDRESS}\" >> /etc/hosts" + sudo -- sh -c -e "echo \"$(hostname -I | cut -d' ' -f1) alertmanager.${HOSTNAME_ADDRESS}\" >> /etc/hosts" fi if [[ ! $(cat /etc/hosts) == *"grafana.${HOSTNAME_ADDRESS}"* ]]; then - sudo -- sh -c -e "echo \"$(hostname -i) grafana.${HOSTNAME_ADDRESS}\" >> /etc/hosts" + sudo -- sh -c -e "echo \"$(hostname -I | cut -d' ' -f1) grafana.${HOSTNAME_ADDRESS}\" >> /etc/hosts" fi if [[ ! $(cat /etc/hosts) == *"pts.${HOSTNAME_ADDRESS}"* ]]; then - sudo -- sh -c -e "echo \"$(hostname -i) pts.${HOSTNAME_ADDRESS}\" >> /etc/hosts" + sudo -- sh -c -e "echo \"$(hostname -I | cut -d' ' -f1) pts.${HOSTNAME_ADDRESS}\" >> /etc/hosts" fi ping -c 2 ${HOSTNAME_ADDRESS} HELM_COMMAND_SET_IMAGES="${HELM_COMMAND_SET_IMAGES} \ @@ -250,7 +250,7 @@ if [ "${SECURE_INGRESS_ONLY_GENERATE}" = "true" ] && [ "${RENDER_HELM_TEMPLATE_O --set tls.ingress.generateTLS=true \ --set tls.ingress.defaultCN=${SELENIUM_GRID_HOST} \ --set tls.ingress.defaultSANList[0]=${SELENIUM_GRID_HOST} \ - --set tls.ingress.defaultIPList[0]=$(hostname -I | awk '{print $1}') \ + --set tls.ingress.defaultIPList[0]=$(hostname -I | cut -d' ' -f1) \ " fi