ci: Accept arbitrary curl arguments for polling

parent 95272b72
...@@ -58,7 +58,7 @@ jobs: ...@@ -58,7 +58,7 @@ jobs:
docker-compose up -d elasticsearch docker-compose up -d elasticsearch
source .github/workflows/scripts/lib/testing.sh source .github/workflows/scripts/lib/testing.sh
poll_ready "$(container_id elasticsearch)" "http://$(service_ip elasticsearch):9200/" 'elastic:changeme' poll_ready "$(container_id elasticsearch)" "http://$(service_ip elasticsearch):9200/" -u 'elastic:changeme'
# Set passwords # Set passwords
...@@ -206,7 +206,7 @@ jobs: ...@@ -206,7 +206,7 @@ jobs:
docker stack deploy -c ./docker-stack.yml elk docker stack deploy -c ./docker-stack.yml elk
docker service scale elk_logstash=0 elk_kibana=0 docker service scale elk_logstash=0 elk_kibana=0
source .github/workflows/scripts/lib/testing.sh source .github/workflows/scripts/lib/testing.sh
poll_ready "$(container_id elasticsearch)" "http://$(service_ip elasticsearch):9200/" 'elastic:changeme' poll_ready "$(container_id elasticsearch)" "http://$(service_ip elasticsearch):9200/" -u 'elastic:changeme'
# Set passwords # Set passwords
......
...@@ -83,7 +83,7 @@ function poll_ready { ...@@ -83,7 +83,7 @@ function poll_ready {
local -a args=( '-s' '-D-' '-m3' '-w' '%{http_code}' "$url" ) local -a args=( '-s' '-D-' '-m3' '-w' '%{http_code}' "$url" )
if [ "$#" -ge 3 ]; then if [ "$#" -ge 3 ]; then
args+=( '-u' "$3" ) args+=( ${@:3} )
fi fi
echo "curl arguments: ${args[*]}" echo "curl arguments: ${args[*]}"
......
...@@ -21,13 +21,13 @@ ip_ls="$(service_ip logstash)" ...@@ -21,13 +21,13 @@ ip_ls="$(service_ip logstash)"
ip_kb="$(service_ip kibana)" ip_kb="$(service_ip kibana)"
log 'Waiting for readiness of Elasticsearch' log 'Waiting for readiness of Elasticsearch'
poll_ready "$cid_es" "http://${ip_es}:9200/" 'elastic:testpasswd' poll_ready "$cid_es" "http://${ip_es}:9200/" -u 'elastic:testpasswd'
log 'Waiting for readiness of Logstash' log 'Waiting for readiness of Logstash'
poll_ready "$cid_ls" "http://${ip_ls}:9600/_node/pipelines/main?pretty" poll_ready "$cid_ls" "http://${ip_ls}:9600/_node/pipelines/main?pretty"
log 'Waiting for readiness of Kibana' log 'Waiting for readiness of Kibana'
poll_ready "$cid_kb" "http://${ip_kb}:5601/api/status" 'kibana_system:testpasswd' poll_ready "$cid_kb" "http://${ip_kb}:5601/api/status" -u 'kibana_system:testpasswd'
log 'Creating Logstash index pattern in Kibana' log 'Creating Logstash index pattern in Kibana'
source .env source .env
......
...@@ -17,10 +17,10 @@ ip_es="$(service_ip elasticsearch)" ...@@ -17,10 +17,10 @@ ip_es="$(service_ip elasticsearch)"
ip_en="$(service_ip enterprise-search)" ip_en="$(service_ip enterprise-search)"
log 'Waiting for readiness of Elasticsearch' log 'Waiting for readiness of Elasticsearch'
poll_ready "$cid_es" "http://${ip_es}:9200/" 'elastic:testpasswd' poll_ready "$cid_es" "http://${ip_es}:9200/" -u 'elastic:testpasswd'
log 'Waiting for readiness of Enterprise Search' log 'Waiting for readiness of Enterprise Search'
poll_ready "$cid_en" "http://${ip_en}:3002/api/ent/v1/internal/health" 'elastic:testpasswd' poll_ready "$cid_en" "http://${ip_en}:3002/api/ent/v1/internal/health" -u 'elastic:testpasswd'
log 'Retrieving private key from Elasticsearch' log 'Retrieving private key from Elasticsearch'
response="$(curl "http://${ip_es}:9200/.ent-search-actastic-app_search_api_tokens_v2/_search?q=name:private-key" -s -u elastic:testpasswd)" response="$(curl "http://${ip_es}:9200/.ent-search-actastic-app_search_api_tokens_v2/_search?q=name:private-key" -s -u elastic:testpasswd)"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment