forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#84997 - pietroalbini:ci-verify-channel, r=M…
…ark-Simulacrum Error out if a PR is sent to the wrong channel It happened multiple times that a PR meant to go on beta ends up being opened (and occasionally merged) to master. This PR does two things: * Moves the definition of the channel in `src/ci/channel` so it's easier for tools to read it. I was not sure whether to move it to `src/channel` (like `src/version`): ended up with `src/ci` as it's currently only used for CI, but I'm open to moving it to `src`. We'll need to update the release process after this. * Adds a check on **non-bors** builds that errors out if the base branch is not the expected one for the currently defined channel. This will not cause problems for promotion PRs, as those PRs are meant to also update the channel name. r? ``@Mark-Simulacrum``
- Loading branch information
Showing
6 changed files
with
55 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nightly |
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,28 @@ | ||
#!/bin/bash | ||
# We want to make sure all PRs are targeting the right branch when they're | ||
# opened, otherwise we risk (for example) to land a beta-specific change to the | ||
# master branch. This script ensures the branch of the PR matches the channel. | ||
|
||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" | ||
|
||
declare -A CHANNEL_BRANCH | ||
CHANNEL_BRANCH["nightly"]="master" | ||
CHANNEL_BRANCH["beta"]="beta" | ||
CHANNEL_BRANCH["stable"]="stable" | ||
|
||
if isCiBranch auto || isCiBranch try; then | ||
echo "channel verification is only executed on PR builds" | ||
exit | ||
fi | ||
|
||
channel=$(cat "$(ciCheckoutPath)/src/ci/channel") | ||
branch="$(ciBaseBranch)" | ||
if [[ "${branch}" != "${CHANNEL_BRANCH[$channel]}" ]]; then | ||
echo "error: PRs changing the \`${channel}\` channel should be sent to the \ | ||
\`${CHANNEL_BRANCH[$channel]}\` branch!" | ||
|
||
exit 1 | ||
fi |
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