-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set build type for scheduled builds based on doc repo changes #2931
Merged
Merged
Changes from 35 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
0bb4951
check if docs repo has changed
bmorelli25 eaa67df
more
bmorelli25 0ea95ca
updates so I can test it
bmorelli25 9694e32
build commit
bmorelli25 4ef9614
lbc
bmorelli25 92df131
gpb
bmorelli25 dfcd5ab
more testing
bmorelli25 3b563f5
a
bmorelli25 a4649fc
b
bmorelli25 b50be86
mmhm
bmorelli25 132847e
use auth token
bmorelli25 b06de72
fix quotes
bmorelli25 b715781
c
bmorelli25 fea9ced
aha!
bmorelli25 215e20d
no way this works
bmorelli25 b1bf2ae
forgot the squigles
bmorelli25 840bd3c
back up
bmorelli25 0f64c00
perhaps
bmorelli25 65c95cc
lsc
bmorelli25 9e266fe
no squigs
bmorelli25 57deb0c
jq isn’t working
bmorelli25 25ab6a6
quotes
bmorelli25 fcf36d5
try a file
bmorelli25 9c533a5
ugh
bmorelli25 14ff55a
d
bmorelli25 0abdfa7
e
bmorelli25 163784a
move to file, echo all the things
bmorelli25 0e55959
Fixing up the script - mostly adding curl and jq flags
nkammah a285d0d
wire up the rebuild
nkammah bd23c64
fix script typo
nkammah 94070db
export rebuild var
nkammah 5bc5c78
Make the script more generic
nkammah 164ef96
Set REBUILD value to false since empty strings are not accepted
nkammah 1b9b2af
Remove early exits used for testing purposes
nkammah c3e8250
Try setting concurrency group name based on branch
nkammah 5b3cadb
uncomment
bmorelli25 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
steps: | ||
- input: "Build parameters" | ||
if: build.source == "ui" | ||
fields: | ||
- select: "Rebuild?" | ||
key: "REBUILD" | ||
default: "" | ||
required: false | ||
options: | ||
- label: "no" | ||
value: "" | ||
- label: "yes" | ||
value: "rebuild" | ||
hint: "Should all books be rebuilt, regardless of what has changed? Build once with this set to true after every release." | ||
- select: "How should broken links be handled?" | ||
key: "BROKEN_LINKS" | ||
default: "" | ||
required: false | ||
options: | ||
- label: "Continue without warning" | ||
value: "skiplinkcheck" | ||
- label: "Continue, but log a warning" | ||
value: "warnlinkcheck" | ||
- label: "Fail the build" | ||
value: "" | ||
hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." | ||
- wait | ||
# - input: "Build parameters" | ||
# if: build.source == "ui" | ||
# fields: | ||
# - select: "Rebuild?" | ||
# key: "REBUILD" | ||
# default: "" | ||
# required: false | ||
# options: | ||
# - label: "no" | ||
# value: "" | ||
# - label: "yes" | ||
# value: "rebuild" | ||
# hint: "Should all books be rebuilt, regardless of what has changed? Build once with this set to true after every release." | ||
# - select: "How should broken links be handled?" | ||
# key: "BROKEN_LINKS" | ||
# default: "" | ||
# required: false | ||
# options: | ||
# - label: "Continue without warning" | ||
# value: "skiplinkcheck" | ||
# - label: "Continue, but log a warning" | ||
# value: "warnlinkcheck" | ||
# - label: "Fail the build" | ||
# value: "" | ||
# hint: "Should we ignore checking broken links? Should we allow to run the build without failing if there's a broken link? Ignoring broken links is dangerous not just because bad links will leak into the public site but because subsequent builds and pull requests that do not fix the links fail." | ||
# - wait | ||
- label: "Full rebuild or incremental build?" | ||
# this has to be commented out for testing purposes | ||
#if: build.source == "schedule" | ||
command: ".buildkite/scripts/compare_commits.sh" | ||
- label: ":white_check_mark: Build docs" | ||
command: | | ||
export REBUILD="$(buildkite-agent meta-data get REBUILD --default '' --log-level fatal)" | ||
|
@@ -34,7 +38,7 @@ steps: | |
provider: "gcp" | ||
image: family/docs-ubuntu-2204 | ||
machineType: ${BUILD_MACHINE_TYPE} | ||
concurrency_group: build-docs | ||
concurrency_group: build-docs-${BUILDKITE_BRANCH} | ||
bmorelli25 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
concurrency: 1 | ||
notify: | ||
- email: "[email protected]" | ||
|
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkammah why does L30 not need
bash
in the command but L35 does?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We specify the script interpreter in the first line of the script here - that's what we call the "shebang". If the script is executable (ex. running "chmod a+x" on it), the pipeline will know how to call it.
As for the discrepancy on L35, it could be legacy, or that we explicitly specified it at the time. Both approaches will work.