1
1
#! /usr/bin/env bash
2
-
3
2
# ------------------------------------------------------- #
4
3
#
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
7
5
#
8
6
# Must be called: ./.ci/make.sh <target> <params>
9
7
#
10
8
# Version: 1.1.0
11
9
#
12
10
# Targets:
13
11
# ---------------------------
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
20
19
#
21
20
# ------------------------------------------------------- #
22
21
23
22
# ------------------------------------------------------- #
24
23
# Bootstrap
25
24
# ------------------------------------------------------- #
26
-
27
25
script_path=$( dirname " $( realpath -s " $0 " ) " )
28
26
repo=$( realpath " $script_path /../" )
29
27
generator=$( realpath " $script_path /../../elastic-client-generator-js" )
@@ -34,24 +32,21 @@ TASK=$1
34
32
TASK_ARGS=()
35
33
VERSION=$2
36
34
STACK_VERSION=$VERSION
37
- NODE_JS_VERSION=16
38
- WORKFLOW=${WORKFLOW-staging}
39
35
set -euo pipefail
40
36
41
37
product=" elastic/elasticsearch-js"
42
38
output_folder=" .ci/output"
39
+ codegen_folder=" .ci/output"
43
40
OUTPUT_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}
45
44
mkdir -p " $OUTPUT_DIR "
46
45
47
46
echo -e " \033[34;1mINFO:\033[0m PRODUCT ${product} \033[0m"
48
47
echo -e " \033[34;1mINFO:\033[0m VERSION ${STACK_VERSION} \033[0m"
49
48
echo -e " \033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR} \033[0m"
50
49
51
- # ------------------------------------------------------- #
52
- # Parse Command
53
- # ------------------------------------------------------- #
54
-
55
50
case $CMD in
56
51
clean)
57
52
echo -e " \033[36;1mTARGET: clean workspace $output_folder \033[0m"
@@ -104,8 +99,21 @@ case $CMD in
104
99
# VERSION is BRANCH here for now
105
100
TASK_ARGS=(" $VERSION " )
106
101
;;
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
+ ;;
107
111
* )
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"
109
117
exit 1
110
118
esac
111
119
@@ -118,10 +126,8 @@ echo -e "\033[34;1mINFO: building $product container\033[0m"
118
126
119
127
docker build \
120
128
--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 " \
125
131
.
126
132
127
133
# ------------------------------------------------------- #
@@ -131,14 +137,15 @@ docker build \
131
137
echo -e " \033[34;1mINFO: running $product container\033[0m"
132
138
133
139
docker 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" \
136
142
--volume /usr/src/app/node_modules \
137
- --env " WORKFLOW=${WORKFLOW} " \
143
+ -u " $( id -u) :$( id -g) " \
144
+ --env " WORKFLOW=$WORKFLOW " \
138
145
--name make-elasticsearch-js \
139
146
--rm \
140
147
$product \
141
- node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}
148
+ node .ci/make.mjs --task $TASK " ${TASK_ARGS[@]} "
142
149
143
150
# ------------------------------------------------------- #
144
151
# Post Command tasks & checks
0 commit comments