Skip to content
1 change: 1 addition & 0 deletions .buildkite/pipelines/periodic-micro-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ steps:
- label: periodic-micro-benchmarks
command: |
.ci/scripts/run-gradle.sh -p benchmarks/ run --args 'org.elasticsearch.benchmark._nightly -rf json -rff build/result.json'
.ci/scripts/index-micro-benchmark-results.sh
timeout_in_minutes: 300
agents:
provider: gcp
Expand Down
13 changes: 13 additions & 0 deletions .buildkite/scripts/index-micro-benchmark-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

METRICS_HOST=$(vault read -field=es_host /secret/performance/employees/cloud/esbench-metrics)
METRICS_INDEX_NAME="dummy-micro-benchmarks"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index name is temporary and will be replaced with a data stream soon

METRICS_USERNAME=$(vault read -field=es_username /secret/performance/employees/cloud/esbench-metrics)
METRICS_PASSWORD=$(vault read -field=es_password /secret/performance/employees/cloud/esbench-metrics)

jq -c '.[]' "benchmarks/build/result.json" | while read -r doc; do
curl -s -X POST "https://$METRICS_HOST/$METRICS_INDEX_NAME/_doc" \
-u "$METRICS_USERNAME:$METRICS_PASSWORD" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we leak the credentials here to console log? @brianseeders

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like it, but the vault read commands above need to happen inside of .buildkite/hooks/pre-command. If they happen there, then they will get automatically redacted if they are accidentally printed.

Take a look at the other vault commands in that script, there's a few different ways to do it. I usually prefer introducing an env var like USE_ES_BENCH_CREDENTIALS. You can also do it based on something like the step label periodic-micro-benchmarks, but then it will break if you rename the step.

-H 'Content-Type: application/json' \
-d "$doc"
done