Skip to content

Commit 4229624

Browse files
authored
Merge pull request #4 from elastic/docker-manual-upload
Pipeline and scripts for custom node 18 build (with glibc 2.17)
2 parents 61e18aa + 7ce4d9b commit 4229624

File tree

17 files changed

+256
-240
lines changed

17 files changed

+256
-240
lines changed

.buildkite/pipeline.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,38 @@
1-
agents:
2-
provider: aws
3-
instanceType: m6g.xlarge
4-
imagePrefix: drivah-ubuntu-2204-aarch64
1+
env:
2+
TARGET_VERSION: 18.16.1
53

64
steps:
7-
- label: ":buildah: Building Container Images for ARM64"
8-
branches: "*"
9-
command: |
10-
buildah --version
11-
drivah build --changed-since=main ./containers/arm64
5+
- label: Annotate build with node version
6+
command: buildkite-agent annotate "node.js v$${OVERRIDE_TARGET_VERSION:-$$TARGET_VERSION} with glibc 2.17" --style 'info'
7+
agents:
8+
queue: kibana-default
129

13-
# - label: ":buildah: Building Container Images for AMD64"
14-
# branches: "*"
15-
# command: |
16-
# buildah --version
17-
# drivah build --changed-since=main ./.buildkite/containers/amd64
10+
- label: Build custom node.js artifacts with glibc 2.17 for x64
11+
command:
12+
- scripts/create_build_images.sh
13+
- scripts/build_nodejs.sh
14+
- scripts/upload_nodejs_artifacts.sh
15+
env:
16+
ARCH: amd64
17+
agents:
18+
queue: c2-16
19+
timeout_in_minutes: 60 # ideally runs in ~30m
20+
21+
- label: Build custom node.js artifacts with glibc 2.17 for arm64
22+
command:
23+
- scripts/create_build_images.sh
24+
- scripts/build_nodejs.sh
25+
- scripts/upload_nodejs_artifacts.sh
26+
env:
27+
ARCH: arm64
28+
agents:
29+
queue: c2-60 # cross-compiling takes a while
30+
timeout_in_minutes: 180 # ideally runs in ~2hr
31+
32+
- wait
33+
34+
- label: Fix SHASUMS256.txt with newly built files' hashes
35+
command:
36+
- scripts/replace_sha_hashes.sh
37+
agents:
38+
queue: kibana-default

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.vscode
22
.idea
33

4-
workdir
4+
workdir/

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,46 @@
11
# kibana-custom-nodejs-builds
2-
Contains configuration and sources to build node.js for custom platforms
2+
Contains configuration and sources to build node.js
3+
4+
The main usecase right now is building `node.js@18+` with `[email protected]`, which is required for some older platforms. (More context: https://github.com/nodejs/unofficial-builds/pull/69)
5+
6+
## Running locally
7+
You can run most scripts locally on Mac/Linux. You'll need a few of the build/infra tools:
8+
- Docker
9+
- node.js
10+
- gsutil (`brew install google-cloud-sdk`)
11+
12+
Export some env variables required for the builds
13+
```sh
14+
export ARCH="arm64"
15+
export TARGET_VERSION="18.16.1"
16+
```
17+
18+
Then run individual scripts locally:
19+
```sh
20+
./scripts/create_build_images.sh
21+
./scripts/build_nodejs.sh
22+
```
23+
24+
## Docker image for node.js builds
25+
One of the main components we need to create in this step is a docker image for an environment that's set up for building `node.js`.
26+
27+
The bits for this component are in the [build-image-config](./build-image-config/) folder.
28+
29+
The docker image uses mounted directories as working directories, as well as outputting the artifacts in these directories.
30+
31+
32+
## Scripts for running the builds
33+
Most of the `buildkite` logic is sheltered in the [scripts](./scripts/) directory.
34+
35+
36+
37+
## Context
38+
During development, we found some more information that can be helpful as context, should anyone find this repo again
39+
40+
- This repository is only needed while
41+
- centos:7 / RHEL7 is supported by Elastic, and we ship node.js with Kibana
42+
- the unofficial-builds repo accepts a linux/arm64 build (https://github.com/nodejs/unofficial-builds/pull/83)
43+
- The created Docker images needn't be pushed
44+
- they can be used once for the build, then rebuilt in case we need to run it again
45+
- I decided to remove the `VARIATION` attribute on the node.js:
46+
- build would result in the variation showing up in the file and folder names, making the logistics more difficult, if we want to keep this mostly transparent for Kibana

containers/custom-nodejs-builder-amd64/Dockerfile renamed to build-image-config/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ RUN ulimit -n 1024 \
2222
glibc-devel
2323

2424
COPY --chown=node:node entrypoint.sh /home/node/entrypoint.sh
25-
COPY --chown=node:node re2_entrypoint.sh /home/node/re2_entrypoint.sh
2625

2726
USER node
2827

containers/custom-nodejs-builder-arm64/entrypoint.sh renamed to build-image-config/entrypoint.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ set -x
55

66
release_url_base="$1"
77
full_version="$2"
8-
config_flags=${3:-""} #"--without-dtrace --without-npm --without-etw"
8+
config_flags=${3:-""}
99

1010
if [[ $(arch) == x86_64 ]]; then
1111
architecture="x64";
1212
else
1313
architecture="arm64"
1414
fi
1515

16+
ls -la "/home/node/workdir/src"
17+
ls -la "/home/node/workdir/src/node-${full_version}"
18+
1619
cd "/home/node/workdir/src/node-${full_version}"
1720

1821
# Compile from source
@@ -25,10 +28,11 @@ export CXX="ccache g++"
2528
make -j"$(getconf _NPROCESSORS_ONLN)" binary V= \
2629
DESTCPU="$architecture" \
2730
ARCH="$architecture" \
28-
VARIATION="glibc-217" \
2931
DISTTYPE="release" \
3032
RELEASE_URLBASE="$release_url_base" \
3133
CONFIG_FLAGS="$config_flags"
3234

3335
mkdir -p /home/node/workdir/dist/
36+
chmod a+w /home/node/workdir/dist
3437
mv node-*.tar.?z /home/node/workdir/dist/
38+
chmod a+rwx /home/node/workdir/dist/*

catalog-info.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,3 @@ metadata:
88
links:
99
- title: Pipeline
1010
url: https://buildkite.com/elastic/kibana-custom-nodejs-builds
11-
12-
spec:
13-
type: buildkite-pipeline
14-
owner: group:kibana-operations
15-
system: buildkite
16-
implementation:
17-
apiVersion: buildkite.elastic.dev/v1
18-
kind: Pipeline
19-
metadata:
20-
name: kibana-custom-nodejs-builds
21-
spec:
22-
repository: elastic/kibana-custom-nodejs-builds
23-
pipeline_file: ".buildkite/pipeline.yml"
24-
teams:
25-
kibana-operations:
26-
access_level: MANAGE_BUILD_AND_READ
27-
everyone:
28-
access_level: READ_ONLY

containers/custom-nodejs-builder-amd64/drivah.toml

Lines changed: 0 additions & 13 deletions
This file was deleted.

containers/custom-nodejs-builder-amd64/entrypoint.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.

containers/custom-nodejs-builder-amd64/re2_entrypoint.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.

containers/custom-nodejs-builder-arm64/Dockerfile

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)