You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds the ability to acknowledge annotation warning messages.
The main motivation behind this is to allow people to set the `--strict` mode to fail synthesis on warnings. Currently it is all or nothing, you have to get rid of _all_ warnings to use `--strict`. With this feature users will be able to `acknowledge` warnings saying that they are aware, but it does not apply to them.
Since we want all warnings to now have an id this will deprecate the `addWarning` method and adds a new `addWarningV2` method.
Since the acknowledgements and warnings are written as metadata, it is possible to enhance this in the future to report on warnings and acknowledgements.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
'To authorize the VPC peering, call the GameLift service API CreateVpcPeeringAuthorization() or use the AWS CLI command create-vpc-peering-authorization.',
644
644
'Make this call using the account that manages your non-GameLift resources.',
this.warning(childNode,'Associate Stage: '+childNode.stageName+' to ensure all stacks in your cdk app are associated with AppRegistry. '
41
+
this.warning('StackNotAssociated',childNode,'Associate Stage: '+childNode.stageName+' to ensure all stacks in your cdk app are associated with AppRegistry. '
42
42
+'You can use ApplicationAssociator.associateStage to associate any stage.');
43
43
}
44
44
}
@@ -73,8 +73,8 @@ abstract class StackAssociatorBase implements IAspect {
this.warning(node,'Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack.');
90
+
this.warning('EnvironmentAgnosticStack',node,'Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack.');
91
91
return;
92
92
}
93
93
94
94
if(node.region!=this.application.env.region){
95
-
this.warning(node,'AppRegistry does not support cross region associations, deployment might fail if there is cross region stacks in the app. Application region '
95
+
this.warning('CrossRegionAssociation',node,'AppRegistry does not support cross region associations, deployment might fail if there is cross region stacks in the app. Application region '
96
96
+this.application.env.region+', stack region '+node.region);
97
97
}
98
98
}
@@ -106,7 +106,7 @@ abstract class StackAssociatorBase implements IAspect {
this.warning(node,'Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack.');
109
+
this.warning('EnvironmentAgnosticStack',node,'Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack.');
110
110
return;
111
111
}
112
112
@@ -121,7 +121,7 @@ abstract class StackAssociatorBase implements IAspect {
121
121
122
122
this.sharedAccounts.add(node.account);
123
123
}else{
124
-
this.warning(node,'Cross-account stack detected but application sharing and association will be skipped because cross-account option is not enabled.');
124
+
this.warning('AssociationSkipped',node,'Cross-account stack detected but application sharing and association will be skipped because cross-account option is not enabled.');
Annotations.fromStack(crossAccountStack).hasWarning('*','Cross-account stack detected but application sharing and association will be skipped because cross-account option is not enabled.');
194
+
Annotations.fromStack(crossAccountStack).hasWarning('*','Cross-account stack detected but application sharing and association will be skipped because cross-account option is not enabled. [ack: @aws-cdk/servicecatalogappregistry:AssociationSkipped]');
195
195
});
196
196
197
197
test('ApplicationAssociator with cross account stacks inside cdkApp does not give warning if associateCrossAccountStacks is set to true',()=>{
@@ -223,7 +223,7 @@ describe('Scope based Associations with Application with Cross Region/Account',
223
223
env: {account: 'account',region: 'region'},
224
224
});
225
225
Annotations.fromStack(crossRegionStack).hasWarning('*','AppRegistry does not support cross region associations, deployment might fail if there is cross region stacks in the app.'
226
-
+' Application region region2, stack region region');
226
+
+' Application region region2, stack region region [ack: @aws-cdk/servicecatalogappregistry:CrossRegionAssociation]');
227
227
});
228
228
229
229
test('Environment Agnostic ApplicationAssociator with cross region stacks inside cdkApp gives warning',()=>{
@@ -237,7 +237,7 @@ describe('Scope based Associations with Application with Cross Region/Account',
Annotations.fromStack(crossRegionStack).hasWarning('*','Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack.');
240
+
Annotations.fromStack(crossRegionStack).hasWarning('*','Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack. [ack: @aws-cdk/servicecatalogappregistry:EnvironmentAgnosticStack]');
241
241
});
242
242
243
243
test('Cdk App Containing Pipeline with stage but stage not associated throws error',()=>{
@@ -253,7 +253,7 @@ describe('Scope based Associations with Application with Cross Region/Account',
'Associate Stage: SampleStage to ensure all stacks in your cdk app are associated with AppRegistry. You can use ApplicationAssociator.associateStage to associate any stage.');
256
+
'Associate Stage: SampleStage to ensure all stacks in your cdk app are associated with AppRegistry. You can use ApplicationAssociator.associateStage to associate any stage. [ack: @aws-cdk/servicecatalogappregistry:StackNotAssociated]');
257
257
});
258
258
259
259
test('Cdk App Containing Pipeline with stage and stage associated successfully gets synthesized',()=>{
Annotations.of(this).addWarning(`addMethodResponse called multiple times with statusCode=${methodResponse.statusCode}, deployment will be nondeterministic. Use a single addMethodResponse call to configure the entire response.`);
291
+
Annotations.of(this).addWarningV2('@aws-cdk/aws-apigateway:duplicateStatusCodes',`addMethodResponse called multiple times with statusCode=${methodResponse.statusCode}, deployment will be nondeterministic. Use a single addMethodResponse call to configure the entire response.`);
Annotations.of(scope).addWarning('cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.');
66
+
Annotations.of(scope).addWarningV2('@aws-cdk/aws-applicationautoscaling:defaultRunEveryMinute','cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.');
Copy file name to clipboardExpand all lines: packages/aws-cdk-lib/aws-autoscaling/lib/auto-scaling-group.ts
+2-2
Original file line number
Diff line number
Diff line change
@@ -1380,7 +1380,7 @@ export class AutoScalingGroup extends AutoScalingGroupBase implements
1380
1380
});
1381
1381
1382
1382
if(desiredCapacity!==undefined){
1383
-
Annotations.of(this).addWarning('desiredCapacity has been configured. Be aware this will reset the size of your AutoScalingGroup on every deployment. See https://github.com/aws/aws-cdk/issues/5215');
1383
+
Annotations.of(this).addWarningV2('@aws-cdk/aws-autoscaling:desiredCapacitySet','desiredCapacity has been configured. Be aware this will reset the size of your AutoScalingGroup on every deployment. See https://github.com/aws/aws-cdk/issues/5215');
Annotations.of(scope).addWarning('cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.');
36
+
Annotations.of(scope).addWarningV2('@aws-cdk/aws-autoscaling:scheduleDefaultRunsEveryMinute','cron: If you don\'t pass \'minute\', by default the event runs every minute. Pass \'minute: \'*\'\' if that\'s what you intend, or \'minute: 0\' to run once per hour instead.');
Annotations.fromStack(stack).hasWarning('/Default/MyStack','iops will be ignored without volumeType: EbsDeviceVolumeType.IO1');
1238
+
Annotations.fromStack(stack).hasWarning('/Default/MyStack','iops will be ignored without volumeType: EbsDeviceVolumeType.IO1 [ack: @aws-cdk/aws-autoscaling:iopsIgnored]');
1239
1239
});
1240
1240
1241
1241
test('warning if iops and volumeType !== IO1',()=>{
Annotations.fromStack(stack).hasWarning('/Default/MyStack','iops will be ignored without volumeType: EbsDeviceVolumeType.IO1');
1262
+
Annotations.fromStack(stack).hasWarning('/Default/MyStack','iops will be ignored without volumeType: EbsDeviceVolumeType.IO1 [ack: @aws-cdk/aws-autoscaling:iopsIgnored]');
Annotations.fromStack(stack).hasWarning('/Default/ASG/ScheduledActionScaleOutInTheMorning',"cron: If you don't pass 'minute', by default the event runs every minute. Pass 'minute: '*'' if that's what you intend, or 'minute: 0' to run once per hour instead.");
136
+
Annotations.fromStack(stack).hasWarning('/Default/ASG/ScheduledActionScaleOutInTheMorning',"cron: If you don't pass 'minute', by default the event runs every minute. Pass 'minute: '*'' if that's what you intend, or 'minute: 0' to run once per hour instead. [ack: @aws-cdk/aws-autoscaling:scheduleDefaultRunsEveryMinute]");
137
137
});
138
138
139
139
test('scheduled scaling shows no warning when minute is * in cron',()=>{
0 commit comments