Skip to content

Commit

Permalink
[Tech debt] Upgrade Node.js version to 16.14.2 to match Kibana (#5749)
Browse files Browse the repository at this point in the history
* Upgrade all node versions to 16.14.2

* Update docker CI tags

* Update Docker docs further with more findings
  • Loading branch information
Constance authored Mar 30, 2022
1 parent 491840e commit 1a06752
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .ci/jobs/elastic+eui+pull-request-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#!/usr/local/bin/runbld
export NVM_DIR="/var/lib/jenkins/.nvm"
[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh"
NODE_VERSION=16.13.1
NODE_VERSION=16.14.2
nvm install ${NODE_VERSION}
nvm use ${NODE_VERSION} --delete-prefix
npm run test-docker
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
16.14.2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "lib",
"module": "es",
"types": "eui.d.ts",
"docker_image": "node:16.13.1",
"docker_image": "node:16.14.2",
"sideEffects": [
"*.css",
"*.scss"
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/build_docs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

NODE_IMG="docker.elastic.co/eui/ci:2.0"
NODE_IMG="docker.elastic.co/eui/ci:3.0"

# Compile using node image
echo "Building docs using ${NODE_IMG} Docker image"
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy/deploy_docs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if [[ "$1" != "nodocker" ]]; then
--rm -i \
--volume $PWD:/app \
--workdir /app \
node:16.13.1 \
node:16.14.2 \
bash -c 'git tag | xargs npx semver' | tail -n 1)

# Run this script from inside the docker container, using google/cloud-sdk image
Expand Down
4 changes: 2 additions & 2 deletions scripts/docker-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Derived from the zenato/puppeteer Docker image
# https://github.com/zenato/docker-puppeteer/blob/master/Dockerfile

# >=12.0 required (for cypress), but latest right now is 16.13.1
FROM node:16.13.1
# >=12.0 required (for cypress), but latest right now is 16.14.2
FROM node:16.14.2

# See https://crbug.com/795759
RUN apt-get update && apt-get install -yq libgconf-2-4
Expand Down
15 changes: 13 additions & 2 deletions scripts/docker-ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To start, you'll need to setup a local Docker environment. See [Docker's "Get st

### Build a new image

From this directory:
From the `scripts/docker-ci` directory:

```bash
docker build [--no-cache] [--tag ci:x.x] .
Expand All @@ -34,6 +34,15 @@ docker build [--no-cache] [--tag ci:x.x] .
* Use the `--no-cache` option if attempting the upgrade environment installations, like `node.js`, for instance.
* Use the `--tag` option to give the image a reference name. Helpful if you plan on running the image locally (see next step).

> :warning: If you receive a `Cannot connect to Docker daemon` error, you can use `docker-machine` (despite its deprecated status) to start a daemon.
```bash
brew install docker-machine
docker-machine create --driver virtualbox default # `docker-machine restart` if you've already set up docker-machine
eval "$(docker-machine env default)"
docker ps
```

### Test a new image locally

To run the [`test-docker`](../test-docker.js) script with the new image locally, you'll need to replace the image name line in the `docker run ...` command (`docker.elastic.co/eui/ci:x.x`) with the new image ID or tag name (if set during the build with `--tag`).
Expand All @@ -60,7 +69,9 @@ docker tag IMAGE_ID docker.elastic.co/eui/ci:x.x
docker push docker.elastic.co/eui/ci:x.x
```

> :warning: If you receive a `unauthorized: authentication required` error after `docker push`, try running `docker logout docker.elastic.co` and then obtaining a new login command from the above `docker login` link again.
> :warning: There is a ~3 minute JWT timeout for docker image uploads (set by Elastic for security reasons and cannot be changed). If you receive a `unauthorized: authentication required` error after `docker push`, this means that your upload has timed out. Since docker uploads images in concurrent layers, it should still have uploaded a portion of the image.
>
> Simply repeat your `docker push` command until the image has fully uploaded (which may take 2-3+ attempts), or consider uploading via wired ethernet for faster upload speeds.
### Use a published image

Expand Down
4 changes: 2 additions & 2 deletions scripts/test-docker.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const { execSync } = require('child_process');

execSync('docker pull docker.elastic.co/eui/ci:2.0', {
execSync('docker pull docker.elastic.co/eui/ci:3.0', {
stdio: 'inherit',
});
/* eslint-disable-next-line no-multi-str */
execSync("docker run \
-i --rm --cap-add=SYS_ADMIN --volume=$(pwd):/app --workdir=/app \
-e GIT_COMMITTER_NAME=test -e GIT_COMMITTER_EMAIL=test -e HOME=/tmp \
--user=$(id -u):$(id -g) \
docker.elastic.co/eui/ci:2.0 \
docker.elastic.co/eui/ci:3.0 \
bash -c 'npm config set spin false \
&& /opt/yarn*/bin/yarn \
&& yarn cypress install \
Expand Down

0 comments on commit 1a06752

Please sign in to comment.