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

feat(cfnspec): cloudformation spec v22.0.0 #12204

Merged
merged 23 commits into from
Jan 5, 2021
Merged

Conversation

aws-cdk-automation
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation commented Dec 23, 2020

Fixes #12170
Fixes #11974
Fixes #12114
Fixes #12028

@pahud
Copy link
Contributor

pahud commented Dec 23, 2020

#12170

@NetaNir NetaNir linked an issue Dec 23, 2020 that may be closed by this pull request
2 tasks
@gitpod-io
Copy link

gitpod-io bot commented Dec 29, 2020

@skinny85 skinny85 added the pr/do-not-merge This PR should not be merged at this time. label Dec 29, 2020
@skinny85 skinny85 assigned skinny85 and unassigned rix0rrr Dec 29, 2020
eladb
eladb previously requested changes Dec 30, 2020
packages/@aws-cdk/aws-greengrass/package.json Outdated Show resolved Hide resolved
import * as path from 'path';
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as iam from '@aws-cdk/aws-iam';
import * as lambda from '@aws-cdk/aws-lambda';
// hack, as this is not exported by the Lambda module
import { calculateFunctionHash } from '@aws-cdk/aws-lambda/lib/function-hash';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not export then instead of reaching internals?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less surface area for the module?

@@ -9,15 +9,45 @@ export function calculateFunctionHash(fn: LambdaFunction) {

// render the cloudformation resource from this function
const config = stack.resolve((functionResource as any)._toCloudFormation());
// config is of the shape: { Resources: { LogicalId: { Type: 'Function', Properties: { ... } }}}
const resources = config.Resources;
const logicalId = Object.keys(resources)[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed here? Feels unrelated.

If the CfnFunction update resulted in hash changes and you think this is safe, we can easily update the hash without deploying by running yarn cdk-assert --dry-run.

We should follow up with a fix to how lambada calculates hash

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But reverting these changes means every single customer that updates to the new CDK version will get their Function's Versions replaced...?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Is this due to field order changes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The previous properties of the CfnFunction class result in JSON.stringfy() from here returning

{"Resources":{"Fn9270CBC0":{"Type":"AWS::Lambda::Function","Properties":{"Code":{"ZipFile":"foo"},"Role":{"Fn::GetAtt":["FnServiceRoleB9001A96","Arn"]},"Handler":"index.handler","Runtime":"nodejs10.x"}}}}

With the new properties (ImageConfig and PackageType) added to CfnFunction, the result is

{"Resources":{"Fn9270CBC0":{"Type":"AWS::Lambda::Function","Properties":{"Code":{"ZipFile":"foo"},"Handler":"index.handler","Role":{"Fn::GetAtt":["FnServiceRoleB9001A96","Arn"]},"Runtime":"nodejs10.x"}}}}

Which results in a different hash.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To correct myself slightly, the addition of the ImageConfig and PackageType does not matter here. What changes the order is the fact that the Handler and Runtime properties have been made optional (from required) in this spec version, and our code generation takes required properties before optional ones.

@mergify mergify bot dismissed eladb’s stale review December 30, 2020 19:12

Pull request has been modified.

eladb
eladb previously approved these changes Dec 30, 2020
@mergify mergify bot dismissed eladb’s stale review December 31, 2020 00:10

Pull request has been modified.

eladb
eladb previously approved these changes Dec 31, 2020
@eladb eladb removed the pr/do-not-merge This PR should not be merged at this time. label Dec 31, 2020
@mergify mergify bot dismissed eladb’s stale review December 31, 2020 07:49

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator Author

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: c994b30
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

skinny85
skinny85 previously approved these changes Jan 5, 2021
@mergify
Copy link
Contributor

mergify bot commented Jan 5, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot dismissed skinny85’s stale review January 5, 2021 00:44

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Jan 5, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit a5be2e9 into master Jan 5, 2021
@mergify mergify bot deleted the bump-cfnspec/v22.0.0 branch January 5, 2021 01:19
flochaz pushed a commit to flochaz/aws-cdk that referenced this pull request Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment