Skip to content

Commit 510c4ed

Browse files
committed
CI: standardize test suite setups and PR gating
Prior to this change, our buildkite configurations were a bit of a maze to understand that interchangeable used tasks and pipelines to implement our CI. This change dramatically refactors the configuration for our test suites by: - Using `gen pipeline` to generate pipelines, utilizing go to DRY up and document our configurations. - Reporting the status of all test suites individually for easy spot checks from GH. - Gating PRs under an aggregate step and allowing failures with the `soft_fail` flag. - Setting a precedence of using `if` for pipeline gating. - Including acceptance tests as part of our test suite.
1 parent 698ae70 commit 510c4ed

File tree

13 files changed

+686
-324
lines changed

13 files changed

+686
-324
lines changed

.buildkite/integration-test.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.buildkite/operator-e2e-tests-with-flags.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.buildkite/operator-v2-tests.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.buildkite/pipeline.yml

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,35 @@ env:
88
# CI run podman instead of linux. testcontainer's ryuk is reported to not
99
# work well with podman.
1010
TESTCONTAINERS_RYUK_DISABLED: "true"
11+
# pipeline.yml is the "entrypoint" for all BuildKite pipelines in the operator
12+
# repo. As such, it is executed for ANY trigger (e.g. PR update/created, Tag
13+
# updated/created, Schedule run). Use `if`s to delegate to specific pipeline
14+
# from this file and try to adhere to the below rules.
15+
#
16+
# Do:
17+
# - Use `gen` to generate pipeline files.
18+
# - Use `if` to gate the execution of pipelines.
19+
# - Include a human readable explanation of `if` gates.
20+
# - Separate pipelines into distinct files and use `buildkite-agent pipeline upload`.
21+
# - Chain together tasks (e.g. `task ci:setup ci:run-test ci:tear-down).
22+
#
23+
# Do not:
24+
# - Use taskfile to gate execution of steps.
25+
# - Have a pipeline serve multiple purposes.
1126
steps:
27+
# ci-entry-point kicks off the complete operator test suite.
28+
# It is responsible for blocking or allowing GitHub PRs to be merged.
29+
- key: ci-entry-point
30+
label: Operator CI Entrypoint
31+
agents:
32+
queue: pipeline-uploader
33+
# Run for:
34+
# - all pull requests that aren't from forks.
35+
# - nightly test schedule
36+
if: |
37+
(build.pull_request.id != null && !build.pull_request.repository.fork) || (build.source == "schedule" && build.env("K8S_NIGHTLY") == "1")
38+
command: buildkite-agent pipeline upload .buildkite/testsuite.yml
39+
1240
- key: release-nightly
1341
label: ":gandalf: Nightly Operator release"
1442
timeout_in_minutes: 10
@@ -38,46 +66,13 @@ steps:
3866
branches:
3967
- main
4068

41-
- key: operator-lint
42-
label: Lint operator repo
43-
if: |
44-
build.env("NIGHTLY_RELEASE") != "true" &&
45-
build.tag == null ||
46-
build.env("K8S_NIGHTLY") == "1"
47-
timeout_in_minutes: 30
48-
notify:
49-
- github_commit_status:
50-
context: charts-lint
51-
commands:
52-
- |
53-
TAG_NAME=$(ci/scripts/tag-check.sh) ./ci/scripts/run-in-nix-docker.sh task ci:configure ci:lint
54-
- echo '~~~ pipeline upload unit tests' && buildkite-agent pipeline upload .buildkite/unit-tests.yml
55-
- echo '~~~ pipeline upload operator e2e tests with flags' && buildkite-agent pipeline upload .buildkite/operator-e2e-tests-with-flags.yml
56-
- echo '~~~ pipeline upload operator integration tests' && buildkite-agent pipeline upload .buildkite/integration-test.yml
57-
- echo '~~~ pipeline upload operator v2 e2e tests' && buildkite-agent pipeline upload .buildkite/operator-v2-tests.yml
58-
agents:
59-
queue: v6-amd64-builders-m6id
60-
plugins:
61-
- seek-oss/aws-sm#v2.3.2:
62-
json-to-env:
63-
- secret-id: sdlc/prod/buildkite/github_api_token
64-
- secret-id: sdlc/prod/buildkite/slack_vbot_token
65-
- https://$GITHUB_API_TOKEN@github.com/redpanda-data/step-slack-notify-buildkite-plugin.git#main:
66-
message: ":cloud: K8S operator lint Jobs failed"
67-
channel_name: "kubernetes-tests"
68-
slack_token_env_var_name: "SLACK_VBOT_TOKEN"
69-
conditions:
70-
failed: true
71-
branches:
72-
- main
73-
69+
# Legacy pipeline that appears to be responsible for minting releases,
70+
# provided that kuttl-v1 tests pass.
71+
# TODO: Scope this to just producing releases, both nightly and on tag.
7472
- key: k8s-operator
7573
label: Operator v1 E2E tests or release
7674
timeout_in_minutes: 180
77-
if: build.env("NIGHTLY_RELEASE") != "true"
78-
notify:
79-
- github_commit_status:
80-
context: k8s-operator-e2e-tests
75+
if: build.env("NIGHTLY_RELEASE") != "true" && build.pull_request.id == null
8176
commands:
8277
- |
8378
TAG_NAME=$(ci/scripts/tag-check.sh) ./ci/scripts/run-in-nix-docker.sh task ci:configure ci:k8s
@@ -112,14 +107,3 @@ steps:
112107
failed: true
113108
branches:
114109
- main
115-
116-
- key: k8s-operator-v2-helm
117-
label: K8s Operator v2 Helm
118-
if: build.env("NIGHTLY_RELEASE") != "true"
119-
notify:
120-
- github_commit_status:
121-
context: k8s-operator-v2-helm
122-
commands:
123-
- echo Tests where failing and K8S disabled this test suite. K8S team want to sunset kuttle base tests to new testing framework. If any of those test would be beneficial then they will be backported
124-
agents:
125-
queue: pipeline-uploader

0 commit comments

Comments
 (0)