Skip to content

Commit aa89dcd

Browse files
authored
Detect tools changes in smithy-rs since the last update to config.json (#1382)
## Motivation and Context When modifying the [tools](https://github.com/smithy-lang/smithy-rs/tree/main/tools) directory in `smithy-rs`, we must update our production release infrastructure with a new container image tag before updating `smithyRsVersion` in `config.json`. Failing to do so causes production build failures. For instance, during MSRV updates, we modify the [Dockerfile](https://github.com/smithy-lang/smithy-rs/blob/main/tools/ci-build/Dockerfile) in the `tools` directory. If we update `smithyRsVersion` in `config.json` without first updating the container image tag in production release environment, builds will fail because the code generator emits Rust code compliant with the new MSRV, but the container still uses an older compiler for testing. This PR adds a mechanism to prevent this operational error by: 1. Running git diff between release tags (current `smithyRsVersion` in main vs. PR branch) 2. Checking for any changes under the tools directory 3. Failing the release check workflow if changes are detected Once the image tag has been updated in the production release environment, we can use the bot user to override and merge the PR to main. ## Testing - Tested detection by deliberately specifying an old release and reversing the `git diff` argument order to confirm tools change detection ([dry-run](https://github.com/awslabs/aws-sdk-rust/actions/runs/19442709471/job/55629667389#step:5:69)) --- By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 9b09965 commit aa89dcd

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/release-checks.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
name: Check Release config.json
1616
steps:
1717
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v4
19+
with:
20+
ref: main
21+
path: main-branch
1822
- name: Check smithy-rs version exists
1923
run: |
2024
SMITHY_RS_VERSION=$(jq -r ".dependencies.smithyRsVersion" config.json)
@@ -23,11 +27,34 @@ jobs:
2327
cd smithy-rs
2428
git init
2529
git remote add origin https://github.com/smithy-lang/smithy-rs.git
26-
30+
2731
if git fetch origin $SMITHY_RS_VERSION; then
2832
echo "smithy-rs@$SMITHY_RS_VERSION found"
2933
else
3034
echo "::error::no smithy-rs@$SMITHY_RS_VERSION found"
3135
exit 1
3236
fi
3337
38+
- name: Check for tools changes in smithy-rs
39+
run: |
40+
CURRENT_SMITHY_RS_VERSION=$(jq -r ".dependencies.smithyRsVersion" config.json)
41+
echo "Current branch smithyRsVersion: $CURRENT_SMITHY_RS_VERSION"
42+
43+
MAIN_SMITHY_RS_VERSION=$(jq -r ".dependencies.smithyRsVersion" main-branch/config.json)
44+
echo "Main branch smithyRsVersion: $MAIN_SMITHY_RS_VERSION"
45+
46+
cd smithy-rs
47+
git fetch origin --tags -q
48+
49+
# Check for tools changes between main branch version and current version
50+
CHANGED_FILES=$(git diff --name-only $MAIN_SMITHY_RS_VERSION..$CURRENT_SMITHY_RS_VERSION)
51+
52+
if echo "$CHANGED_FILES" | grep -q "^tools/"; then
53+
echo "::error::Tools changes detected between $MAIN_SMITHY_RS_VERSION and $CURRENT_SMITHY_RS_VERSION"
54+
echo "$CHANGED_FILES" | grep "^tools/"
55+
echo "::error::Complete an internal release before updating config.json. After completion, use the bot user to force-merge this PR to main."
56+
exit 1
57+
else
58+
echo "No tools changes detected - check passed"
59+
fi
60+

0 commit comments

Comments
 (0)