11#! /usr/bin/env bash
2-
32# ------------------------------------------------------- #
43#
5- # Skeleton for common build entry script for all elastic
6- # clients. Needs to be adapted to individual client usage.
4+ # Build entry script for elasticsearch-js
75#
86# Must be called: ./.ci/make.sh <target> <params>
97#
108# Version: 1.1.0
119#
1210# Targets:
1311# ---------------------------
14- # assemble <VERSION> : build client artefacts with version
15- # bump <VERSION> : bump client internals to version
16- # codegen <VERSION> : generate endpoints
17- # docsgen <VERSION> : generate documentation
18- # examplegen : generate the doc examples
19- # clean : clean workspace
12+ # assemble <VERSION> : build client artifacts with version
13+ # bump <VERSION> : bump client internals to version
14+ # bumpmatrix <VERSION> : bump stack version in test matrix to version
15+ # codegen : generate endpoints
16+ # docsgen <VERSION> : generate documentation
17+ # examplegen : generate the doc examples
18+ # clean : clean workspace
2019#
2120# ------------------------------------------------------- #
2221
2322# ------------------------------------------------------- #
2423# Bootstrap
2524# ------------------------------------------------------- #
26-
2725script_path=$( dirname " $( realpath -s " $0 " ) " )
2826repo=$( realpath " $script_path /../" )
2927generator=$( realpath " $script_path /../../elastic-client-generator-js" )
@@ -34,24 +32,21 @@ TASK=$1
3432TASK_ARGS=()
3533VERSION=$2
3634STACK_VERSION=$VERSION
37- NODE_JS_VERSION=16
38- WORKFLOW=${WORKFLOW-staging}
3935set -euo pipefail
4036
4137product=" elastic/elasticsearch-js"
4238output_folder=" .ci/output"
39+ codegen_folder=" .ci/output"
4340OUTPUT_DIR=" $repo /${output_folder} "
44- REPO_BINDING=" ${OUTPUT_DIR} :/sln/${output_folder} "
41+ # REPO_BINDING="${OUTPUT_DIR}:/sln/${output_folder}"
42+ NODE_JS_VERSION=18
43+ WORKFLOW=${WORKFLOW-staging}
4544mkdir -p " $OUTPUT_DIR "
4645
4746echo -e " \033[34;1mINFO:\033[0m PRODUCT ${product} \033[0m"
4847echo -e " \033[34;1mINFO:\033[0m VERSION ${STACK_VERSION} \033[0m"
4948echo -e " \033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR} \033[0m"
5049
51- # ------------------------------------------------------- #
52- # Parse Command
53- # ------------------------------------------------------- #
54-
5550case $CMD in
5651 clean)
5752 echo -e " \033[36;1mTARGET: clean workspace $output_folder \033[0m"
@@ -104,8 +99,21 @@ case $CMD in
10499 # VERSION is BRANCH here for now
105100 TASK_ARGS=(" $VERSION " )
106101 ;;
102+ bumpmatrix)
103+ if [ -v $VERSION ]; then
104+ echo -e " \033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m"
105+ exit 1
106+ fi
107+ echo -e " \033[36;1mTARGET: bump stack in test matrix to version $VERSION \033[0m"
108+ TASK=bumpmatrix
109+ TASK_ARGS=(" $VERSION " )
110+ ;;
107111 * )
108- echo -e " \nUsage:\n\t $CMD is not supported right now\n"
112+ echo -e " \n'$CMD ' is not supported right now\n"
113+ echo -e " \nUsage:"
114+ echo -e " \t $0 release \$ VERSION\n"
115+ echo -e " \t $0 bump \$ VERSION"
116+ echo -e " \t $0 codegen \$ VERSION"
109117 exit 1
110118esac
111119
@@ -118,10 +126,8 @@ echo -e "\033[34;1mINFO: building $product container\033[0m"
118126
119127docker build \
120128 --file .ci/Dockerfile \
121- --tag ${product} \
122- --build-arg NODE_JS_VERSION=${NODE_JS_VERSION} \
123- --build-arg USER_ID=" $( id -u) " \
124- --build-arg GROUP_ID=" $( id -g) " \
129+ --tag " $product " \
130+ --build-arg NODE_JS_VERSION=" $NODE_JS_VERSION " \
125131 .
126132
127133# ------------------------------------------------------- #
@@ -131,14 +137,15 @@ docker build \
131137echo -e " \033[34;1mINFO: running $product container\033[0m"
132138
133139docker run \
134- --volume $repo :/usr/src/app \
135- --volume $generator :/usr/src/elastic-client-generator-js \
140+ --volume " $repo :/usr/src/app" \
141+ --volume " $generator :/usr/src/elastic-client-generator-js" \
136142 --volume /usr/src/app/node_modules \
137- --env " WORKFLOW=${WORKFLOW} " \
143+ -u " $( id -u) :$( id -g) " \
144+ --env " WORKFLOW=$WORKFLOW " \
138145 --name make-elasticsearch-js \
139146 --rm \
140147 $product \
141- node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}
148+ node .ci/make.mjs --task $TASK " ${TASK_ARGS[@]} "
142149
143150# ------------------------------------------------------- #
144151# Post Command tasks & checks
0 commit comments