From 653b6e7f1da0aad3ea763bd8bc8025647767fc2d Mon Sep 17 00:00:00 2001 From: Ritvik Kapila Date: Fri, 6 Dec 2024 17:26:02 -0800 Subject: [PATCH 1/6] chore(rust): add comments to release scripts --- .../runtimes/rust/start_release.sh | 23 ++++++++++++++++++- .../runtimes/rust/test_examples/Cargo.toml | 1 - .../runtimes/rust/test_published.sh | 11 ++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/start_release.sh b/DynamoDbEncryption/runtimes/rust/start_release.sh index 20e5dbe6e..d4926e8e9 100755 --- a/DynamoDbEncryption/runtimes/rust/start_release.sh +++ b/DynamoDbEncryption/runtimes/rust/start_release.sh @@ -1,12 +1,15 @@ #!/bin/bash -eu +# Check if exactly one argument is provided if [ "$#" -ne 1 ]; then echo 1>&2 "USAGE: start_release.sh N.N.N" exit 1 fi +# Go to the directory of this script cd $( dirname ${BASH_SOURCE[0]} ) +# Check if the provided argument matches the version pattern REGEX_VERSION='^\d+\.\d+\.\d+$' MATCHES=$(echo "$1" | egrep $REGEX_VERSION | wc -l) if [ $MATCHES -eq 0 ]; then @@ -14,23 +17,41 @@ if [ $MATCHES -eq 0 ]; then exit 1 fi +# Update the version in Cargo.toml perl -pe "s/^version = .*$/version = \"$1\"/" < Cargo.toml > new_Cargo.toml mv new_Cargo.toml Cargo.toml +# Remove all files and directories in src except for specified files find src -depth 1 | egrep -v '(intercept.rs|lib.rs|software_externs.rs)' | xargs rm -rf + +# Change to the parent directory and run make polymorph and transpile commands cd ../.. make polymorph_rust transpile_rust test_rust + +# Remove target directory cd runtimes/rust rm -rf target + +# Remove existing release directory and copy current directory to releases rm -rf ../../../releases/rust/db_esdk cp -r . ../../../releases/rust/db_esdk + +# Go to the release directory cd ../../../releases/rust/db_esdk + +# Restore the dafny_runtime_rust directory that was previously tracked by Git but had been deleted git checkout dafny_runtime_rust + +# Remove unnecessary files and directories rm -rf *~ copy_externs.sh start_release.sh test_published.sh test_examples *.pem RELEASE.md + +# Create .gitignore file with specified entries echo Cargo.lock > .gitignore echo target >> .gitignore +# Run cargo test and example tests cargo test cargo run --example main -rm -f Cargo.lock *.pem +# Remove Cargo.lock and .pem files after testing the examples +rm -f Cargo.lock *.pem diff --git a/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml b/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml index ffe66f515..8026ccd07 100644 --- a/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml +++ b/DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml @@ -1,6 +1,5 @@ [package] name = "aws-db-esdk-examples" -version = "0.1.0" edition = "2021" rust-version = "1.80.0" diff --git a/DynamoDbEncryption/runtimes/rust/test_published.sh b/DynamoDbEncryption/runtimes/rust/test_published.sh index 7841817fa..00e58c963 100755 --- a/DynamoDbEncryption/runtimes/rust/test_published.sh +++ b/DynamoDbEncryption/runtimes/rust/test_published.sh @@ -1,14 +1,16 @@ #!/bin/bash -eu +# Check if exactly one argument is provided if [ "$#" -ne 1 ]; then echo 1>&2 "USAGE: test_published.sh N.N.N" exit 1 fi +# Go to the directory of this script cd $( dirname ${BASH_SOURCE[0]} ) +# Check if the provided argument matches the version pattern REGEX_VERSION='^\d+\.\d+\.\d+$' - echo "$1" | egrep -q $REGEX_VERSION if [ $? -ne 0 ]; then echo 1>&2 "Version \"$1\" must be N.N.N" @@ -17,14 +19,21 @@ fi VERSION=$1 +# Update examples in test_examples directory rm -rf test_examples/src cp -r examples test_examples/src/ cd test_examples + +# Add aws-esdk cargo add aws-db-esdk + +# Check if the added version matches the provided version MATCH=$(fgrep "aws-db-esdk = \"$VERSION\"" Cargo.toml | wc -l) if [ $MATCH -eq "0" ]; then echo Version $VERSION of aws-db-esdk not the most recent egrep '^aws-db-esdk' Cargo.toml exit 1 fi + +# Run the cargo project cargo run From f72f7647615868efe34328703212d0cb0405903a Mon Sep 17 00:00:00 2001 From: Ritvik Kapila Date: Fri, 6 Dec 2024 17:33:43 -0800 Subject: [PATCH 2/6] bump submodules --- submodules/MaterialProviders | 2 +- submodules/smithy-dafny | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/MaterialProviders b/submodules/MaterialProviders index 370be9c25..b5c3522da 160000 --- a/submodules/MaterialProviders +++ b/submodules/MaterialProviders @@ -1 +1 @@ -Subproject commit 370be9c25900681687b36f022f0e3ba740c933b9 +Subproject commit b5c3522da3cfafddd2b180e5fe110e1cf1fc1129 diff --git a/submodules/smithy-dafny b/submodules/smithy-dafny index c06e2c0fb..caef7793d 160000 --- a/submodules/smithy-dafny +++ b/submodules/smithy-dafny @@ -1 +1 @@ -Subproject commit c06e2c0fba84fdfa630b518b184cf4d6826b7622 +Subproject commit caef7793d4bf85ae5eb488b2159b693f478c990d From e2ef5af53c73d706ed296f05728e74dd1640913c Mon Sep 17 00:00:00 2001 From: Ritvik Kapila Date: Fri, 6 Dec 2024 17:54:54 -0800 Subject: [PATCH 3/6] m --- DynamoDbEncryption/runtimes/rust/test_published.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamoDbEncryption/runtimes/rust/test_published.sh b/DynamoDbEncryption/runtimes/rust/test_published.sh index 00e58c963..00d7c3f2d 100755 --- a/DynamoDbEncryption/runtimes/rust/test_published.sh +++ b/DynamoDbEncryption/runtimes/rust/test_published.sh @@ -24,7 +24,7 @@ rm -rf test_examples/src cp -r examples test_examples/src/ cd test_examples -# Add aws-esdk +# Add aws-db-esdk cargo add aws-db-esdk # Check if the added version matches the provided version From 89a9321de0dd346479ed5fb6ac11ad9025cfc4c0 Mon Sep 17 00:00:00 2001 From: Ritvik Kapila Date: Fri, 6 Dec 2024 18:09:02 -0800 Subject: [PATCH 4/6] m --- DynamoDbEncryption/runtimes/rust/RELEASE.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DynamoDbEncryption/runtimes/rust/RELEASE.md b/DynamoDbEncryption/runtimes/rust/RELEASE.md index ddcfecdec..8d7d5ff4c 100644 --- a/DynamoDbEncryption/runtimes/rust/RELEASE.md +++ b/DynamoDbEncryption/runtimes/rust/RELEASE.md @@ -5,6 +5,10 @@ To publish a new version of the aws-db-esdk for version N.N.N 1. ./start_release.sh N.N.N 1. cd ../../../releases/rust/db_esdk 1. Create a PR with all changed or added files +1. Within the PR, make sure you also: + 1. Update the `CHANGELOG.md` in the root directory with the changes + 1. If this is a major version bump, update the `SUPPORT_POLICY.rst` for Rust + 1. Get the PR reviewed by a teammate 1. cargo publish 1. cd ../../../DynamoDbEncryption/runtimes/rust/ # i.e. return here 1. ./test_published.sh N.N.N From c8b4fa7c6e31f241b72a76b945260b85d462833c Mon Sep 17 00:00:00 2001 From: Ritvik Kapila Date: Sat, 7 Dec 2024 01:09:48 -0800 Subject: [PATCH 5/6] m --- DynamoDbEncryption/runtimes/rust/RELEASE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/RELEASE.md b/DynamoDbEncryption/runtimes/rust/RELEASE.md index 8d7d5ff4c..522dc2072 100644 --- a/DynamoDbEncryption/runtimes/rust/RELEASE.md +++ b/DynamoDbEncryption/runtimes/rust/RELEASE.md @@ -6,9 +6,9 @@ To publish a new version of the aws-db-esdk for version N.N.N 1. cd ../../../releases/rust/db_esdk 1. Create a PR with all changed or added files 1. Within the PR, make sure you also: - 1. Update the `CHANGELOG.md` in the root directory with the changes - 1. If this is a major version bump, update the `SUPPORT_POLICY.rst` for Rust - 1. Get the PR reviewed by a teammate + 1. Update the `CHANGELOG.md` in the root directory with the changes + 1. If this is a major version bump, update the `SUPPORT_POLICY.rst` for Rust + 1. Get the PR reviewed by a teammate 1. cargo publish 1. cd ../../../DynamoDbEncryption/runtimes/rust/ # i.e. return here 1. ./test_published.sh N.N.N From 1cdebccc96fc3d759200a0e03094c0e287b18b19 Mon Sep 17 00:00:00 2001 From: Ritvik Kapila Date: Mon, 9 Dec 2024 11:04:28 -0800 Subject: [PATCH 6/6] m --- DynamoDbEncryption/runtimes/rust/RELEASE.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/DynamoDbEncryption/runtimes/rust/RELEASE.md b/DynamoDbEncryption/runtimes/rust/RELEASE.md index 522dc2072..ae5932b2b 100644 --- a/DynamoDbEncryption/runtimes/rust/RELEASE.md +++ b/DynamoDbEncryption/runtimes/rust/RELEASE.md @@ -3,12 +3,15 @@ To publish a new version of the aws-db-esdk for version N.N.N 1. Acquire the appropriate permissions 1. Ensure git checkout of main is fresh and clean 1. ./start_release.sh N.N.N -1. cd ../../../releases/rust/db_esdk +1. `cd ../../../releases/rust/db_esdk` 1. Create a PR with all changed or added files 1. Within the PR, make sure you also: 1. Update the `CHANGELOG.md` in the root directory with the changes 1. If this is a major version bump, update the `SUPPORT_POLICY.rst` for Rust 1. Get the PR reviewed by a teammate -1. cargo publish -1. cd ../../../DynamoDbEncryption/runtimes/rust/ # i.e. return here + 1. Before merging the PR, publish the new version of the `aws-db-esdk` crate and test the published crate (documented in next steps) +1. Run `cargo publish` +1. `cd ../../../DynamoDbEncryption/runtimes/rust/` # i.e. return here 1. ./test_published.sh N.N.N +1. Ignore/stash the changes in `DynamoDbEncryption/runtimes/rust/test_examples/Cargo.toml` which adds the `aws-db-esdk` +1. Merge the release PR