Skip to content

Commit

Permalink
Add pre-commit step to beats pipelines (elastic#40560)
Browse files Browse the repository at this point in the history
Added pre-commit check to beats pipelines to validate if no merge-conflicts exist
  • Loading branch information
oakrizan authored Sep 24, 2024
1 parent 4380b9d commit ecc5215
Show file tree
Hide file tree
Showing 17 changed files with 224 additions and 17 deletions.
14 changes: 13 additions & 1 deletion .buildkite/auditbeat/auditbeat-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

# Other deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -40,14 +42,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "auditbeat: check/update"

- label: "Auditbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "auditbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
13 changes: 13 additions & 0 deletions .buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,24 @@ env:
# Other deps
ASDF_KIND_VERSION: "0.20.0"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

steps:
- group: "Deploy/K8S"
if: build.env("BUILDKITE_PULL_REQUEST") != "false"

steps:
- label: "Deploy/K8S: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "2000m"
memory: "4Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "deploy/k8s: pre-commit"

- label: "Checks"
command: |
set -euo pipefail
Expand Down
15 changes: 14 additions & 1 deletion .buildkite/filebeat/filebeat-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

#Deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -32,6 +34,7 @@ env:
steps:
- group: "Check/Update"
key: "filebeat-check-update"

steps:
- label: "Filebeat: Run check/update"
command: |
Expand All @@ -42,14 +45,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.3"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "filebeat: check/update"

- label: "Filebeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "filebeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
15 changes: 14 additions & 1 deletion .buildkite/heartbeat/heartbeat-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

# Other deps
ASDF_MAGE_VERSION: 1.15.0
ASDF_NODEJS_VERSION: 18.17.1
ASDF_PYTHON_VERSION: 3.10.9

# Unit tests
RACE_DETECTOR: "true"
Expand All @@ -40,14 +43,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "hearbeat: check/update"

- label: "Heartbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "heartbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
14 changes: 13 additions & 1 deletion .buildkite/libbeat/pipeline.libbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ env:
GCP_HI_PERF_MACHINE_TYPE: "c2d-highcpu-16"
IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

#Deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -30,14 +32,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "libbeat: check/update"

- label: "Libbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "libbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
14 changes: 13 additions & 1 deletion .buildkite/metricbeat/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

# Integration Tests
K8S_VERSION: "v1.29.0"
ASDF_KIND_VERSION: "0.20.0"
Expand Down Expand Up @@ -45,14 +47,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "metricbeat: check/update"

- label: "Metricbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "metricbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
14 changes: 13 additions & 1 deletion .buildkite/packetbeat/pipeline.packetbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

#Deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -40,14 +42,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "packetbeat: check/update"

- label: "Packetbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "packetbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
14 changes: 13 additions & 1 deletion .buildkite/winlogbeat/pipeline.winlogbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

# Other deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -36,14 +38,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "winlogbeat: check/update"

- label: "Winlogbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "winlogbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
14 changes: 13 additions & 1 deletion .buildkite/x-pack/pipeline.xpack.auditbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

# Other deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -43,14 +45,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "x-pack/auditbeat: check/update"

- label: "x-pack/auditbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "x-pack/auditbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
14 changes: 13 additions & 1 deletion .buildkite/x-pack/pipeline.xpack.dockerlogbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ env:

IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

# Other deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -30,14 +32,24 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "x-pack/dockerlogbeat: check/update"

- label: "x-pack/dockerlogbeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "x-pack/dockerlogbeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
# for other cases, e.g. merge commits, we want to run mundatory test (and publish) independently of other tests
Expand Down
16 changes: 14 additions & 2 deletions .buildkite/x-pack/pipeline.xpack.filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ env:
IMAGE_WIN_2019: "family/platform-ingest-beats-windows-2019"
IMAGE_WIN_2022: "family/platform-ingest-beats-windows-2022"

IMAGE_BEATS_WITH_HOOKS_LATEST: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:latest"

# Other deps
ASDF_MAGE_VERSION: 1.15.0

Expand All @@ -39,13 +41,23 @@ steps:
automatic:
- limit: 1
agents:
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.3"
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
cpu: "4000m"
memory: "8Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "x-pack-filebeat: check/update"
context: "x-pack/filebeat: check/update"

- label: "x-pack/filebeat: Run pre-commit"
command: "pre-commit run --all-files"
agents:
image: "${IMAGE_BEATS_WITH_HOOKS_LATEST}"
memory: "2Gi"
useCustomGlobalHooks: true
notify:
- github_commit_status:
context: "x-pack/filebeat: pre-commit"

- wait: ~
# with PRs, we want to run mandatory tests only if check/update step succeed
Expand Down
Loading

0 comments on commit ecc5215

Please sign in to comment.