Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 16, 2021
2 parents 0209426 + 597268a commit 35f4483
Show file tree
Hide file tree
Showing 246 changed files with 10,306 additions and 1,173 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/issue-label-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,8 @@ jobs:
{"area":"@aws-cdk/region-info","keywords":["region-info","fact"],"labels":["@aws-cdk/region-info"],"assignees":["skinny85"]},
{"area":"aws-cdk-lib","keywords":["aws-cdk-lib","cdk-v2","v2","ubergen"],"labels":["aws-cdk-lib"],"assignees":["nija-at"]},
{"area":"monocdk","keywords":["monocdk","monocdk-experiment"],"labels":["monocdk"],"assignees":["nija-at"]},
{"area":"@aws-cdk/yaml-cfn","keywords":["(aws-yaml-cfn)","(yaml-cfn)"],"labels":["@aws-cdk/aws-yaml-cfn"],"assignees":["skinny85"]}
{"area":"@aws-cdk/yaml-cfn","keywords":["(aws-yaml-cfn)","(yaml-cfn)"],"labels":["@aws-cdk/aws-yaml-cfn"],"assignees":["skinny85"]},
{"area":"@aws-cdk/aws-apprunner","keywords":["apprunner","aws-apprunner"],"labels":["@aws-cdk/aws-apprunner"],"assignees":["corymhall"]},
{"area":"@aws-cdk/aws-lightsail","keywords":["lightsail","aws-lightsail"],"labels":["@aws-cdk/aws-lightsail"],"assignees":["corymhall"]},
{"area":"@aws-cdk/aws-aps","keywords":["aps","aws-aps","prometheus"],"labels":["@aws-cdk/aws-aps"],"assignees":["corymhall"]}
]
2 changes: 1 addition & 1 deletion .github/workflows/pr-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/checkout@v2

- name: Install & Build prlint
run: cd tools/@aws-cdk/prlint && yarn install --frozen-lockfile && yarn build+test
run: yarn install --frozen-lockfile && cd tools/@aws-cdk/prlint && yarn build+test

- name: Validate
uses: ./tools/@aws-cdk/prlint
Expand Down
19 changes: 7 additions & 12 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ pull_request_rules:
actions:
comment:
message: Thank you for contributing! Your pull request will be automatically updated and merged (do not update manually, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
merge:
strict: smart
queue:
name: default
method: squash
strict_method: merge
commit_message: title+body
conditions:
- base!=release
Expand All @@ -60,11 +59,9 @@ pull_request_rules:
actions:
comment:
message: Thank you for contributing! Your pull request will be automatically updated and merged without squashing (do not update manually, and be sure to [allow changes to be pushed to your fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)).
merge:
strict: smart
# Merge instead of squash
queue:
name: default
method: merge
strict_method: merge
commit_message: title+body
conditions:
- -title~=(WIP|wip)
Expand Down Expand Up @@ -106,12 +103,10 @@ pull_request_rules:
actions:
comment:
message: Thanks Dependabot!
merge:
# 'strict: false' disables Mergify keeping the branch up-to-date from master.
# It's not necessary: Dependabot will do that itself.
# It's not dangerous: GitHub branch protection settings prevent merging stale branches.
strict: false
queue:
name: default
method: squash
commit_message: title+body
conditions:
- -title~=(WIP|wip)
- -label~=(blocked|do-not-merge)
Expand Down
6 changes: 5 additions & 1 deletion allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,8 @@ strengthened:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps

# Remove IO2 from autoscaling EbsDeviceVolumeType. This value is not supported
# at the moment and was not supported in the past.
removed:@aws-cdk/aws-autoscaling.EbsDeviceVolumeType.IO2
removed:@aws-cdk/aws-autoscaling.EbsDeviceVolumeType.IO2

# Remove autoTerminationPolicy from stepfunctions-tasks EmrCreateClusterProps. This value is not supported by stepfunctions at the moment and was not supported in the past.
removed:@aws-cdk/aws-stepfunctions-tasks.EmrCreateCluster.AutoTerminationPolicyProperty
removed:@aws-cdk/aws-stepfunctions-tasks.EmrCreateClusterProps.autoTerminationPolicy
11 changes: 2 additions & 9 deletions pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,14 @@ function lerna_scopes() {
done
}

# Compile examples with respect to "decdk" directory, as all packages will
# be symlinked there so they can all be included.
echo "Extracting code samples" >&2
scripts/run-rosetta.sh $TMPDIR/jsii.txt

echo "Infusing examples back into assemblies" >&2
$ROSETTA infuse \
samples.tabl.json \
$(cat $TMPDIR/jsii.txt)
scripts/run-rosetta.sh --infuse --pkgs-from $TMPDIR/jsii.txt

# Jsii packaging (all at once using jsii-pacmak)
echo "Packaging jsii modules" >&2
$PACMAK \
--verbose \
--rosetta-tablet samples.tabl.json \
--rosetta-unknown-snippets=fail \
$(cat $TMPDIR/jsii.txt)

# Non-jsii packaging, which means running 'package' in every individual
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
"@aws-cdk/assertions/fs-extra/**",
"@aws-cdk/aws-amplify-alpha/yaml",
"@aws-cdk/aws-amplify-alpha/yaml/**",
"@aws-cdk/aws-iot-actions-alpha/case",
"@aws-cdk/aws-iot-actions-alpha/case/**",
"@aws-cdk/aws-amplify/yaml",
"@aws-cdk/aws-amplify/yaml/**",
"@aws-cdk/aws-codebuild/yaml",
Expand All @@ -91,6 +93,8 @@
"@aws-cdk/aws-eks/yaml/**",
"@aws-cdk/aws-events-targets/aws-sdk",
"@aws-cdk/aws-events-targets/aws-sdk/**",
"@aws-cdk/aws-iot-actions/case",
"@aws-cdk/aws-iot-actions/case/**",
"@aws-cdk/aws-s3-deployment/case",
"@aws-cdk/aws-s3-deployment/case/**",
"@aws-cdk/cloud-assembly-schema/jsonschema",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ecs from '@aws-cdk/aws-ecs';
import * as cdk from '@aws-cdk/core';
import { Service } from '../service';
import { Service, connectToProps } from '../service';

// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
// eslint-disable-next-line no-duplicate-imports, import/order
Expand Down Expand Up @@ -225,8 +225,9 @@ export abstract class ServiceExtension {
*
* @param service - The other service to connect to.
*/
public connectToService(service: Service) {
public connectToService(service: Service, connectToProp: connectToProps) {
service = service;
connectToProp = connectToProp;
}
}

Expand Down
17 changes: 15 additions & 2 deletions packages/@aws-cdk-containers/ecs-service-extensions/lib/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ import { ServiceDescription } from './service-description';
// eslint-disable-next-line no-duplicate-imports, import/order
import { Construct } from '@aws-cdk/core';

/**
* connectToProps will have all the extra parameters which are required for connecting services.
*/
export interface connectToProps {
/**
* local_bind_port is the local port that this application should
* use when calling the upstream service in ECS Consul Mesh Extension
* Currently, this parameter will only be used in the ECSConsulMeshExtension
* https://github.com/aws-ia/ecs-consul-mesh-extension
*/
readonly local_bind_port?: number;
}

/**
* The settings for an ECS Service.
*/
Expand Down Expand Up @@ -313,10 +326,10 @@ export class Service extends Construct {
*
* @param service
*/
public connectTo(service: Service) {
public connectTo(service: Service, connectToProps: connectToProps = {}) {
for (const extensions in this.serviceDescription.extensions) {
if (this.serviceDescription.extensions[extensions]) {
this.serviceDescription.extensions[extensions].connectToService(service);
this.serviceDescription.extensions[extensions].connectToService(service, connectToProps);
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions packages/@aws-cdk/aws-apigateway/lib/api-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import * as s3_assets from '@aws-cdk/aws-s3-assets';

// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
// eslint-disable-next-line no-duplicate-imports, import/order
import * as cxapi from '@aws-cdk/cx-api';
import { Node } from 'constructs';
import { CfnRestApi } from './apigateway.generated';
import { IRestApi } from './restapi';
import { Construct } from '@aws-cdk/core';

/**
Expand Down Expand Up @@ -82,6 +86,15 @@ export abstract class ApiDefinition {
* assume it's initialized. You may just use it as a construct scope.
*/
public abstract bind(scope: Construct): ApiDefinitionConfig;

/**
* Called after the CFN RestApi resource has been created to allow the Api
* Definition to bind to it. Specifically it's required to allow assets to add
* metadata for tooling like SAM CLI to be able to find their origins.
*/
public bindAfterCreate(_scope: Construct, _restApi: IRestApi) {
return;
}
}

/**
Expand Down Expand Up @@ -198,4 +211,18 @@ export class AssetApiDefinition extends ApiDefinition {
},
};
}

public bindAfterCreate(scope: Construct, restApi: IRestApi) {
if (!scope.node.tryGetContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT)) {
return; // not enabled
}

if (!this.asset) {
throw new Error('bindToResource() must be called after bind()');
}

const child = Node.of(restApi).defaultChild as CfnRestApi;
child.addMetadata(cxapi.ASSET_RESOURCE_METADATA_PATH_KEY, this.asset.assetPath);
child.addMetadata(cxapi.ASSET_RESOURCE_METADATA_PROPERTY_KEY, 'BodyS3Location');
}
}
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-apigateway/lib/restapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,9 @@ export class SpecRestApi extends RestApiBase {
endpointConfiguration: this._configureEndpoints(props),
parameters: props.parameters,
});

props.apiDefinition.bindAfterCreate(this, this);

this.node.defaultChild = resource;
this.restApiId = resource.ref;
this.restApiRootResourceId = resource.attrRootResourceId;
Expand Down
19 changes: 19 additions & 0 deletions packages/@aws-cdk/aws-apigateway/test/api-definition.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import '@aws-cdk/assert-internal/jest';
import * as path from 'path';
import { ResourcePart } from '@aws-cdk/assert-internal';
import * as s3 from '@aws-cdk/aws-s3';
import * as cdk from '@aws-cdk/core';
import * as cxapi from '@aws-cdk/cx-api';
import * as apigw from '../lib';

describe('api definition', () => {
Expand Down Expand Up @@ -73,6 +75,23 @@ describe('api definition', () => {
expect(synthesized.assets.length).toEqual(1);

});

test('asset metadata added to RestApi resource that contains Asset Api Definition', () => {
const stack = new cdk.Stack();
stack.node.setContext(cxapi.ASSET_RESOURCE_METADATA_ENABLED_CONTEXT, true);
const assetApiDefinition = apigw.ApiDefinition.fromAsset(path.join(__dirname, 'sample-definition.yaml'));
new apigw.SpecRestApi(stack, 'API', {
apiDefinition: assetApiDefinition,
});

expect(stack).toHaveResource('AWS::ApiGateway::RestApi', {
Metadata: {
'aws:asset:path': 'asset.68497ac876de4e963fc8f7b5f1b28844c18ecc95e3f7c6e9e0bf250e03c037fb.yaml',
'aws:asset:property': 'BodyS3Location',
},
}, ResourcePart.CompleteDefinition);

});
});

describe('apigateway.ApiDefinition.fromBucket', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@
]
}
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyAuthorizerFunctionServiceRole8A34C19E",
"Arn"
]
},
"Runtime": "nodejs10.x"
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
"MyAuthorizerFunctionServiceRole8A34C19E"
Expand Down Expand Up @@ -313,4 +313,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const app = new App();
const stack = new Stack(app, 'RequestAuthorizerInteg');

const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@
]
}
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyAuthorizerFunctionServiceRole8A34C19E",
"Arn"
]
},
"Runtime": "nodejs10.x"
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
"MyAuthorizerFunctionServiceRole8A34C19E"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const app = new App();
const stack = new Stack(app, 'TokenAuthorizerIAMRoleInteg');

const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@
]
}
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"MyAuthorizerFunctionServiceRole8A34C19E",
"Arn"
]
},
"Runtime": "nodejs10.x"
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
"MyAuthorizerFunctionServiceRole8A34C19E"
Expand Down Expand Up @@ -313,4 +313,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const app = new App();
const stack = new Stack(app, 'TokenAuthorizerInteg');

const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,14 @@
]
}
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"handlerServiceRole187D5A5A",
"Arn"
]
},
"Runtime": "nodejs10.x"
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
"handlerServiceRole187D5A5A"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/test/integ.cors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestStack extends Stack {
const api = new apigw.RestApi(this, 'cors-api-test');

const handler = new lambda.Function(this, 'handler', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'integ.cors.handler')),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
"Code": {
"ZipFile": "foo"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"myfnServiceRole7822DC24",
"Arn"
]
},
"Runtime": "nodejs10.x"
"Handler": "index.handler",
"Runtime": "nodejs14.x"
},
"DependsOn": [
"myfnServiceRole7822DC24"
Expand Down
Loading

0 comments on commit 35f4483

Please sign in to comment.