Skip to content

Commit

Permalink
Merge branch 'main' into retry-attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Sep 3, 2022
2 parents 6b08375 + e1794e3 commit 686cf70
Show file tree
Hide file tree
Showing 54 changed files with 366 additions and 121 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/http/vpc-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class VpcLink extends Resource implements IVpcLink {

this.vpcLinkId = cfnResource.ref;

const { subnets } = props.vpc.selectSubnets(props.subnets ?? { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT });
const { subnets } = props.vpc.selectSubnets(props.subnets ?? { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS });
this.addSubnets(...subnets);

if (props.securityGroups) {
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-appsync/test/appsync-rds.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Rds Data Source configuration', () => {
credentials: { username: 'clusteradmin' },
clusterIdentifier: 'db-endpoint-test',
vpc,
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_NAT },
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_EGRESS },
securityGroups: [securityGroup],
defaultDatabaseName: 'Animals',
});
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('adding rds data source from imported api', () => {
credentials: { username: 'clusteradmin' },
clusterIdentifier: 'db-endpoint-test',
vpc,
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_NAT },
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_EGRESS },
securityGroups: [securityGroup],
defaultDatabaseName: 'Animals',
});
Expand Down Expand Up @@ -269,4 +269,4 @@ describe('adding rds data source from imported api', () => {
ApiId: { 'Fn::GetAtt': ['baseApiCDA4D43A', 'ApiId'] },
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ test('can use Vpc imported from unparseable list tokens', () => {
vpc,
allowAllOutbound: false,
associatePublicIpAddress: false,
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT },
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
});

// THEN
Expand Down
15 changes: 14 additions & 1 deletion packages/@aws-cdk/aws-batch/lib/job-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,18 @@ export interface JobDefinitionProps {
* @default - EC2
*/
readonly platformCapabilities?: PlatformCapabilities[];

/**
* Specifies whether to propagate the tags from the job or job definition to the corresponding Amazon ECS task.
* If no value is specified, the tags aren't propagated.
* Tags can only be propagated to the tasks during task creation. For tags with the same name,
* job tags are given priority over job definitions tags.
* If the total number of combined tags from the job and job definition is over 50, the job is moved to the `FAILED` state.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-batch-jobdefinition.html#cfn-batch-jobdefinition-propagatetags
* @default - undefined
*/
readonly propagateTags?: boolean;
}

/**
Expand Down Expand Up @@ -458,6 +470,7 @@ export class JobDefinition extends Resource implements IJobDefinition {
attemptDurationSeconds: props.timeout ? props.timeout.toSeconds() : undefined,
},
platformCapabilities: props.platformCapabilities ?? [PlatformCapabilities.EC2],
propagateTags: props.propagateTags,
});

// add read secrets permission to execution role
Expand Down Expand Up @@ -602,4 +615,4 @@ export class JobDefinition extends Resource implements IJobDefinition {
};
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe('Batch Compute Environment', () => {
],
type: batch.ComputeResourceType.ON_DEMAND,
vpcSubnets: {
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
},
} as batch.ComputeResources,
enabled: false,
Expand Down
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-batch/test/integ.job-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ new JobDefinition(stack, "JobDefinition", {
},
});

new JobDefinition(stack, "JobDefinitionTags", {
container: {
image: ContainerImage.fromRegistry("docker/whalesay"),
},
propagateTags: true,
});

const integ = new IntegTest(app, "IntegTest-BatchDefaultEnvVarsStack", {
testCases: [stack],
regions: ["us-east-1"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "21.0.0",
"files": {
"0a50911921bcac3c1775e3a82fc9c4414e3f12ea24b1e2c73bf1fc4c625ee16c": {
"fa4cb3c0495612b2b5dea9687948520b07f859705061dad691367153183cbc90": {
"source": {
"path": "BatchDefaultEnvVarsStack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "0a50911921bcac3c1775e3a82fc9c4414e3f12ea24b1e2c73bf1fc4c625ee16c.json",
"objectKey": "fa4cb3c0495612b2b5dea9687948520b07f859705061dad691367153183cbc90.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,49 @@
},
"Timeout": {}
}
},
"JobDefinitionTags76FA063A": {
"Type": "AWS::Batch::JobDefinition",
"Properties": {
"Type": "container",
"ContainerProperties": {
"Environment": [
{
"Name": "AWS_REGION",
"Value": {
"Ref": "AWS::Region"
}
},
{
"Name": "AWS_ACCOUNT",
"Value": {
"Ref": "AWS::AccountId"
}
}
],
"Image": "docker/whalesay",
"Privileged": false,
"ReadonlyRootFilesystem": false,
"ResourceRequirements": [
{
"Type": "VCPU",
"Value": "1"
},
{
"Type": "MEMORY",
"Value": "4"
}
]
},
"PlatformCapabilities": [
"EC2"
],
"PropagateTags": true,
"RetryStrategy": {
"Attempts": 1
},
"Timeout": {}
}
}
},
"Parameters": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
}
}
},
"de70b340a5b843502197c20700c9328cb928be11584f66762e1ac05dc5380bed": {
"674d442d4a977a672cccae088b5eabcf91e06ee46b2464e4437c0332e04cf1a8": {
"source": {
"path": "IntegTestBatchDefaultEnvVarsStackDefaultTestDeployAssertC15EFFF2.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "de70b340a5b843502197c20700c9328cb928be11584f66762e1ac05dc5380bed.json",
"objectKey": "674d442d4a977a672cccae088b5eabcf91e06ee46b2464e4437c0332e04cf1a8.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"status": "ACTIVE"
},
"flattenResponse": "true",
"salt": "1661947601911"
"salt": "1662181496271"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand All @@ -36,7 +36,7 @@
]
},
"expected": "{\"$StringLike\":\"AWS_REGION\"}",
"salt": "1661947601912"
"salt": "1662181496272"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/0a50911921bcac3c1775e3a82fc9c4414e3f12ea24b1e2c73bf1fc4c625ee16c.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fa4cb3c0495612b2b5dea9687948520b07f859705061dad691367153183cbc90.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand All @@ -45,6 +45,12 @@
"data": "JobDefinition24FFE3ED"
}
],
"/BatchDefaultEnvVarsStack/JobDefinitionTags/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "JobDefinitionTags76FA063A"
}
],
"/BatchDefaultEnvVarsStack/BootstrapVersion": [
{
"type": "aws:cdk:logicalId",
Expand Down Expand Up @@ -76,7 +82,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/de70b340a5b843502197c20700c9328cb928be11584f66762e1ac05dc5380bed.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/674d442d4a977a672cccae088b5eabcf91e06ee46b2464e4437c0332e04cf1a8.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.85"
"version": "10.1.92"
}
},
"BatchDefaultEnvVarsStack": {
Expand Down Expand Up @@ -91,6 +91,83 @@
"fqn": "@aws-cdk/aws-batch.JobDefinition",
"version": "0.0.0"
}
},
"JobDefinitionTags": {
"id": "JobDefinitionTags",
"path": "BatchDefaultEnvVarsStack/JobDefinitionTags",
"children": {
"Resource-Batch-Task-Definition-Role": {
"id": "Resource-Batch-Task-Definition-Role",
"path": "BatchDefaultEnvVarsStack/JobDefinitionTags/Resource-Batch-Task-Definition-Role",
"constructInfo": {
"fqn": "@aws-cdk/aws-iam.LazyRole",
"version": "0.0.0"
}
},
"Resource-Batch-Job-Container-Definition": {
"id": "Resource-Batch-Job-Container-Definition",
"path": "BatchDefaultEnvVarsStack/JobDefinitionTags/Resource-Batch-Job-Container-Definition",
"constructInfo": {
"fqn": "@aws-cdk/aws-ecs.ContainerDefinition",
"version": "0.0.0"
}
},
"Resource": {
"id": "Resource",
"path": "BatchDefaultEnvVarsStack/JobDefinitionTags/Resource",
"attributes": {
"aws:cdk:cloudformation:type": "AWS::Batch::JobDefinition",
"aws:cdk:cloudformation:props": {
"type": "container",
"containerProperties": {
"environment": [
{
"name": "AWS_REGION",
"value": {
"Ref": "AWS::Region"
}
},
{
"name": "AWS_ACCOUNT",
"value": {
"Ref": "AWS::AccountId"
}
}
],
"image": "docker/whalesay",
"privileged": false,
"readonlyRootFilesystem": false,
"resourceRequirements": [
{
"type": "VCPU",
"value": "1"
},
{
"type": "MEMORY",
"value": "4"
}
]
},
"platformCapabilities": [
"EC2"
],
"propagateTags": true,
"retryStrategy": {
"attempts": 1
},
"timeout": {}
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch.CfnJobDefinition",
"version": "0.0.0"
}
}
},
"constructInfo": {
"fqn": "@aws-cdk/aws-batch.JobDefinition",
"version": "0.0.0"
}
}
},
"constructInfo": {
Expand All @@ -111,7 +188,7 @@
"path": "IntegTest-BatchDefaultEnvVarsStack/DefaultTest/Default",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.85"
"version": "10.1.92"
}
},
"DeployAssert": {
Expand All @@ -131,7 +208,7 @@
"path": "IntegTest-BatchDefaultEnvVarsStack/DefaultTest/DeployAssert/AwsApiCallBatchdescribeJobDefinitions/SdkProvider/AssertionsProvider",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.85"
"version": "10.1.92"
}
}
},
Expand Down Expand Up @@ -171,7 +248,7 @@
"path": "IntegTest-BatchDefaultEnvVarsStack/DefaultTest/DeployAssert/AwsApiCallBatchdescribeJobDefinitions/AssertEqualsBatchdescribeJobDefinitions/AssertionProvider/AssertionsProvider",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.85"
"version": "10.1.92"
}
}
},
Expand Down Expand Up @@ -249,7 +326,7 @@
},
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.85"
"version": "10.1.92"
}
}
},
Expand Down
15 changes: 15 additions & 0 deletions packages/@aws-cdk/aws-batch/test/job-definition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,21 @@ describe('Batch Job Definition', () => {
});
});

test('Can propagate tags', () => {
// WHEN
new batch.JobDefinition(stack, 'job-def', {
container: {
image: ecs.ContainerImage.fromRegistry('docker/whalesay'),
},
propagateTags: true,
});

// THEN
Template.fromStack(stack).hasResourceProperties('AWS::Batch::JobDefinition', {
PropagateTags: true,
});
});

test('can use an ecr image', () => {
// WHEN
const repo = new ecr.Repository(stack, 'image-repo');
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloud9/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ new cloud9.Ec2Environment(this, 'Cloud9Env2', {
const c9env = new cloud9.Ec2Environment(this, 'Cloud9Env3', {
vpc,
subnetSelection: {
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
},
imageId: cloud9.ImageId.AMAZON_LINUX_2,
});
Expand Down
Loading

0 comments on commit 686cf70

Please sign in to comment.