From 3b61a6bb177e4d8c65795254e39db6b4a058d49c Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Sun, 15 Oct 2023 11:55:51 +0200 Subject: [PATCH] ci: Disable Elasticsearch disk allocation decider --- .github/workflows/ci.yml | 5 ++++ .../scripts/disable-disk-alloc-decider.sh | 30 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 .github/workflows/scripts/disable-disk-alloc-decider.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aebd926..40b7f2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,11 @@ jobs: docker compose up setup docker compose up -d + # Elasticsearch's high disk watermark gets regularly exceeded on GitHub Actions runners. + # https://www.elastic.co/guide/en/elasticsearch/reference/8.10/fix-watermark-errors.html + - name: Disable Elasticsearch disk allocation decider + run: .github/workflows/scripts/disable-disk-alloc-decider.sh + - name: Execute core test suite run: .github/workflows/scripts/run-tests-core.sh diff --git a/.github/workflows/scripts/disable-disk-alloc-decider.sh b/.github/workflows/scripts/disable-disk-alloc-decider.sh new file mode 100755 index 0000000..4e7d73d --- /dev/null +++ b/.github/workflows/scripts/disable-disk-alloc-decider.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -eu +set -o pipefail + + +source "${BASH_SOURCE[0]%/*}"/lib/testing.sh + + +cid_es="$(container_id elasticsearch)" +ip_es="$(service_ip elasticsearch)" + +grouplog 'Wait for readiness of Elasticsearch' +poll_ready "$cid_es" "http://${ip_es}:9200/" -u 'elastic:testpasswd' +endgroup + +log 'Disabling disk allocation decider' + +declare -a put_args=( '-X' 'PUT' '--fail-with-body' '-s' '-u' 'elastic:testpasswd' + '-H' 'Content-Type: application/json' + "http://${ip_es}:9200/_cluster/settings?pretty" + '-d' '{"persistent":{"cluster.routing.allocation.disk.threshold_enabled":false}}' +) +declare response +declare -i exit_code=0 + +response=$(curl "${put_args[@]}") || exit_code=$? +echo "$response" + +exit $exit_code