Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce .ci/make.sh #1090

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here be php magic @ezimuel 😸

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