Skip to content

Commit 61e18aa

Browse files
authored
Merge pull request #2 from elastic/setup-pipeline-by-catalog-info
Setup pipeline by catalog info
2 parents cac4aa4 + d5dd4cc commit 61e18aa

File tree

11 files changed

+300
-0
lines changed

11 files changed

+300
-0
lines changed

.buildkite/pipeline.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
agents:
2+
provider: aws
3+
instanceType: m6g.xlarge
4+
imagePrefix: drivah-ubuntu-2204-aarch64
5+
6+
steps:
7+
- label: ":buildah: Building Container Images for ARM64"
8+
branches: "*"
9+
command: |
10+
buildah --version
11+
drivah build --changed-since=main ./containers/arm64
12+
13+
# - label: ":buildah: Building Container Images for AMD64"
14+
# branches: "*"
15+
# command: |
16+
# buildah --version
17+
# drivah build --changed-since=main ./.buildkite/containers/amd64

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
max_line_length = 120

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode
2+
.idea
3+
4+
workdir
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM centos:7
2+
3+
ARG GROUP_ID=1000
4+
ARG USER_ID=1000
5+
6+
RUN groupadd --force --gid $GROUP_ID node
7+
RUN adduser --gid $GROUP_ID --uid $USER_ID node
8+
9+
RUN ulimit -n 1024 \
10+
&& yum install -y epel-release \
11+
&& yum install -y centos-release-scl-rh \
12+
&& yum upgrade -y \
13+
&& yum install -y \
14+
git \
15+
curl \
16+
make \
17+
python2 \
18+
python3 \
19+
ccache \
20+
xz-utils \
21+
devtoolset-9 \
22+
glibc-devel
23+
24+
COPY --chown=node:node entrypoint.sh /home/node/entrypoint.sh
25+
COPY --chown=node:node re2_entrypoint.sh /home/node/re2_entrypoint.sh
26+
27+
USER node
28+
29+
VOLUME /home/node/workdir
30+
31+
ENTRYPOINT [ "/home/node/entrypoint.sh" ]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[container.image]
2+
names = ["docker.elastic.co/ci-agent-images/kibana/custom-nodejs-builder"]
3+
tags = ["amd64-0.1"]
4+
5+
[container.image.build_args]
6+
GROUP_ID = 1000
7+
USER_ID = 1000
8+
9+
[docker]
10+
build_flags = [
11+
"--progress=plain",
12+
"--platform=linux/amd64"
13+
]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
release_url_base="$1"
7+
full_version="$2"
8+
config_flags=${3:-""} #"--without-dtrace --without-npm --without-etw"
9+
10+
if [[ $(arch) == x86_64 ]]; then
11+
architecture="x64";
12+
else
13+
architecture="arm64"
14+
fi
15+
16+
cd "/home/node/workdir/src/node-${full_version}"
17+
18+
# Compile from source
19+
export CCACHE_DIR="/home/node/workdir/.ccache-${architecture}"
20+
export CC="ccache gcc"
21+
export CXX="ccache g++"
22+
23+
. /opt/rh/devtoolset-9/enable
24+
25+
make -j"$(getconf _NPROCESSORS_ONLN)" binary V= \
26+
DESTCPU="$architecture" \
27+
ARCH="$architecture" \
28+
VARIATION="glibc-217" \
29+
DISTTYPE="release" \
30+
RELEASE_URLBASE="$release_url_base" \
31+
CONFIG_FLAGS="$config_flags"
32+
33+
mkdir -p /home/node/workdir/dist/
34+
mv node-*.tar.?z /home/node/workdir/dist/
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
re2_full_version="$1"
7+
node_full_version="$2"
8+
node_download_base_url="$3"
9+
10+
if [[ $(arch) == x86_64 ]]; then
11+
architecture="x64";
12+
else
13+
architecture="arm64"
14+
fi
15+
16+
cd /home/node/workdir
17+
mkdir -p dist/
18+
mkdir -p src/
19+
20+
## Download and unpack Node.js binary if needed.
21+
node_folder_name="node-${node_full_version}-linux-${architecture}"
22+
npm_binary="/home/node/workdir/${node_folder_name}/bin/npm"
23+
if [ ! -f "$npm_binary" ]; then
24+
if [ ! -f "/home/node/workdir/$node_folder_name.tar.xz" ]; then
25+
curl -fsSLO --compressed "${node_download_base_url}/${node_folder_name}.tar.xz"
26+
fi
27+
28+
tar -xf "/home/node/workdir/${node_folder_name}.tar.xz"
29+
fi
30+
31+
cd src
32+
33+
## Download re2 source if needed.
34+
re2_source_folder="/home/node/workdir/src/node-re2-${re2_full_version}"
35+
if [ ! -d "$re2_source_folder" ]; then
36+
git clone --recurse-submodules --depth 1 --branch 1.17.4 https://github.com/uhop/node-re2.git "${re2_source_folder}"
37+
fi
38+
39+
cd "$re2_source_folder"
40+
export PATH="/home/node/workdir/${node_folder_name}/bin:$PATH"
41+
export DEVELOPMENT_SKIP_GETTING_ASSET=true
42+
43+
export CCACHE_DIR="/home/node/workdir/.ccache-re2-${architecture}"
44+
export CC="ccache gcc"
45+
export CXX="ccache g++"
46+
47+
. /opt/rh/devtoolset-9/enable
48+
49+
npm i --unsafe-perm=true
50+
npm run build --if-present
51+
npm test
52+
53+
mkdir -p /home/node/workdir/dist/
54+
cp "${re2_source_folder}/build/Release/re2.node" "/home/node/workdir/dist/linux-${architecture}-108"
55+
gzip -f "/home/node/workdir/dist/linux-${architecture}-108"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM centos:7
2+
3+
ARG GROUP_ID=1000
4+
ARG USER_ID=1000
5+
6+
RUN groupadd --force --gid $GROUP_ID node
7+
RUN adduser --gid $GROUP_ID --uid $USER_ID node
8+
9+
RUN ulimit -n 1024 \
10+
&& yum install -y epel-release \
11+
&& yum install -y centos-release-scl-rh \
12+
&& yum upgrade -y \
13+
&& yum install -y \
14+
git \
15+
curl \
16+
make \
17+
python2 \
18+
python3 \
19+
ccache \
20+
xz-utils \
21+
devtoolset-9 \
22+
glibc-devel
23+
24+
COPY --chown=node:node entrypoint.sh /home/node/entrypoint.sh
25+
COPY --chown=node:node re2_entrypoint.sh /home/node/re2_entrypoint.sh
26+
27+
USER node
28+
29+
VOLUME /home/node/workdir
30+
31+
ENTRYPOINT [ "/home/node/entrypoint.sh" ]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[container.image]
2+
names = ["docker.elastic.co/ci-agent-images/kibana/custom-nodejs-builder"]
3+
tags = ["arm64-0.1"]
4+
5+
[container.image.build_args]
6+
GROUP_ID = 1000
7+
USER_ID = 1000
8+
9+
[docker]
10+
build_flags = [
11+
"--progress=plain",
12+
"--platform=linux/arm64",
13+
"--build-arg=\"GROUP_ID=1000\"",
14+
"--build-arg=\"USER_ID=1000\""
15+
]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
release_url_base="$1"
7+
full_version="$2"
8+
config_flags=${3:-""} #"--without-dtrace --without-npm --without-etw"
9+
10+
if [[ $(arch) == x86_64 ]]; then
11+
architecture="x64";
12+
else
13+
architecture="arm64"
14+
fi
15+
16+
cd "/home/node/workdir/src/node-${full_version}"
17+
18+
# Compile from source
19+
export CCACHE_DIR="/home/node/workdir/.ccache-${architecture}"
20+
export CC="ccache gcc"
21+
export CXX="ccache g++"
22+
23+
. /opt/rh/devtoolset-9/enable
24+
25+
make -j"$(getconf _NPROCESSORS_ONLN)" binary V= \
26+
DESTCPU="$architecture" \
27+
ARCH="$architecture" \
28+
VARIATION="glibc-217" \
29+
DISTTYPE="release" \
30+
RELEASE_URLBASE="$release_url_base" \
31+
CONFIG_FLAGS="$config_flags"
32+
33+
mkdir -p /home/node/workdir/dist/
34+
mv node-*.tar.?z /home/node/workdir/dist/

0 commit comments

Comments
 (0)