diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index e838dfaf74c..f0a69f7e199 100755 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -34,9 +34,8 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "elastic-agent-package" ]]; then fi fi -if [[ "$BUILDKITE_PIPELINE_SLUG" == "buildkite-elastic-agent-integration-matrix" ]]; then - echo "Setting credentials" - # Set GCP credentials +if [[ ("$BUILDKITE_PIPELINE_SLUG" == "buildkite-elastic-agent-integration-matrix") || ("$BUILDKITE_PIPELINE_SLUG" == "beats-agent-serverless-tests") ]]; then + echo "Setting GCP credentials" export GOOGLE_APPLICATION_GCP_SECRET=$(retry 5 vault kv get -format=json -field=data ${CI_GCP_OBS_PATH}) echo "${GOOGLE_APPLICATION_GCP_SECRET}" > ./gcp.json export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ./gcp.json) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 4224a2d6e0a..55cb8238141 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -344,6 +344,25 @@ steps: commit: "${BUILDKITE_COMMIT}" branch: "${BUILDKITE_BRANCH}" + # Trigger for pull requests - Serverless Beats Tests + # this should help detecting issues earlier in the development cycle + - label: "Trigger Serverless Beats Tests" + if: build.pull_request.id != null + plugins: + - monorepo-diff#v1.2.0: + diff: "git diff --name-only origin/${GITHUB_PR_TARGET_BRANCH}...HEAD" + interpolation: false + watch: + - path: + - .buildkite/serverless.beats.tests.yml + - .buildkite/scripts/steps/beats_tests.sh + - .buildkite/hooks/pre-command + config: + trigger: "beats-agent-serverless-tests" + build: + commit: "${BUILDKITE_COMMIT}" + branch: "${BUILDKITE_BRANCH}" + # wait for CI to be done - wait: ~