Skip to content

Commit

Permalink
[updatecli] update elastic stack version for testing 8.12.0-9bbde39d-…
Browse files Browse the repository at this point in the history
…SNAPSHOT (#3153)

* Add go benchmark as part of the buildkite pipeline (#3141)

* add initial benchmark for PR
* Add steps for comparing and baseline
* Parse go benchmark results with gobenchdata
* Allow gobenchdata failure to not block
---------
Co-authored-by: Alexandros Sapranidis <[email protected]>

* [Release] update version (#3145)

Co-authored-by: Julien Lind <[email protected]>

* chore: Update snapshot.yml

Made with ❤️️ by updatecli

* chore: Update snapshot.yml

Made with ❤️️ by updatecli

* chore: Update snapshot.yml

Made with ❤️️ by updatecli

---------

Co-authored-by: Julien Lind <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: apmmachine <[email protected]>
  • Loading branch information
4 people authored Dec 11, 2023
1 parent c232532 commit 008af81
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 104 deletions.
36 changes: 36 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,42 @@ steps:
image: "${GO_AGENT_IMAGE}"
cpu: "8"
memory: "4G"

- group: "Performance test"
key: "performance-test"
steps:
- label: "Run go benchmark for PR branch"
key: "go-benchmark-pr"
command: ".buildkite/scripts/run_benchmark.sh pr"
artifact_paths:
- build/next.out
agents:
provider: "gcp"
machineType: "c2-standard-8"

- label: "Run go benchmark for ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
key: "go-benchmark-base"
command: ".buildkite/scripts/run_benchmark.sh base"
artifact_paths:
- build/base.out
agents:
provider: "gcp"
machineType: "c2-standard-8"

- label: "Compare results"
key: "go-benchmark-compare"
command: ".buildkite/scripts/run_benchmark.sh compare"
artifact_paths:
- build/failed_summary.md
- build/failed_report.json
- build/full_report.json
depends_on:
- go-benchmark-pr
- go-benchmark-base
agents:
provider: "gcp"

depends_on: "check"

- group: "Run tests"
key: "tests"
Expand Down
95 changes: 95 additions & 0 deletions .buildkite/scripts/run_benchmark.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/bin/bash

set -euo pipefail

source .buildkite/scripts/common.sh

add_bin_path

with_go

export TYPE=${1}
#export BRANCH="${BUILDKITE_BRANCH}"
export BENCHMARK_ARGS="-count=8 -benchmem"

if [[ ${TYPE} == "pr" ]]; then
echo "Starting the go benchmark for the pull request"
BENCH_BASE=next.out make benchmark
BENCH=$(cat build/next.out)
buildkite-agent annotate --style 'info' --context "gobench_pr" --append << _EOF_
#### Benchmark for pull request
<details><summary>go bench output</summary>
\`\`\`bash
${BENCH}
\`\`\`
</details>
Download <a href="artifact://build/next.out">next.out</a>
_EOF_
fi

if [[ ${TYPE} == "base" ]]; then
echo "Starting the go benchmark for the pull request"
git checkout ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
BENCH_BASE=base.out make benchmark
BENCH=$(cat build/base.out)
buildkite-agent annotate --style 'info' --context "gobench_base" --append << _EOF_
#### Benchmark for the ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
<details><summary>go bench output for ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}</summary>
\`\`\`bash
${BENCH}
\`\`\`
</details>
Download <a href="artifact://build/base.out">${BUILDKITE_PULL_REQUEST_BASE_BRANCH}.out</a>
_EOF_
fi

if [[ ${TYPE} == "compare" ]]; then
echo "Comparing go benchmarks"
go install go.bobheadxi.dev/gobenchdata@latest
buildkite-agent artifact download "build/base.out" .
buildkite-agent artifact download "build/next.out" .

cat build/base.out| gobenchdata --json build/base.json
cat build/next.out| gobenchdata --json build/next.json
set +e # suppress error handling of gobenchdata
gobenchdata checks eval build/base.json build/next.json --json build/full_report.json
status=$(jq -r '.Status' build/full_report.json)
if [[ $status == "fail" ]]; then
cat build/full_report.json| \
jq 'del(.Checks.timePerOp.Diffs[]| select(.Status == "pass") )'| \
tee build/failed_report.json
gobenchdata checks report build/failed_report.json | tee build/failed_summary.md
BENCH_COMPARE=$(cat build/failed_summary.md)
buildkite-agent annotate --style 'error' --context "benchstat" --append << _EOF_
#### Benchmark comparison
<details><summary>Comparison table of benchmark results of HEAD compared to ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}</summary>
${BENCH_COMPARE}
</details>
Download <a href="artifact://build/failed_summary.md">failed_summary.md</a> , <a href="artifact://build/full_report.json">full_report.json</a>
_EOF_
#exit 1 # fail the build if the status is fail
else
BENCH_COMPARE=$(gobenchdata checks report build/full_report.json)
buildkite-agent annotate --style 'success' --context "benchstat" --append << _EOF_
#### Benchmark comparison
<details><summary>No significant performance issue detect against ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}</summary>
${BENCH_COMPARE}
</details>
Download <a href="artifact://build/full_report.json">full_report.json</a>
_EOF_
fi
fi


101 changes: 0 additions & 101 deletions .github/workflows/benchmark.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ dev-tools/cloud/terraform/*.tfvars*

.service_token*
.kibana_service_token


# direnv
.envrc*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BUILDER_IMAGE=docker.elastic.co/beats-dev/golang-crossbuild:${GO_VERSION}-main-d
#Benchmark related targets
BENCH_BASE ?= benchmark-$(COMMIT).out
BENCH_NEXT ?=
BENCHMARK_ARGS := -count=8
BENCHMARK_ARGS := -count=8 -benchmem
BENCHMARK_PACKAGE ?= ./...
BENCHMARK_FILTER ?= Bench

Expand Down
2 changes: 1 addition & 1 deletion dev-tools/integration/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ELASTICSEARCH_VERSION=8.12.0-9d443b17-SNAPSHOT
ELASTICSEARCH_VERSION=8.12.0-9bbde39d-SNAPSHOT
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=changeme
TEST_ELASTICSEARCH_HOSTS=localhost:9200
Expand Down
9 changes: 9 additions & 0 deletions gobenchdata-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
checks:
- name: timePerOp
description: |-
This check is set to fail when there are benchmark tests that are slower than the defined threshold
package: .
benchmarks: []
diff: (current.NsPerOp - base.NsPerOp) / base.NsPerOp * 100
thresholds:
max: 10
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ package version

// DefaultVersion is the current release version of Fleet-server, this version must match the
// Elastic Agent version.
const DefaultVersion = "8.12.0"
const DefaultVersion = "8.13.0"

0 comments on commit 008af81

Please sign in to comment.