-
Notifications
You must be signed in to change notification settings - Fork 115
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
buildkite: Add dynamic pipeline generator for conditional skipping #2702
Merged
+68
−35
Merged
Changes from all commits
Commits
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## | ||
# Code-skip pipeline | ||
## | ||
# | ||
# Buildkite pipeline for skipping running code-related linters and tests. | ||
# | ||
|
||
steps: | ||
- label: No code-related changes detected, skipping Code pipeline | ||
command: exit 0 |
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,45 @@ | ||
#!/bin/bash | ||
## | ||
# Dynamic Buildkite pipeline generator. | ||
## | ||
# | ||
# It outputs valid Buildkite pipeline in YAML format. | ||
# | ||
# To use it, define the following Steps under your Buildkite's Pipeline Settings: | ||
# | ||
# steps: | ||
# - command: .buildkite/pipeline.sh | buildkite-agent pipeline upload | ||
# label: ":pipeline: Upload" | ||
# | ||
# For more details, see: | ||
# https://buildkite.com/docs/pipelines/defining-steps#dynamic-pipelines. | ||
# | ||
|
||
set -eux | ||
|
||
# Helper that ensures the build is triggered for a pull request and that there | ||
# are no code-related changes compared to the pull request's base branch. | ||
pr_and_no_code_related_changes() { | ||
# Check if the build was triggered for a pull request. | ||
if [[ -z $BUILDKITE_PULL_REQUEST_BASE_BRANCH ]]; then | ||
return 1 | ||
fi | ||
# Get the list of changes files, excluding changes unrelated to code. | ||
# NOTE: The exclude patterns below use git's pathspec syntax: | ||
# https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec. | ||
git diff --name-only --exit-code "refs/remotes/origin/$BUILDKITE_PULL_REQUEST_BASE_BRANCH.." 1>&2 -- \ | ||
':(exclude)*.md' \ | ||
':(exclude).changelog/' \ | ||
':(exclude).github/' \ | ||
':(exclude).gitlint' \ | ||
':(exclude).markdownlint.yml' \ | ||
':(exclude).punch_config.py' \ | ||
':(exclude)docs/' \ | ||
':(exclude)towncrier.toml' | ||
} | ||
|
||
if pr_and_no_code_related_changes; then | ||
cat .buildkite/code-skip.pipeline.yml | ||
else | ||
cat .buildkite/code.pipeline.yml | ||
fi |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
ci: Skip some steps for non-code changes | ||
|
||
When one makes a pull request that e.g. only adds documentation or | ||
assembles the Change Log from fragments, all the *heavy* Buildkite | ||
pipeline steps (e.g. Go/Rust building, Go tests, E2E tests) should be | ||
skipped. |
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.
can't skip in this case: