ci: Accept arbitrary curl arguments for polling

This commit is contained in:
Antoine Cotten 2020-10-16 21:59:33 +02:00
parent 95272b72f4
commit b13d73def4
No known key found for this signature in database
GPG Key ID: 94637E68D4A79DD0
4 changed files with 7 additions and 7 deletions

View File

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

View File

@ -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[*]}"

View File

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

View File

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