Skip to content

Commit

Permalink
Introduce .ci/make.sh
Browse files Browse the repository at this point in the history
A shared shim amongst clients used to automate delivery
  • Loading branch information
Mpdreamz committed Dec 16, 2020
1 parent c60f704 commit fb98225
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
4 changes: 1 addition & 3 deletions .ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,4 @@ RUN composer install
COPY . .

# Updating elasticsearch submodule
RUN git submodule update --init --recursive

CMD ["bash", ".ci/yaml-tests.sh"]
RUN git submodule update --init --recursive
56 changes: 56 additions & 0 deletions .ci/make.sh
Original file line number Diff line number Diff line change
@@ -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'
3 changes: 2 additions & 1 deletion .ci/run-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ docker run \
--ulimit nofile=65535:65535 \
--name elasticsearch-php \
--rm \
elastic/elasticsearch-php
elastic/elasticsearch-php \
./.ci/yaml-tests.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ build

# Junit test output
tests/*-junit.xml

# clients make output
.ci/output

0 comments on commit fb98225

Please sign in to comment.