Skip to content

Commit 20d7cab

Browse files
authored
Fix 8.10 codegen (#2067)
1 parent 8d96cb4 commit 20d7cab

File tree

3 files changed

+61
-15
lines changed

3 files changed

+61
-15
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ steps:
66
env:
77
NODE_VERSION: "{{ matrix.nodejs }}"
88
TEST_SUITE: "{{ matrix.suite }}"
9-
STACK_VERSION: 8.8.0-SNAPSHOT
9+
STACK_VERSION: 8.10.3-SNAPSHOT
1010
matrix:
1111
setup:
1212
suite:

.ci/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
ARG NODE_JS_VERSION=${NODE_JS_VERSION:-18}
2+
FROM node:${NODE_JS_VERSION}
3+
4+
ARG BUILDER_UID=1000
5+
ARG BUILDER_GID=1000
6+
ENV BUILDER_USER elastic
7+
ENV BUILDER_GROUP elastic
8+
9+
# install zip util
10+
RUN apt-get clean -y && \
11+
apt-get update -y && \
12+
apt-get install -y zip
13+
14+
# Set user permissions and directory
15+
RUN (id -g ${BUILDER_GID} || groupadd --system -g ${BUILDER_GID} ${BUILDER_GROUP}) \
16+
&& (id -u ${BUILDER_UID} || useradd --system --shell /bin/bash -u ${BUILDER_UID} -g ${BUILDER_GID} -m elastic) \
17+
&& mkdir -p /usr/src/elasticsearch-js \
18+
&& chown -R ${BUILDER_UID}:${BUILDER_GID} /usr/src/
19+
20+
WORKDIR /usr/src/elasticsearch-js
21+
22+
# run remainder of commands as non-root user
23+
USER ${BUILDER_UID}:${BUILDER_GID}
24+
25+
# install dependencies
26+
COPY package.json .
27+
RUN npm install --production=false
28+
29+
# copy project files
30+
COPY . .

.ci/make.sh

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ esac
131131
echo -e "\033[34;1mINFO: building $product container\033[0m"
132132

133133
docker build \
134-
--file .buildkite/Dockerfile \
134+
--file .ci/Dockerfile \
135135
--tag "$product" \
136136
--build-arg NODE_JS_VERSION="$NODE_JS_VERSION" \
137137
--build-arg "BUILDER_UID=$(id -u)" \
@@ -144,19 +144,35 @@ docker build \
144144

145145
echo -e "\033[34;1mINFO: running $product container\033[0m"
146146

147-
docker run \
148-
--volume "$repo:/usr/src/elasticsearch-js" \
149-
--volume /usr/src/elasticsearch-js/node_modules \
150-
-u "$(id -u):$(id -g)" \
151-
--env "WORKFLOW=$WORKFLOW" \
152-
--name make-elasticsearch-js \
153-
--rm \
154-
$product \
155-
/bin/bash -c "cd /usr/src && \
156-
git clone https://$CLIENTS_GITHUB_TOKEN@github.com/elastic/elastic-client-generator-js.git && \
157-
mkdir -p /usr/src/elastic-client-generator-js/output && \
158-
cd /usr/src/elasticsearch-js && \
159-
node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}"
147+
if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}" ]]; then
148+
echo -e "\033[34;1mINFO: Running in local mode"
149+
docker run \
150+
-u "$(id -u):$(id -g)" \
151+
--volume "$repo:/usr/src/elasticsearch-js" \
152+
--volume /usr/src/elasticsearch-js/node_modules \
153+
--volume "$(realpath $repo/../elastic-client-generator-js):/usr/src/elastic-client-generator-js" \
154+
--env "WORKFLOW=$WORKFLOW" \
155+
--name make-elasticsearch-js \
156+
--rm \
157+
$product \
158+
/bin/bash -c "mkdir -p /usr/src/elastic-client-generator-js/output && \
159+
node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}"
160+
else
161+
echo -e "\033[34;1mINFO: Running in CI mode"
162+
docker run \
163+
--volume "$repo:/usr/src/elasticsearch-js" \
164+
--volume /usr/src/elasticsearch-js/node_modules \
165+
-u "$(id -u):$(id -g)" \
166+
--env "WORKFLOW=$WORKFLOW" \
167+
--name make-elasticsearch-js \
168+
--rm \
169+
$product \
170+
/bin/bash -c "cd /usr/src && \
171+
git clone https://$CLIENTS_GITHUB_TOKEN@github.com/elastic/elastic-client-generator-js.git && \
172+
mkdir -p /usr/src/elastic-client-generator-js/output && \
173+
cd /usr/src/elasticsearch-js && \
174+
node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}"
175+
fi
160176

161177
# ------------------------------------------------------- #
162178
# Post Command tasks & checks

0 commit comments

Comments
 (0)