Skip to content

Commit

Permalink
[ci] Migrate branch consistency and protection checks to Buildkite (#…
Browse files Browse the repository at this point in the history
…101646) (#101737)

(cherry picked from commit dee880a)
  • Loading branch information
brianseeders committed Nov 2, 2023
1 parent 5061954 commit 60cb462
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .buildkite/pipelines/intake.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ steps:
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
- label: part2
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-task-input-files checkPart2
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
- group: bwc-snapshots
steps:
Expand Down
14 changes: 12 additions & 2 deletions .buildkite/pipelines/periodic.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ steps:
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
env:
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
Expand Down Expand Up @@ -70,7 +70,7 @@ steps:
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
env:
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
Expand Down Expand Up @@ -159,3 +159,13 @@ steps:
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-8
buildDirectory: /dev/shm/bk
- label: Check branch consistency
command: .ci/scripts/run-gradle.sh branchConsistency
timeout_in_minutes: 15
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-2
- label: Check branch protection rules
command: .buildkite/scripts/branch-protection.sh
timeout_in_minutes: 5
10 changes: 10 additions & 0 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1350,3 +1350,13 @@ steps:
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-8
buildDirectory: /dev/shm/bk
- label: Check branch consistency
command: .ci/scripts/run-gradle.sh branchConsistency
timeout_in_minutes: 15
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-2
- label: Check branch protection rules
command: .buildkite/scripts/branch-protection.sh
timeout_in_minutes: 5
10 changes: 10 additions & 0 deletions .buildkite/scripts/branch-protection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

STATUS=$(curl -s "https://api.github.com/repos/elastic/elasticsearch/branches/$BUILDKITE_BRANCH" | jq '.protected')
echo "Branch $BUILDKITE_BRANCH protection status is: $STATUS"
if [[ "$STATUS" == "false" ]]; then
echo "Development branch $BUILDKITE_BRANCH is not set as protected in GitHub but should be."
exit 1
fi
8 changes: 4 additions & 4 deletions .ci/jobs.t/elastic+elasticsearch+branch-consistency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
- job:
name: elastic+elasticsearch+%BRANCH%+branch-consistency
display-name: "elastic / elasticsearch # %BRANCH% - branch consistency"
description: Testing of the Elasticsearch %BRANCH% branch version consistency.
triggers:
- timed: "H 7 * * *"
description: "This job has been migrated to Buildkite.\n"
disabled: true
triggers: []
builders:
- inject:
properties-file: '.ci/java-versions.properties'
properties-file: ".ci/java-versions.properties"
properties-content: |
JAVA_HOME=$HOME/.java/$ES_BUILD_JAVA
- shell: |
Expand Down
6 changes: 3 additions & 3 deletions .ci/jobs.t/elastic+elasticsearch+branch-protection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
- job:
name: elastic+elasticsearch+%BRANCH%+branch-protection
display-name: "elastic / elasticsearch # %BRANCH% - branch protection"
description: Elasticsearch %BRANCH% branch protection.
description: "This job has been migrated to Buildkite.\n"
disabled: true
node: master
triggers:
- timed: "H 7 * * *"
triggers: []
scm: []
parameters: []
builders:
Expand Down
5 changes: 5 additions & 0 deletions .ci/scripts/run-gradle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@ if ! uname -a | grep -q MING; then
export GLIBC_VERSION=$(ldd --version | grep '^ldd' | sed 's/.* \([1-9]\.[0-9]*\).*/\1/')
fi

# Running on 2-core machines without ramdisk can make this value be 0
if [[ "$MAX_WORKERS" == "0" ]]; then
MAX_WORKERS=1
fi

set -e
$GRADLEW -S --max-workers=$MAX_WORKERS $@

0 comments on commit 60cb462

Please sign in to comment.