Skip to content

Commit

Permalink
Merge branch 'main' into page-load-as-child-transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar authored Aug 5, 2024
2 parents 4785040 + 51a9fb8 commit 50df7b8
Show file tree
Hide file tree
Showing 186 changed files with 58,115 additions and 36,764 deletions.
3 changes: 0 additions & 3 deletions .ci/.jenkins_rum.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .ci/bump-elastic-stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: Bump elastic stack to latest version

actions:
default:
title: '[updatecli] Bump elastic stack version to {{ source "latestRelease" }}'
kind: github/pullrequest
spec:
labels:
- dependencies
scmid: default

scms:
default:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: elastic
repository: apm-agent-rum-js
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
branch: main
commitusingapi: true

sources:
latestRelease:
name: Get Latest Elastic Release
kind: githubrelease
transformers:
- trimprefix: v
spec:
owner: elastic
repository: elasticsearch
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
versionfilter:
kind: regex
pattern: ^v8\.(\d+)\.(\d+)$

conditions:
dockerTag:
name: Is docker image elasticsearch:{{ source "latestRelease" }} published
kind: dockerimage
spec:
image: elasticsearch
tag: '{{ source "latestRelease" }}'
sourceid: latestRelease

targets:

update-ci-workflow:
name: 'Update elastic stack version to {{ source "latestRelease" }}'
sourceid: latestRelease
scmid: default
kind: file
spec:
file: .github/workflows/ci.yml
content: >-
'{{ source `latestRelease` }}'
matchpattern: \'[0-9]+\.[0-9]+\.[0-9]+\'

update-microbenchmark-workflow:
name: 'Update elastic stack version to {{ source "latestRelease" }}'
sourceid: latestRelease
scmid: default
kind: file
spec:
file: .github/workflows/microbenchmark.yml
content: >-
'{{ source `latestRelease` }}'
matchpattern: \'[0-9]+\.[0-9]+\.[0-9]+\'
37 changes: 0 additions & 37 deletions .ci/bump-stack-release-version.sh

This file was deleted.

12 changes: 7 additions & 5 deletions .ci/docker/node-playwright/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Dockerfile for docker.elastic.co/observability-ci/node-playwright:12
#Dockerfile for docker.elastic.co/observability-ci/node-playwright:${NODEJS_VERSION}
# When changing Node version, please build the Docker image for RUM here:
# https://apm-ci.elastic.co/job/apm-shared/job/apm-docker-images-pipeline/build?delay=0sec
# Remember checking the 'rum' parameter
Expand All @@ -8,9 +8,9 @@ FROM ubuntu:bionic
# this second declaration is needed because ARG before FROM works differently. See https://docs.docker.com/compose/compose-file/#args
ARG NODEJS_VERSION

# 1. Install node12
# 1. Install node
RUN apt-get -qq update && apt-get -qq install -y curl && \
curl -sL https://deb.nodesource.com/setup_${NODEJS_VERSION}.x | bash - && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get -qq install -y nodejs

# 2. Install git (used to tag commit in benchmark runner)
Expand Down Expand Up @@ -99,13 +99,15 @@ RUN apt-get -qq install -y --no-install-recommends \
libxml2 \
libxslt1.1

# 4. Install Chrome unstable to run karma benchmark tests inside puppeteer
# 4. Install Chrome stable to run karma benchmark tests inside puppeteer
# before we were using the Chrome unstable, but with the unstable one the benchmarks were failing, karma launcher was crashing.
# The error was "Cannot start ChromeHeadless", no more details were provided by the tool.
RUN apt-get -qq install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get -qq update \
&& apt-get -qq install -y \
google-chrome-unstable \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
Expand Down
35 changes: 27 additions & 8 deletions .ci/docker/node-puppeteer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
#Dockerfile for docker.elastic.co/observability-ci/node-puppeteer:12
# When changing Node version, please build the Docker image for RUM here:
# https://apm-ci.elastic.co/job/apm-shared/job/apm-docker-images-pipeline/build?delay=0sec
# Remember checking the 'rum' parameter
ARG NODEJS_VERSION
FROM node:${NODEJS_VERSION}
FROM ubuntu:jammy
# this second declaration is needed because ARG before FROM works differently. See https://docs.docker.com/compose/compose-file/#args
ARG NODEJS_VERSION

# Install node
RUN apt-get update && apt-get install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -sL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODEJS_VERSION.x nodistro main" | \
tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && apt-get install nodejs -y && \
rm -rf /etc/apt/keyrings && rm /etc/apt/sources.list.d/nodesource.list

# the node-gyp we use is only compatible with Python versions less than 3.10,
# so we need to make sure we use a previous version
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq install -y software-properties-common g++ build-essential && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get -qq install -y python3.9

# 4.1 make python 3.9 the default version (for python and for python3)
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1

# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
RUN apt-get install -y wget && \
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y \
Expand All @@ -19,9 +38,9 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
ttf-freefont \
fonts-freefont-ttf \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

# Always put COPY instructions at the end, so that Docker will reuse the above layers on builds
COPY run-test.sh /run-test.sh
COPY run-test.sh /run-test.sh
5 changes: 0 additions & 5 deletions .ci/jobs/apm-agent-rum-mbp.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .ci/jobs/apm-agent-rum.yml

This file was deleted.

66 changes: 0 additions & 66 deletions .ci/jobs/defaults.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .ci/packer_cache.sh

This file was deleted.

65 changes: 65 additions & 0 deletions .ci/scripts/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

# Bash strict mode
set -eo pipefail

# Found current script directory
RELATIVE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Found project directory
BASE_PROJECT="$(dirname "$(dirname "${RELATIVE_DIR}")")"

## Buildkite specific configuration
if [ "${CI}" == "true" ] ; then
# If HOME is not set then use the Buildkite workspace
# that's normally happening when running in the CI
# owned by Elastic.
if [ -z "${HOME}" ] ; then
export HOME="${BUILDKITE_BUILD_CHECKOUT_PATH}"
export HOME
fi

# required when running the benchmark
PATH="${PATH}:${HOME}/.local/bin"
export PATH

echo 'Docker login is done in the Buildkite hooks'
fi

# Validate env vars
[ -z "${ES_USER_SECRET}" ] && echo "Environment variable 'ES_USER_SECRET' must be defined" && exit 1;
[ -z "${ES_PASS_SECRET}" ] && echo "Environment variable 'ES_PASS_SECRET' must be defined" && exit 1;
[ -z "${ES_URL_SECRET}" ] && echo "Environment variable 'ES_URL_SECRET' must be defined" && exit 1;
[ -z "${STACK_VERSION}" ] && echo "Environment variable 'STACK_VERSION' must be defined" && exit 1;

# Debug env vars
echo "Will run microbenchmarks on STACK_VERSION=${STACK_VERSION}"

# It does not fail so it runs for benchmark, load testing and then we report the error at the end.
set +e
status=0

# Run the benchmarks
REPORT_FILE="apm-agent-benchmark-results.json" "${BASE_PROJECT}/.ci/scripts/benchmarks.sh"

# Gather error if any
if [ $? -gt 0 ] ; then
status=1
fi

# Then we ship the data using the helper
sendBenchmark "${ES_USER_SECRET}" "${ES_PASS_SECRET}" "${ES_URL_SECRET}" "${BASE_PROJECT}/apm-agent-benchmark-results.json"

# Run the load testing
REPORT_FILE="apm-agent-load-testing-results.json" "${BASE_PROJECT}/.ci/scripts/load-testing.sh" "${STACK_VERSION}"

# Gather error if any
if [ $? -gt 0 ] ; then
status=1
fi

# Then we ship the data using the helper
sendBenchmark "${ES_USER_SECRET}" "${ES_PASS_SECRET}" "${ES_URL_SECRET}" "${BASE_PROJECT}/apm-agent-load-testing-results.json"

# Report status
exit $status
5 changes: 4 additions & 1 deletion .ci/scripts/benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash

USER_ID="$(id -u):$(id -g)"
NODEJS_VERSION=$(cat ./dev-utils/.node-version)
# The migration of this to Node.js 18 will wait. To update playwright (and browsers)
# to make it work in Node.js 18 and latest version in ubuntu (or another OS)
# will require us to invest a certain amount of time
NODEJS_VERSION=14

USER_ID="${USER_ID}" \
NODEJS_VERSION="${NODEJS_VERSION}" \
Expand Down
7 changes: 5 additions & 2 deletions .ci/scripts/load-testing.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env bash

STACK_VERSION=${1:-7.17.0}
STACK_VERSION=${1:-8.6.1}
USER_ID="$(id -u):$(id -g)"
NODEJS_VERSION=$(cat ./dev-utils/.node-version)
# The migration of this to Node.js 18 will wait. To update playwright (and browsers)
# to make it work in Node.js 18 and latest version in ubuntu (or another OS)
# will require us to invest a certain amount of time
NODEJS_VERSION=14

USER_ID="${USER_ID}" \
NODEJS_VERSION="${NODEJS_VERSION}" \
Expand Down
Loading

0 comments on commit 50df7b8

Please sign in to comment.