diff --git a/.ci/Dockerfile b/.ci/Dockerfile index 4f4eea689..5eb6c6934 100644 --- a/.ci/Dockerfile +++ b/.ci/Dockerfile @@ -30,6 +30,4 @@ RUN composer install COPY . . # Updating elasticsearch submodule -RUN git submodule update --init --recursive - -CMD ["bash", ".ci/yaml-tests.sh"] \ No newline at end of file +RUN git submodule update --init --recursive \ No newline at end of file diff --git a/.ci/make.sh b/.ci/make.sh new file mode 100755 index 000000000..c70d70405 --- /dev/null +++ b/.ci/make.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# parameters are available to this script + +# common build entry script for all elasticsearch clients + +# ./.ci/make.sh assemble VERSION + +script_path=$(dirname "$(realpath -s "$0")") +repo=$(realpath "$script_path/../") + +# shellcheck disable=SC1090 +CMD=$1 +TASK=$1 +VERSION=$2 +STACK_VERSION=$VERSION +set -euo pipefail + +output_folder=".ci/output" +OUTPUT_DIR="$repo/${output_folder}" +mkdir -p "$OUTPUT_DIR" + +PHP_VERSION=${PHP_VERSION-7.4-cli} + +echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m" +echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m" +echo -e "\033[34;1mINFO:\033[0m PHP_VERSION ${PHP_VERSION}\033[0m" + +echo -e "\033[1m>>>>> Build [elastic/elasticsearch-php container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" + +docker build \ + --no-cache \ + --file .ci/Dockerfile \ + --tag elastic/elasticsearch-php \ + --build-arg PHP_VERSION=${PHP_VERSION} \ + . + +echo -e "\033[1m>>>>> Run [elastic/elasticsearch-php container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" + +case $CMD in + assemble) + TASK=release + ;; + *) + echo -e "\nUsage:\n\t $CMD is not supported right now\n" + exit 1 +esac + +docker run \ + --workdir="/usr/src/app" \ + --volume "${OUTPUT_DIR}:/usr/src/app/${output_folder}" \ + --volume=${repo}/tests:/usr/src/app/tests \ + --env PHP_VERSION=${PHP_VERSION} \ + --name elasticsearch-php \ + --rm \ + elastic/elasticsearch-php \ + echo 'something calling automation here using $TASK and $VERSION producing output in $OUTPUT_DIR' diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index 9a2bf4d4c..2a6a166de 100644 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -43,4 +43,5 @@ docker run \ --ulimit nofile=65535:65535 \ --name elasticsearch-php \ --rm \ - elastic/elasticsearch-php \ No newline at end of file + elastic/elasticsearch-php \ + ./.ci/yaml-tests.sh diff --git a/.gitignore b/.gitignore index dff608834..23a77acd6 100755 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ build # Junit test output tests/*-junit.xml + +# clients make output +.ci/output