Skip to content

Commit

Permalink
[CI] Updates buildkite scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Sep 26, 2023
1 parent de200d1 commit 0a5408d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 46 deletions.
1 change: 0 additions & 1 deletion .buildkite/functions/imports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require_stack_version
if [[ -z $es_node_name ]]; then
# only set these once
set -euo pipefail
export RUNSCRIPTS=${RUNSCRIPTS-}
export DETACH=${DETACH-false}
export CLEANUP=${CLEANUP-false}

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/functions/wait-for-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function wait_for_container {
echo ""
docker inspect -f "{{range .State.Health.Log}}{{.Output}}{{end}}" ${1}
echo -e "\033[34;1mINFO:\033[0m waiting for node $1 to be up\033[0m"
sleep 2;
sleep 20;
done;

# Always show logs if the container is running, this is very useful both on CI as well as while developing
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
env:
PHP_VERSION: "{{ matrix.php }}"
TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.9-SNAPSHOT
STACK_VERSION: 8.10-SNAPSHOT
matrix:
setup:
suite:
Expand Down
50 changes: 19 additions & 31 deletions .buildkite/run-elasticsearch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ set -euo pipefail
echo -e "\033[34;1mINFO:\033[0m Take down node if called twice with the same arguments (DETACH=true) or on seperate terminals \033[0m"
cleanup_node $es_node_name

# Set vm.max_map_count kernel setting to 262144
sudo sysctl -w vm.max_map_count=262144
BUILDKITE=${BUILDKITE-false}

# Set vm.max_map_count kernel setting to 262144 if we're in CI
if [[ "$BUILDKITE" == "true" ]]; then
sudo sysctl -w vm.max_map_count=262144
fi

master_node_name=${es_node_name}
cluster_name=${moniker}${suffix}
Expand All @@ -50,22 +54,18 @@ environment=($(cat <<-END
--env action.destructive_requires_name=false
--env ingest.geoip.downloader.enabled=false
--env cluster.deprecation_indexing.enabled=false
END
))
if [[ "$TEST_SUITE" == "platinum" ]]; then
environment+=($(cat <<-END
--env xpack.security.enabled=true
--env xpack.license.self_generated.type=trial
--env xpack.security.http.ssl.enabled=true
--env xpack.security.http.ssl.verification_mode=certificate
--env xpack.security.http.ssl.key=certs/testnode.key
--env xpack.security.http.ssl.certificate=certs/testnode.crt
--env xpack.security.http.ssl.certificate_authorities=certs/ca.crt
--env xpack.security.transport.ssl.enabled=true
--env xpack.security.transport.ssl.verification_mode=certificate
--env xpack.security.transport.ssl.key=certs/testnode.key
--env xpack.security.transport.ssl.certificate=certs/testnode.crt
--env xpack.security.transport.ssl.certificate_authorities=certs/ca.crt
--env xpack.security.enabled=true
--env xpack.license.self_generated.type=trial
--env xpack.security.http.ssl.enabled=true
--env xpack.security.http.ssl.verification_mode=certificate
--env xpack.security.http.ssl.key=certs/testnode.key
--env xpack.security.http.ssl.certificate=certs/testnode.crt
--env xpack.security.http.ssl.certificate_authorities=certs/ca.crt
--env xpack.security.transport.ssl.enabled=true
--env xpack.security.transport.ssl.verification_mode=certificate
--env xpack.security.transport.ssl.key=certs/testnode.key
--env xpack.security.transport.ssl.certificate=certs/testnode.crt
--env xpack.security.transport.ssl.certificate_authorities=certs/ca.crt
END
))
volumes+=($(cat <<-END
Expand All @@ -74,19 +74,8 @@ END
--volume $ssl_ca:/usr/share/elasticsearch/config/certs/ca.crt
END
))
else
environment+=($(cat <<-END
--env node.roles=data,data_cold,data_content,data_frozen,data_hot,data_warm,ingest,master,ml,remote_cluster_client,transform
--env xpack.security.enabled=false
--env xpack.security.http.ssl.enabled=false
END
))
fi

cert_validation_flags=""
if [[ "$TEST_SUITE" == "platinum" ]]; then
cert_validation_flags="--insecure --cacert /usr/share/elasticsearch/config/certs/ca.crt --resolve ${es_node_name}:443:127.0.0.1"
fi
cert_validation_flags="--insecure --cacert /usr/share/elasticsearch/config/certs/ca.crt --resolve ${es_node_name}:443:127.0.0.1"

# Pull the container, retry on failures up to 5 times with
# short delays between each attempt. Fixes most transient network errors.
Expand Down Expand Up @@ -142,5 +131,4 @@ END
if wait_for_container "$es_node_name" "$network_name"; then
echo -e "\033[32;1mSUCCESS:\033[0m Running on: $node_url\033[0m"
fi

done
16 changes: 6 additions & 10 deletions .buildkite/run-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,25 @@ PHP_VERSION=${PHP_VERSION-8.0-cli}

echo -e "\033[34;1mINFO:\033[0m VERSION: ${STACK_VERSION}\033[0m"
echo -e "\033[34;1mINFO:\033[0m TEST_SUITE: ${TEST_SUITE}\033[0m"
echo -e "\033[34;1mINFO:\033[0m RUNSCRIPTS: ${RUNSCRIPTS}\033[0m"

echo -e "\033[34;1mINFO:\033[0m pinging Elasticsearch ..\033[0m"
echo "--- :telephone_receiver: Pinging Elasticsearch :elasticsearch:"
curl --insecure --fail $external_elasticsearch_url/_cluster/health?pretty

if [[ "$RUNSCRIPTS" = *"enterprise-search"* ]]; then
enterprise_search_url="http://localhost:3002"
echo -e "\033[34;1mINFO:\033[0m pinging Enterprise Search ..\033[0m"
curl -I --fail $enterprise_search_url
fi
enterprise_search_url="http://localhost:3002"
echo "--- :telephone_receiver: Pinging Enterprise Search :elastic-enterprise-search:"
curl -I --fail $enterprise_search_url

echo -e "\033[32;1mSUCCESS:\033[0m successfully started the ${STACK_VERSION} stack.\033[0m"

echo -e "\033[1m>>>>> Build docker container >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"

echo "--- :docker: :php: Building Docker image"
docker build \
--no-cache \
--file $script_path/Dockerfile \
--tag elastic/enterprise-search-php \
--build-arg PHP_VERSION=${PHP_VERSION} \
.

echo -e "\033[1m>>>>> Run test:integration >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m"
echo "--- :docker: :php: Running Client Container"

repo=$(realpath $(dirname $(realpath -s $0))/../)

Expand Down
3 changes: 1 addition & 2 deletions .buildkite/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
# - Moved to .ci folder and seperated out `run-repository.sh`
# - Add `$RUNSCRIPTS` env var for running Elasticsearch dependent products
export CONTAINER_NAME=enterprise-search
export RUNSCRIPTS=enterprise-search

script_path=$(dirname $(realpath -s $0))
source $script_path/functions/imports.sh
set -euo pipefail

echo "--- :elasticsearch: Starting Elasticsearch"
echo "--- :docker: :elasticsearch: Starting Elasticsearch"
DETACH=true bash $script_path/run-elasticsearch.sh

echo "--- :docker: :elastic-enterprise-search: Starting Enterprise Search"
Expand Down

0 comments on commit 0a5408d

Please sign in to comment.