Use last good commit when updating serverless submodule

This commit is contained in:
Mark Vieira 2023-10-09 12:36:30 -07:00
parent 22f9eaac55
commit 3b3168b118
No known key found for this signature in database
GPG key ID: 9F12FCE90D9350AB
2 changed files with 19 additions and 6 deletions

View file

@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
INTAKE_PIPELINE_SLUG="elasticsearch-intake"
BUILD_JSON=$(curl -sH "Authorization: Bearer ${BUILDKITE_API_TOKEN}" "https://api.buildkite.com/v2/organizations/elastic/pipelines/${INTAKE_PIPELINE_SLUG}/builds?branch=main&state=passed&per_page=1" | jq '.[0] | {commit: .commit, url: .web_url}')
LAST_GOOD_COMMIT=$(echo "${BUILD_JSON}" | jq -r '.commit')
cat <<EOF | buildkite-agent pipeline upload
steps:
- trigger: elasticsearch-serverless-validate-submodule
label: ":elasticsearch: Update elasticsearch submodule in serverless"
build:
message: "Elasticsearch submodule update build"
env:
ELASTICSEARCH_SUBMODULE_COMMIT: "${LAST_GOOD_COMMIT}"
EOF

View file

@ -1,8 +1,4 @@
steps:
- trigger: elasticsearch-serverless-validate-submodule
label: ":elasticsearch: Update elasticsearch submodule in serverless"
build:
message: "Elasticsearch submodule update build"
env:
ELASTICSEARCH_SUBMODULE_COMMIT: "${BUILDKITE_COMMIT}"
- label: ":git: Trigger submodule update build"
command: ".buildkite/scripts/update-serverless-submodule.sh"