-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set build type for scheduled builds based on doc repo changes (#2931)
* check if docs repo has changed * more * updates so I can test it * build commit * lbc * gpb * more testing * a * b * mmhm * use auth token * fix quotes * c * aha! * no way this works * forgot the squigles * back up * perhaps * lsc * no squigs * jq isn’t working * quotes * try a file * ugh * d * e * move to file, echo all the things * Fixing up the script - mostly adding curl and jq flags * wire up the rebuild * fix script typo * export rebuild var * Make the script more generic * Set REBUILD value to false since empty strings are not accepted * Remove early exits used for testing purposes * Try setting concurrency group name based on branch * uncomment --------- Co-authored-by: nassimkammah <nassim.kammah@elastic.co>
- Loading branch information
1 parent
c18f229
commit 84035af
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
last_successful_build_url="https://api.buildkite.com/v2/organizations/elastic/pipelines/${BUILDKITE_PIPELINE_SLUG}/builds?branch=${BUILDKITE_BRANCH}&state=passed" | ||
LAST_SUCCESSFUL_COMMIT=$(curl -s -H "Authorization: Bearer ${BUILDKITE_API_TOKEN}" $last_successful_build_url | jq -r '.[0].commit') | ||
|
||
echo "Comparing the current docs build commit ${BUILDKITE_COMMIT} to the last successful build commit ${LAST_SUCCESSFUL_COMMIT}" | ||
if [[ "$BUILDKITE_COMMIT" == "$LAST_SUCCESSFUL_COMMIT" ]]; then | ||
echo "The docs repo has not changed since the last build." | ||
buildkite-agent meta-data set "REBUILD" "false" | ||
else | ||
echo "The docs repo has changed since the last build." | ||
buildkite-agent meta-data set "REBUILD" "rebuild" | ||
fi |