Skip to content

Commit

Permalink
[APM] Run cypress record on merge (#161068)
Browse files Browse the repository at this point in the history
## Summary

closes #154551 

Run cypress record on merge when `Team:APM` label in applied

I need to run `add_gh_labels_to_bk_metadata` script because labels are
not available on merge pipeline.


Tested here:
https://buildkite.com/elastic/kibana-pull-request/builds/141233#01893fd7-e2f9-432b-86a3-f80515f343c4
  • Loading branch information
kpatticha committed Jul 10, 2023
1 parent 3a05b7b commit bfaf5e0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .buildkite/scripts/steps/functional/apm_cypress.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ APM_CYPRESS_RECORD_KEY="$(retry 5 5 vault read -field=CYPRESS_RECORD_KEY secret/

export JOB=kibana-apm-cypress
IS_FLAKY_TEST_RUNNER=${CLI_COUNT:-0}
GH_APM_TEAM_LABEL="Team:APM"

#Enabling cypress dashboard recording when PR is labeled with `apm:cypress-record` and we are not using the flaky test runner
if [[ "$IS_FLAKY_TEST_RUNNER" -ne 1 ]] && is_pr_with_label "apm:cypress-record"; then
if (! is_pr); then
echo "--- Add GH labels to buildkite metadata"
ts-node .buildkite/scripts/steps/add_gh_labels_to_bk_metadata.ts BUILDKITE_MESSAGE true
GH_ON_MERGE_LABELS="$(buildkite-agent meta-data get gh_labels)"
fi

# Enabling cypress dashboard recording when PR is labeled with `apm:cypress-record` and we are not using the flaky test runner OR on merge with Team:APM label applied
if ([[ "$IS_FLAKY_TEST_RUNNER" -ne 1 ]] && is_pr_with_label "apm:cypress-record") || ([[ $GH_ON_MERGE_LABELS == *"$GH_APM_TEAM_LABEL"* ]]); then
CYPRESS_ARGS="--record --key "$APM_CYPRESS_RECORD_KEY" --parallel --ci-build-id "${BUILDKITE_BUILD_ID}""
else
CYPRESS_ARGS=""
Expand Down

0 comments on commit bfaf5e0

Please sign in to comment.