-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathrun-repository.sh
executable file
·54 lines (46 loc) · 2.04 KB
/
run-repository.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash
# parameters are available to this script
# STACK_VERSION -- version e.g Major.Minor.Patch(-Prelease)
# TEST_SUITE -- which test suite to run: free or platinum
# ELASTICSEARCH_URL -- The url at which elasticsearch is reachable, a default is composed based on STACK_VERSION and TEST_SUITE
# DOTNET_VERSION -- SDK version (defined in test-matrix.yml, a default is hardcoded here)
script_path=$(dirname $(realpath -s $0))
source $script_path/functions/imports.sh
set -euo pipefail
DOTNET_VERSION=${DOTNET_VERSION-8.0.400}
ELASTICSEARCH_URL=${ELASTICSEARCH_URL-"$elasticsearch_url"}
elasticsearch_container=${elasticsearch_container-}
TEST_FOLDER=${TEST_FOLDER-}
TEST_FILE=${TEST_FILE-}
TEST_SECTION=${TEST_SECTION-}
run_script_args=""
if [[ "$TEST_FOLDER" != "" ]]; then
run_script_args="-f ${TEST_FOLDER}"
fi
if [[ "$TEST_FILE" != "" ]]; then
run_script_args="${run_script_args} -t ${TEST_FILE}"
fi
if [[ "$TEST_SECTION" != "" ]]; then
run_script_args="${run_script_args} -s ${TEST_SECTION}"
fi
echo -e "--- :computer: Environment variables"
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 URL ${ELASTICSEARCH_URL}\033[0m"
echo -e "\033[34;1mINFO:\033[0m CONTAINER ${elasticsearch_container}\033[0m"
echo -e "\033[34;1mINFO:\033[0m DOTNET_VERSION ${DOTNET_VERSION}\033[0m"
echo -e "--- :dotnet: :docker: Build [elastic/elasticsearch-net container]"
docker build --file .buildkite/DockerFile --tag elastic/elasticsearch-net \
--build-arg USER_ID=$(id -u) \
--build-arg GROUP_ID=$(id -g) .
echo -e "--- :dotnet: :docker: Run [elastic/elasticsearch-net container]"
mkdir -p build/output
repo=$(realpath $(dirname $(realpath -s $0))/../)
docker run \
--network=${network_name} \
--env "DOTNET_VERSION" \
--name test-runner \
--volume ${repo}/build/output:/sln/build/output \
--rm \
elastic/elasticsearch-net \
./build.sh rest-spec-tests $TEST_SUITE -e ${ELASTICSEARCH_URL} -o /sln/build/output/rest-spec-junit.xml ${run_script_args}