From 0edc23e02aa2fdca8b9065225a945ef2a32ff17a Mon Sep 17 00:00:00 2001 From: Alex Szabo Date: Mon, 4 Sep 2023 18:29:16 +0200 Subject: [PATCH] [Ops] Skip buildkite hooks for non kibana jobs (#165597) ## Summary Kibana's build jobs work on a different subset of executors than the buildkite pipelines defined in `catalog-info.yaml`. The former jobs require a set of `pre_command` / `post_command` steps to prepare the jobs for building/testing kibana. The latter don't have access rights to certain vault secrets (and possibly other missing config from the Kibana world), but for now, they're also not building Kibana, they just trigger other jobs, so we can just skip the problematic hooks. ~~A probably good indicator I found for deciding whether we need the kibana-related `pre_command` is the `BUILDKITE_AGENT_META_DATA_AGENT_MANAGER` flag, that's set to `"kibana"` in the case of the kibana executors.~~ We can try to match on the agent names for the CI-systems agents. They seem to be starting with `bk-agent`. This should allow for the [kibana-tests](https://buildkite.com/elastic/kibana-tests) job to run. Split from: https://github.com/elastic/kibana/pull/165346 --------- Co-authored-by: Tiago Costa --- .buildkite/hooks/post-command | 6 +++++- .buildkite/hooks/pre-command | 6 +++++- .../quality-gates/pipeline.tests-production.yaml | 11 +++++++++++ .../pipelines/quality-gates/pipeline.tests-qa.yaml | 11 +++++++++++ .../quality-gates/pipeline.tests-staging.yaml | 11 +++++++++++ .buildkite/scripts/lifecycle/pre_command.sh | 5 ----- 6 files changed, 43 insertions(+), 7 deletions(-) diff --git a/.buildkite/hooks/post-command b/.buildkite/hooks/post-command index d9a8ad668da0b..13e0f4d795828 100755 --- a/.buildkite/hooks/post-command +++ b/.buildkite/hooks/post-command @@ -1,3 +1,7 @@ #!/usr/bin/env bash -.buildkite/scripts/lifecycle/post_command.sh +if [[ "$BUILDKITE_AGENT_NAME" =~ ^bk-agent ]]; then + echo "Pipeline file triggered from outside the kibana executors, skipping post_command" +else + .buildkite/scripts/lifecycle/post_command.sh +fi diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 58a2c5f0b499d..95e2975d094c3 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -1,3 +1,7 @@ #!/usr/bin/env bash -source .buildkite/scripts/lifecycle/pre_command.sh +if [[ "$BUILDKITE_AGENT_NAME" =~ ^bk-agent ]]; then + echo "Pipeline file triggered from outside the kibana executors, skipping pre_command" +else + source .buildkite/scripts/lifecycle/pre_command.sh +fi diff --git a/.buildkite/pipelines/quality-gates/pipeline.tests-production.yaml b/.buildkite/pipelines/quality-gates/pipeline.tests-production.yaml index 5a0738ead7d9c..f2a96d0e23f92 100644 --- a/.buildkite/pipelines/quality-gates/pipeline.tests-production.yaml +++ b/.buildkite/pipelines/quality-gates/pipeline.tests-production.yaml @@ -1,3 +1,7 @@ +env: + TEAM_CHANNEL: "#kibana-serverless-release" + ENVIRONMENT: "production" + steps: - label: ":pipeline::fleet::seedling: Trigger Observability Kibana Tests for ${ENVIRONMENT}" command: echo "replace me with Observability specific Kibana tests" @@ -8,3 +12,10 @@ steps: command: echo "replace me with Security specific Kibana tests" agent: image: "docker.elastic.co/ci-agent-images/basic-buildkite-agent:1688566364" + + - wait: ~ + + - label: ":judge::seedling: Trigger Manual Tests Phase" + command: "make -C /agent trigger-manual-verification-phase" + agents: + image: "docker.elastic.co/ci-agent-images/manual-verification-agent:0.0.1" diff --git a/.buildkite/pipelines/quality-gates/pipeline.tests-qa.yaml b/.buildkite/pipelines/quality-gates/pipeline.tests-qa.yaml index 669b306bc2ceb..1c9047c38ae92 100644 --- a/.buildkite/pipelines/quality-gates/pipeline.tests-qa.yaml +++ b/.buildkite/pipelines/quality-gates/pipeline.tests-qa.yaml @@ -1,3 +1,7 @@ +env: + TEAM_CHANNEL: "#kibana-serverless-release" + ENVIRONMENT: "qa" + steps: - label: ":pipeline::kibana::seedling: Trigger Kibana Tests for ${ENVIRONMENT}" command: echo "replace me with Kibana specific tests" @@ -18,3 +22,10 @@ steps: command: echo "replace me with Control Plane specific Kibana tests" agent: image: "docker.elastic.co/ci-agent-images/basic-buildkite-agent:1688566364" + + - wait: ~ + + - label: ":judge::seedling: Trigger Manual Tests Phase" + command: "make -C /agent trigger-manual-verification-phase" + agents: + image: "docker.elastic.co/ci-agent-images/manual-verification-agent:0.0.1" diff --git a/.buildkite/pipelines/quality-gates/pipeline.tests-staging.yaml b/.buildkite/pipelines/quality-gates/pipeline.tests-staging.yaml index 5a0738ead7d9c..bb2381df1fd28 100644 --- a/.buildkite/pipelines/quality-gates/pipeline.tests-staging.yaml +++ b/.buildkite/pipelines/quality-gates/pipeline.tests-staging.yaml @@ -1,3 +1,7 @@ +env: + TEAM_CHANNEL: "#kibana-serverless-release" + ENVIRONMENT: "staging" + steps: - label: ":pipeline::fleet::seedling: Trigger Observability Kibana Tests for ${ENVIRONMENT}" command: echo "replace me with Observability specific Kibana tests" @@ -8,3 +12,10 @@ steps: command: echo "replace me with Security specific Kibana tests" agent: image: "docker.elastic.co/ci-agent-images/basic-buildkite-agent:1688566364" + + - wait: ~ + + - label: ":judge::seedling: Trigger Manual Tests Phase" + command: "make -C /agent trigger-manual-verification-phase" + agents: + image: "docker.elastic.co/ci-agent-images/manual-verification-agent:0.0.1" diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index cf31fc95bcb5a..b945f08d1dfd9 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -2,11 +2,6 @@ set -euo pipefail -if [[ "$BUILDKITE_COMMAND" =~ ^"buildkite-agent pipeline upload" ]]; then - echo "Skipped pre-command when running the Upload pipeline" - exit 0 -fi - source .buildkite/scripts/common/util.sh echo '--- Setup environment vars'