-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Enable creation of strong names for .NET assemblies. #643
Changes from 1 commit
e4598c8
8be41f6
ec72837
2e7e0ea
a575a2a
b59db47
2ba98d8
34655f2
884740d
2a90730
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
# This script retrieves the .snk file needed | ||
# to create strong names for .NET assemblies. | ||
echo "Retrieving SNK..." | ||
|
||
sudo apt install jq -y | ||
|
||
ROLE=$(aws sts assume-role --region us-east-2 --role-arn ${DOTNET_STRONG_NAME_ROLE_ARN:-} --role-session-name "cdk-dotnet-snk") | ||
export AWS_ACCESS_KEY_ID=$(echo $ROLE | jq -r .Credentials.AccessKeyId) | ||
export AWS_SECRET_ACCESS_KEY=$(echo $ROLE | jq -r .Credentials.SecretAccessKey) | ||
export AWS_SESSION_TOKEN=$(echo $ROLE | jq .Credentials.SessionToken) | ||
|
||
SNK_SECRET=$(aws secretsmanager get-secret-value --region us-east-2 --secret-id ${DOTNET_STRONG_NAME_SECRET_ID:-}) | ||
TMP_DIR=$(mktemp -d) | ||
TMP_KEY="$TMP_DIR/key.snk" | ||
echo $SNK_SECRET | jq -r .SecretBinary | base64 --decode > $TMP_KEY | ||
|
||
for PACKAGE_PATH in packages/@aws-cdk/*; do | ||
JSII_PROPERTY=$(cat "$PACKAGE_PATH/package.json" | jq -r .jsii) | ||
if [ -z $JSII_PROPERTY ]; then | ||
continue | ||
fi | ||
|
||
cp $TMP_KEY $PACKAGE_PATH | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of copying this file everywhere, maybe the .NET build can consult an environment variable for it's location? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another issue with using an environment variable is: How would it be set? The temporary directory is created by |
||
done | ||
|
||
rm -rf $TMP_DIR |
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.
region pass in?