Skip to content

Commit

Permalink
chore: upgrade cdk migrate version with bug fixes (#27406)
Browse files Browse the repository at this point in the history
This change contains bug fixes for all languages, some of which were caught in our current tests. 

I'm continuing to list these changes as chores until we're ready for them to show up in our changelog.
>
> [CONTRIBUTING GUIDE]: https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md
> [DESIGN GUIDELINES]: https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md

Closes #<issue number here>.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
TheRealAmazonKendra authored Oct 5, 2023
1 parent 495dafa commit 8bb221d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 36 deletions.
12 changes: 6 additions & 6 deletions packages/@aws-cdk/cli-lib-alpha/THIRD_PARTY_LICENSES
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The @aws-cdk/cli-lib-alpha package includes the following third-party software/licensing:

** @jsii/check-node@1.88.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.88.0 | Apache-2.0
** @jsii/check-node@1.89.0 - https://www.npmjs.com/package/@jsii/check-node/v/1.89.0 | Apache-2.0
jsii
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Expand Down Expand Up @@ -264,7 +264,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE

----------------

** aws-sdk@2.1461.0 - https://www.npmjs.com/package/aws-sdk/v/2.1461.0 | Apache-2.0
** aws-sdk@2.1466.0 - https://www.npmjs.com/package/aws-sdk/v/2.1466.0 | Apache-2.0
AWS SDK for JavaScript
Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Expand Down Expand Up @@ -461,7 +461,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

----------------

** cdk-from-cfn@0.35.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.35.0 | MIT OR Apache-2.0
** cdk-from-cfn@0.47.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.47.0 | MIT OR Apache-2.0

----------------

Expand Down Expand Up @@ -2717,10 +2717,10 @@ THE SOFTWARE.

----------------

** sax@1.2.4 - https://www.npmjs.com/package/sax/v/1.2.4 | ISC
** sax@1.3.0 - https://www.npmjs.com/package/sax/v/1.3.0 | ISC
The ISC License

Copyright (c) Isaac Z. Schlueter and Contributors
Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand All @@ -2739,7 +2739,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
`String.fromCodePoint` by Mathias Bynens used according to terms of MIT
License, as follows:

Copyright Mathias Bynens <https://mathiasbynens.be/>
Copyright (c) 2010-2022 Mathias Bynens <https://mathiasbynens.be/>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/THIRD_PARTY_LICENSES
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

----------------

** cdk-from-cfn@0.36.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.36.0 | MIT OR Apache-2.0
** cdk-from-cfn@0.47.0 - https://www.npmjs.com/package/cdk-from-cfn/v/0.47.0 | MIT OR Apache-2.0

----------------

Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"aws-cdk-lib": "0.0.0",
"aws-sdk-mock": "5.6.0",
"axios": "^0.27.2",
"cdk-from-cfn": "^0.36.0",
"cdk-from-cfn": "^0.47.0",
"constructs": "^10.0.0",
"fast-check": "^3.13.1",
"jest": "^29.7.0",
Expand All @@ -105,7 +105,7 @@
"aws-sdk": "^2.1466.0",
"camelcase": "^6.3.0",
"cdk-assets": "0.0.0",
"cdk-from-cfn": "^0.36.0",
"cdk-from-cfn": "^0.47.0",
"chalk": "^4",
"chokidar": "^3.5.3",
"decamelize": "^5.0.1",
Expand Down
16 changes: 8 additions & 8 deletions packages/aws-cdk/test/commands/migrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/new GoodTypeScriptStack\(app, \'GoodTypeScript\', \{/)).filter(line => line).length).toEqual(1);

// Replaced stack file is correctly generated
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodTypeScript', 'lib', 'good_type_script-stack.ts'));
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3-stack.ts')));
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodTypeScript', 'lib', 'good_type_script-stack.ts'), 'utf8');
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3-stack.ts'), 'utf8'));
});

cliTest('generateCdkApp generates the expected cdk app when called for python', async (workDir) => {
Expand All @@ -142,8 +142,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/GoodPythonStack\(app, "GoodPython",/)).filter(line => line).length).toEqual(1);

// Replaced stack file is correctly generated
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodPython', 'good_python', 'good_python_stack.py'));
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3_stack.py')));
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodPython', 'good_python', 'good_python_stack.py'), 'utf8');
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 's3_stack.py'), 'utf8'));
});

cliTest('generateCdkApp generates the expected cdk app when called for java', async (workDir) => {
Expand All @@ -161,8 +161,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/ new GoodJavaStack\(app, "GoodJava", StackProps.builder()/)).filter(line => line).length).toEqual(1);

// Replaced stack file is correctly generated
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodJava', 'src', 'main', 'java', 'com', 'myorg', 'GoodJavaStack.java'));
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.java')));
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodJava', 'src', 'main', 'java', 'com', 'myorg', 'GoodJavaStack.java'), 'utf8');
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.java'), 'utf8'));
});

cliTest('generateCdkApp generates the expected cdk app when called for csharp', async (workDir) => {
Expand All @@ -180,8 +180,8 @@ describe('Migrate Function Tests', () => {
expect(app.map(line => line.match(/ new GoodCSharpStack\(app, "GoodCSharp", new StackProps/)).filter(line => line).length).toEqual(1);

// Replaced stack file is correctly generated
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodCSharp', 'src', 'GoodCSharp', 'GoodCSharpStack.cs'));
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.cs')));
const replacedStack = fs.readFileSync(path.join(workDir, 'GoodCSharp', 'src', 'GoodCSharp', 'GoodCSharpStack.cs'), 'utf8');
expect(replacedStack).toEqual(fs.readFileSync(path.join(...stackPath, 'S3Stack.cs'), 'utf8'));
});

cliTest('generatedCdkApp generates the expected cdk app when called for go', async (workDir) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import software.constructs.Construct;

import java.util.*;
import software.amazon.awscdk.*;
import software.amazon.awscdk.CfnMapping;
import software.amazon.awscdk.CfnTag;
import software.amazon.awscdk.Stack;
import software.amazon.awscdk.StackProps;

import software.amazon.awscdk.*;
import software.amazon.awscdk.services.s3.*;

class GoodJavaStack extends Stack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ export class GoodTypeScriptStack extends cdk.Stack {

// Outputs
this.websiteUrl = s3Bucket.attrWebsiteUrl;
new cdk.CfnOutput(this, 'WebsiteURL', {
description: 'URL for website hosted on S3',
value: this.websiteUrl!.toString(),
});
this.s3BucketSecureUrl = [
'https://',
s3Bucket.attrDomainName,
].join('');
new cdk.CfnOutput(this, 'S3BucketSecureURL', {
description: 'Name of S3 bucket to hold website content',
value: this.s3BucketSecureUrl!.toString(),
});
}
}
27 changes: 13 additions & 14 deletions packages/aws-cdk/test/commands/test-resources/stacks/s3_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
AWS CloudFormation Sample Template S3_Website_Bucket_With_Retain_On_Delete: Sample template showing how to create a publicly accessible S3 bucket configured for website access with a deletion policy of retain on delete.
"""
class GoodPythonStack(Stack):
"""
URL for website hosted on S3
"""
global website_u_r_l
"""
Name of S3 bucket to hold website content
"""
global s3_bucket_secure_u_r_l

def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)

Expand All @@ -30,18 +21,26 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
s3Bucket.cfn_options.deletion_policy = cdk.CfnDeletionPolicy.RETAIN

# Outputs
self.website_u_r_l = s3Bucket.attr_website_u_r_l
"""
URL for website hosted on S3
"""
self.website_url = s3Bucket.attr_website_url
cdk.CfnOutput(self, 'WebsiteURL',
description = 'URL for website hosted on S3',
value = self.website_u_r_l,
value = str(self.website_url),
)
self.s3_bucket_secure_u_r_l = [

"""
Name of S3 bucket to hold website content
"""
self.s3_bucket_secure_url = ''.join([
'https://',
s3Bucket.attr_domain_name,
].join('')
])
cdk.CfnOutput(self, 'S3BucketSecureURL',
description = 'Name of S3 bucket to hold website content',
value = self.s3_bucket_secure_u_r_l,
value = str(self.s3_bucket_secure_url),
)



8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5515,10 +5515,10 @@ [email protected], case@^1.6.3:
resolved "https://registry.npmjs.org/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9"
integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==

cdk-from-cfn@^0.36.0:
version "0.36.0"
resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.36.0.tgz#d5363d8475e10e09bcb7e8f5a64df19b8794df87"
integrity sha512-UWDcoLhph/1qUul2u7V2C2MMlbWGo4VhguyWEOHVDTSN4CZ/XuMH3GNDCaNVoQgeLh/GVJFtZAd92WUZNzj4hw==
cdk-from-cfn@^0.47.0:
version "0.47.0"
resolved "https://registry.npmjs.org/cdk-from-cfn/-/cdk-from-cfn-0.47.0.tgz#76998b826245ba28809746a173ef1f844294c32b"
integrity sha512-GNTTgBlFT1A2WezIeH4pjoTE2zuRJxpjl3emQCiTpQmDeTeQSfe30fvatrKc4Dn0TJZtNhTubpRJeRf2dfDDeA==

cdk-generate-synthetic-examples@^0.1.291:
version "0.1.291"
Expand Down

0 comments on commit 8bb221d

Please sign in to comment.