Fix 8.10 codegen (#2067)

This commit is contained in:
Josh Mock
2023-11-07 12:13:12 -06:00
committed by GitHub
parent 8d96cb4342
commit 20d7cab748
3 changed files with 61 additions and 15 deletions

View File

@ -6,7 +6,7 @@ steps:
env: env:
NODE_VERSION: "{{ matrix.nodejs }}" NODE_VERSION: "{{ matrix.nodejs }}"
TEST_SUITE: "{{ matrix.suite }}" TEST_SUITE: "{{ matrix.suite }}"
STACK_VERSION: 8.8.0-SNAPSHOT STACK_VERSION: 8.10.3-SNAPSHOT
matrix: matrix:
setup: setup:
suite: suite:

30
.ci/Dockerfile Normal file
View File

@ -0,0 +1,30 @@
ARG NODE_JS_VERSION=${NODE_JS_VERSION:-18}
FROM node:${NODE_JS_VERSION}
ARG BUILDER_UID=1000
ARG BUILDER_GID=1000
ENV BUILDER_USER elastic
ENV BUILDER_GROUP elastic
# install zip util
RUN apt-get clean -y && \
apt-get update -y && \
apt-get install -y zip
# Set user permissions and directory
RUN (id -g ${BUILDER_GID} || groupadd --system -g ${BUILDER_GID} ${BUILDER_GROUP}) \
&& (id -u ${BUILDER_UID} || useradd --system --shell /bin/bash -u ${BUILDER_UID} -g ${BUILDER_GID} -m elastic) \
&& mkdir -p /usr/src/elasticsearch-js \
&& chown -R ${BUILDER_UID}:${BUILDER_GID} /usr/src/
WORKDIR /usr/src/elasticsearch-js
# run remainder of commands as non-root user
USER ${BUILDER_UID}:${BUILDER_GID}
# install dependencies
COPY package.json .
RUN npm install --production=false
# copy project files
COPY . .

View File

@ -131,7 +131,7 @@ esac
echo -e "\033[34;1mINFO: building $product container\033[0m" echo -e "\033[34;1mINFO: building $product container\033[0m"
docker build \ docker build \
--file .buildkite/Dockerfile \ --file .ci/Dockerfile \
--tag "$product" \ --tag "$product" \
--build-arg NODE_JS_VERSION="$NODE_JS_VERSION" \ --build-arg NODE_JS_VERSION="$NODE_JS_VERSION" \
--build-arg "BUILDER_UID=$(id -u)" \ --build-arg "BUILDER_UID=$(id -u)" \
@ -144,7 +144,22 @@ docker build \
echo -e "\033[34;1mINFO: running $product container\033[0m" echo -e "\033[34;1mINFO: running $product container\033[0m"
docker run \ if [[ -z "${BUILDKITE+x}" ]] && [[ -z "${CI+x}" ]] && [[ -z "${GITHUB_ACTIONS+x}" ]]; then
echo -e "\033[34;1mINFO: Running in local mode"
docker run \
-u "$(id -u):$(id -g)" \
--volume "$repo:/usr/src/elasticsearch-js" \
--volume /usr/src/elasticsearch-js/node_modules \
--volume "$(realpath $repo/../elastic-client-generator-js):/usr/src/elastic-client-generator-js" \
--env "WORKFLOW=$WORKFLOW" \
--name make-elasticsearch-js \
--rm \
$product \
/bin/bash -c "mkdir -p /usr/src/elastic-client-generator-js/output && \
node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}"
else
echo -e "\033[34;1mINFO: Running in CI mode"
docker run \
--volume "$repo:/usr/src/elasticsearch-js" \ --volume "$repo:/usr/src/elasticsearch-js" \
--volume /usr/src/elasticsearch-js/node_modules \ --volume /usr/src/elasticsearch-js/node_modules \
-u "$(id -u):$(id -g)" \ -u "$(id -u):$(id -g)" \
@ -157,6 +172,7 @@ docker run \
mkdir -p /usr/src/elastic-client-generator-js/output && \ mkdir -p /usr/src/elastic-client-generator-js/output && \
cd /usr/src/elasticsearch-js && \ cd /usr/src/elasticsearch-js && \
node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}" node .ci/make.mjs --task $TASK ${TASK_ARGS[*]}"
fi
# ------------------------------------------------------- # # ------------------------------------------------------- #
# Post Command tasks & checks # Post Command tasks & checks