Skip to content

action: support for benchmark using GitHub actions in conjunction with Buildkite #3374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ee34868
ci: remove Jenkins
v1v May 24, 2023
134f661
support for benchmark using GitHub actions in conjunction with Buildkite
v1v May 24, 2023
25da754
chore: for testing purposes
v1v May 24, 2023
3a492a4
remove any Jenkins references
v1v May 24, 2023
3ce8b75
add buildkite log echo for helping with collapsing the output in the UI
v1v May 24, 2023
40be52b
action: group logs
v1v May 24, 2023
7e6f10c
Revert "action: group logs"
v1v May 24, 2023
0844dd3
move the traces earlier
v1v May 24, 2023
9981263
debug what's going on
v1v May 24, 2023
333a15d
use the installation steps explained in https://github.com/nvm-sh/nvm
v1v May 24, 2023
2a12181
use install manually as explained in https://github.com/nvm-sh/nvm\#m…
v1v May 25, 2023
004273d
Revert "use install manually as explained in https://github.com/nvm-s…
v1v May 25, 2023
73f6c34
install only if it is not installed
v1v May 25, 2023
c1a471f
debug whether shell login
v1v May 25, 2023
f4acdc8
avoid errors when calling the nvm for the first time
v1v May 25, 2023
5386243
support buildkite missbehaviour
v1v May 25, 2023
daed361
remove debug
v1v May 25, 2023
ac1e989
revert changes to be similar to the previous configuration
v1v May 25, 2023
675b986
debug
v1v May 25, 2023
63f3c2e
reduce log traces
v1v May 25, 2023
63b56d7
Update .ci/scripts/bench.sh
v1v May 26, 2023
be6421a
Apply suggestions from code review
v1v May 26, 2023
6e45e21
Apply suggestions from code review
v1v May 26, 2023
056e2c5
Apply suggestions from code review
v1v Jun 2, 2023
581fbbb
ci: small format cleanup
amannocci Jun 30, 2023
96e60cf
ci: let's debug nvm install
amannocci Jun 30, 2023
419e217
ci: correct benchmark prepare step
amannocci Jun 30, 2023
b0804c1
ci: flush positional arguments and use major version
amannocci Jun 30, 2023
a4535eb
ci: properly set NODE_VERSION env var
amannocci Jun 30, 2023
f0c511a
ci: use nvmrc instead of explicit value
amannocci Jul 3, 2023
76c86e3
ci: small cleanup
amannocci Jul 3, 2023
50f952e
ci: last cleanup before merge
amannocci Jul 6, 2023
edcee09
ci: remove leftover jenkins job scheduling
amannocci Jul 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 0 additions & 97 deletions .ci/Jenkinsfile

This file was deleted.

44 changes: 0 additions & 44 deletions .ci/jobs/apm-agent-nodejs-mbp.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .ci/jobs/apm-agent-nodejs-schedule-daily.yml

This file was deleted.

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

This file was deleted.

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

This file was deleted.

64 changes: 0 additions & 64 deletions .ci/schedule-daily.groovy

This file was deleted.

32 changes: 32 additions & 0 deletions .ci/scripts/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/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}")")"

# Run the microbenchmark in Buildkite and for such
# it configures the required settings in the Buildkite runners
# to execute the benchmarks afterwards

## 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
HOME="${BUILDKITE_BUILD_CHECKOUT_PATH}"
export HOME
fi
fi

# Run benchmark
echo "--- Execute benchmarks"
"${BASE_PROJECT}/.ci/scripts/run-benchmarks.sh" "apm-agent-benchmark-results.json" "$(cat "${BASE_PROJECT}/.nvmrc")"

echo "--- Send benchmark results"
sendBenchmark "${ES_USER_SECRET}" "${ES_PASS_SECRET}" "${ES_URL_SECRET}" "apm-agent-benchmark-results.json"
29 changes: 22 additions & 7 deletions .ci/scripts/prepare-benchmarks-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,42 @@
# Usage:
# NODE_VERSION=...
# source .../prepare-benchmarks-env.sh
#
# Note: echo "--- ..." helps with presenting the output in Buildkite.
#

set -xeo pipefail

if [[ -z "$NODE_VERSION" ]]; then
if [[ -z "${NODE_VERSION}" ]]; then
echo "prepare-benchmarks-env.sh: error: NODE_VERSION envvar is not set" >&2
exit 1
fi

echo "--- Download nvm"
# This particular configuration is required to be installed in the baremetal
curl -sS -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
export NVM_DIR="${HOME}/.nvm"

echo "--- Install nvm"
set +x # Disable xtrace because output using nvm.sh is huge.
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# Flush positional arguments
shift $#
if [ -s "${NVM_DIR}/nvm.sh" ] ; then
\. "${NVM_DIR}/nvm.sh"
fi

# Check nvm command is available
command -v nvm
nvm --version

echo "--- Run nvm install ${NODE_VERSION}"
nvm install "${NODE_VERSION}"
set -x

npm config list
npm install

# Check node command is available
node --version
npm --version

echo "--- Install dependencies"
set -x
npm config list
npm install
17 changes: 14 additions & 3 deletions .ci/scripts/run-benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
#!/usr/bin/env bash
set -xueo pipefail

# 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}")")"

# Arguments
RESULT_FILE=$1
NODE_VERSION=$2
if [[ -z "$RESULT_FILE" || -z "$NODE_VERSION" ]]; then
echo "usage: run-benchmarks.sh RESULT_FILE NODE_VERSION"
exit 1
fi

SCRIPTPATH=$(dirname "$0")
source ./${SCRIPTPATH}/prepare-benchmarks-env.sh
# Prepare benchmark environment
export NODE_VERSION="${NODE_VERSION}"
source "${RELATIVE_DIR}/prepare-benchmarks-env.sh"

# Run benchmark
npm run bench:ci "${RESULT_FILE}" "${NODE_VERSION}"
Loading