Skip to content

Commit

Permalink
fix(deps): migrate to stable synthetics (#279)
Browse files Browse the repository at this point in the history
* fix(deps): upgrade dependencies

* fix: Add snapshots

---------

Co-authored-by: Casey Lee <[email protected]>
  • Loading branch information
nicoalonsop and cplee authored Oct 3, 2023
1 parent 8bf6c18 commit 3c5b6d9
Show file tree
Hide file tree
Showing 20 changed files with 432 additions and 440 deletions.
16 changes: 3 additions & 13 deletions .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class WorkflowDotNetVersionPatch {
);
}
}
const cdkVersion = '2.84.0';
const cdkVersion = '2.99.0';
const project = new CdklabsConstructLibrary({
setNodeEngineVersion: false,
private: false,
Expand Down Expand Up @@ -90,9 +90,7 @@ const project = new CdklabsConstructLibrary({
'jmespath',
],
deps: [],
peerDeps: [
`@aws-cdk/aws-synthetics-alpha@^${cdkVersion}-alpha.0`,
],
peerDeps: [],
keywords: [
'aws',
'cdk',
Expand All @@ -111,4 +109,4 @@ project.upgradeWorkflow?.postUpgradeTask.spawn(
new WorkflowDotNetVersionPatch(project, { workflow: 'build', jobName: 'package-dotnet', dotNetVersion: '6.x' });
new WorkflowDotNetVersionPatch(project, { workflow: 'release', jobName: 'release_nuget', dotNetVersion: '6.x' });

project.synth();
project.synth();
8 changes: 4 additions & 4 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions API.md.md
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,12 @@ const apiCanaryProps: ApiCanaryProps = { ... }
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.baseUrl">baseUrl</a></code> | <code>string</code> | The base URL to use for tests. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.artifactsBucketLocation">artifactsBucketLocation</a></code> | <code>@aws-cdk/aws-synthetics-alpha.ArtifactsBucketLocation</code> | The s3 location that stores the data of the canary runs. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.artifactsBucketLocation">artifactsBucketLocation</a></code> | <code>aws-cdk-lib.aws-synthetics.ArtifactsBucketLocation</code> | The s3 location that stores the data of the canary runs. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.canaryName">canaryName</a></code> | <code>string</code> | The name of the canary. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.durationAlarmThreshold">durationAlarmThreshold</a></code> | <code>aws-cdk-lib.Duration</code> | The threshold for triggering an alarm on the test duration. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.failureRetentionPeriod">failureRetentionPeriod</a></code> | <code>aws-cdk-lib.Duration</code> | How many days should failed runs be retained. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | Canary execution role. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.schedule">schedule</a></code> | <code>@aws-cdk/aws-synthetics-alpha.Schedule</code> | Specify the schedule for how often the canary runs. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.schedule">schedule</a></code> | <code>aws-cdk-lib.aws-synthetics.Schedule</code> | Specify the schedule for how often the canary runs. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.securityGroups">securityGroups</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup[]</code> | The list of security groups to associate with the canary's network interfaces. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.startAfterCreation">startAfterCreation</a></code> | <code>boolean</code> | Whether or not the canary should start after creation. |
| <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiCanaryProps.property.steps">steps</a></code> | <code><a href="#@cdklabs/cdk-ecs-codedeploy.ApiTestStep">ApiTestStep</a>[]</code> | The steps to perform in the synthetic test. |
Expand Down Expand Up @@ -867,7 +867,7 @@ The base URL to use for tests.
public readonly artifactsBucketLocation: ArtifactsBucketLocation;
```

- *Type:* @aws-cdk/aws-synthetics-alpha.ArtifactsBucketLocation
- *Type:* aws-cdk-lib.aws-synthetics.ArtifactsBucketLocation
- *Default:* A new s3 bucket will be created without a prefix.

The s3 location that stores the data of the canary runs.
Expand Down Expand Up @@ -949,7 +949,7 @@ If you provide a Role, you must add the required permissions.
public readonly schedule: Schedule;
```

- *Type:* @aws-cdk/aws-synthetics-alpha.Schedule
- *Type:* aws-cdk-lib.aws-synthetics.Schedule
- *Default:* 'rate(5 minutes)'

Specify the schedule for how often the canary runs.
Expand Down Expand Up @@ -2294,8 +2294,3 @@ public toString(): string
```

Render JSON string for this AppSpec to be used.





6 changes: 2 additions & 4 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/api-canary/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as path from 'path';
import { Canary, ArtifactsBucketLocation, Schedule, Test, Code, Runtime } from '@aws-cdk/aws-synthetics-alpha';
import { Duration, DockerImage, Lazy } from 'aws-cdk-lib';
import { Alarm, ComparisonOperator } from 'aws-cdk-lib/aws-cloudwatch';
import { IVpc, SubnetSelection, ISecurityGroup } from 'aws-cdk-lib/aws-ec2';
import { IRole } from 'aws-cdk-lib/aws-iam';
import { BlockPublicAccess, Bucket, BucketEncryption } from 'aws-cdk-lib/aws-s3';
import { Asset } from 'aws-cdk-lib/aws-s3-assets';
import { Canary, ArtifactsBucketLocation, Schedule, Test, Code, Runtime } from 'aws-cdk-lib/aws-synthetics';
import { Construct } from 'constructs';
import { CanaryCodeBundler } from './code-bundling';

Expand Down Expand Up @@ -263,4 +263,4 @@ export class ApiCanary extends Canary {
addTestStep(step: ApiTestStep) {
this._steps.push(step);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Schedule } from '@aws-cdk/aws-synthetics-alpha';
import { Duration } from 'aws-cdk-lib';
import { Alarm, AlarmRule, ComparisonOperator, CompositeAlarm, IAlarm } from 'aws-cdk-lib/aws-cloudwatch';
import { EcsApplication, EcsDeploymentConfig, EcsDeploymentGroup, IEcsDeploymentConfig } from 'aws-cdk-lib/aws-codedeploy';
import { BaseService, DeploymentControllerType } from 'aws-cdk-lib/aws-ecs';
import { ApplicationLoadBalancedFargateService, ApplicationLoadBalancedFargateServiceProps } from 'aws-cdk-lib/aws-ecs-patterns';
import { ApplicationListener, ApplicationProtocol, ApplicationTargetGroup, HealthCheck, TargetType } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
import { BlockPublicAccess, Bucket, BucketEncryption, IBucket } from 'aws-cdk-lib/aws-s3';
import { Schedule } from 'aws-cdk-lib/aws-synthetics';
import { Construct } from 'constructs';
import { ApiTestStep, ApiCanary } from '../api-canary';
import { AppSpecHooks } from '../ecs-appspec';
Expand Down
6 changes: 3 additions & 3 deletions test/api-canary.integ.snapshot/TestStack.assets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "34.0.0",
"files": {
"93db9dcabf8af9cc80ac1a58b535f16939207937839bf12b4db178e54a4bb659": {
"source": {
Expand All @@ -14,15 +14,15 @@
}
}
},
"c6e791c2d86fda8742bba34c487f10342147c3562dd4f75a4f498a799ba87f69": {
"d428f5016b7e6efee91ad9984c36717dc703b4b47ff3843a0b4b2a800ec16e01": {
"source": {
"path": "TestStack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "c6e791c2d86fda8742bba34c487f10342147c3562dd4f75a4f498a799ba87f69.json",
"objectKey": "d428f5016b7e6efee91ad9984c36717dc703b4b47ff3843a0b4b2a800ec16e01.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
14 changes: 7 additions & 7 deletions test/api-canary.integ.snapshot/TestStack.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,26 +222,25 @@
]
},
"Name": "teststacksynthe589c28",
"RuntimeVersion": "syn-nodejs-puppeteer-4.0",
"Schedule": {
"DurationInSeconds": "0",
"Expression": "rate(5 minutes)"
},
"RunConfig": {
"EnvironmentVariables": {
"baseUrl": "https://xkcd.com",
"threadCount": "5",
"testSteps": "[{\"name\":\"info\",\"path\":\"/614/info.0.json\",\"jmesPath\":\"safe_title\",\"expectedValue\":\"Woodpecker\"}]"
}
},
"RuntimeVersion": "syn-nodejs-puppeteer-4.0",
"Schedule": {
"DurationInSeconds": "0",
"Expression": "rate(5 minutes)"
},
"StartCanaryAfterCreation": true
}
},
"SyntheticTestSuccessAlarm4480389E": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"ComparisonOperator": "LessThanThreshold",
"EvaluationPeriods": 2,
"Dimensions": [
{
"Name": "CanaryName",
Expand All @@ -250,6 +249,7 @@
}
}
],
"EvaluationPeriods": 2,
"MetricName": "SuccessPercent",
"Namespace": "CloudWatchSynthetics",
"Period": 300,
Expand All @@ -261,7 +261,6 @@
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"ComparisonOperator": "GreaterThanThreshold",
"EvaluationPeriods": 2,
"Dimensions": [
{
"Name": "CanaryName",
Expand All @@ -270,6 +269,7 @@
}
}
],
"EvaluationPeriods": 2,
"MetricName": "Duration",
"Namespace": "CloudWatchSynthetics",
"Period": 300,
Expand Down
Loading

0 comments on commit 3c5b6d9

Please sign in to comment.