Skip to content
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

Add script to prevent point releases with same number as existing ones #93128

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ jobs:
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down Expand Up @@ -502,6 +505,9 @@ jobs:
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down Expand Up @@ -612,6 +618,9 @@ jobs:
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down
4 changes: 4 additions & 0 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ x--expand-yaml-anchors--remove:
run: src/ci/scripts/verify-backported-commits.sh
<<: *step

- name: ensure the stable version number is correct
run: src/ci/scripts/verify-stable-version-number.sh
<<: *step

- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down
30 changes: 30 additions & 0 deletions src/ci/scripts/verify-stable-version-number.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# On the stable channel, check whether we're trying to build artifacts with the
# same version number of a release that's already been published, and fail the
# build if that's the case.
#
# It's a mistake whenever that happens: the release process won't start if it
# detects a duplicate version number, and the artifacts would have to be
# rebuilt anyway.

set -euo pipefail
IFS=$'\n\t'

if [[ "$(cat src/ci/channel)" != "stable" ]]; then
echo "This script only works on the stable channel. Skipping the check."
exit 0
fi

version="$(cat src/version)"
url="https://static.rust-lang.org/dist/channel-rust-${version}.toml"

if curl --silent --fail "${url}" >/dev/null; then
echo "The version number ${version} matches an existing release."
echo
echo "If you're trying to prepare a point release, remember to change the"
echo "version number in the src/version file."
exit 1
else
echo "The version number ${version} does not match any released version!"
exit 0
fi