Skip to content

Commit 728a6ce

Browse files
authored
chore: require jsii-diff to pass for build (#354)
While there is a low number of issues left, we ignore them to move forward with the new spec. If issues arise for customers, we can come back and investigate them on an individual basis.
1 parent 5d5104f commit 728a6ce

File tree

3 files changed

+45
-119
lines changed

3 files changed

+45
-119
lines changed

.github/workflows/test-aws-cdk-integration.yml

+2-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
11
# AWS::Macie::FindingsFilter - Removed attribute should also be removed in aws-cdk-lib
22
removed:aws-cdk-lib.aws_macie.CfnFindingsFilter.FindingsFilterListItemProperty
33
removed:aws-cdk-lib.aws_macie.CfnFindingsFilter.attrFindingsFilterListItems
4+
changed-type:aws-cdk-lib.aws_apprunner.CfnAutoScalingConfiguration.tags
5+
changed-type:aws-cdk-lib.aws_appstream.CfnAppBlockBuilder.tags
6+
changed-type:aws-cdk-lib.aws_athena.CfnCapacityReservation.tags
7+
changed-type:aws-cdk-lib.aws_cleanrooms.CfnCollaboration.tags
8+
changed-type:aws-cdk-lib.aws_cleanrooms.CfnConfiguredTable.tags
9+
changed-type:aws-cdk-lib.aws_cleanrooms.CfnConfiguredTableAssociation.tags
10+
changed-type:aws-cdk-lib.aws_cleanrooms.CfnMembership.tags
11+
changed-type:aws-cdk-lib.aws_comprehend.CfnDocumentClassifier.tags
12+
changed-type:aws-cdk-lib.aws_connect.CfnPrompt.tags
13+
changed-type:aws-cdk-lib.aws_customerprofiles.CfnCalculatedAttributeDefinition.tags
14+
changed-type:aws-cdk-lib.aws_customerprofiles.CfnEventStream.tags
15+
changed-type:aws-cdk-lib.aws_glue.CfnDataQualityRuleset.tags
16+
removed:aws-cdk-lib.aws_neptune.CfnDBCluster.port
17+
changed-type:aws-cdk-lib.aws_rds.CfnCustomDBEngineVersion.tags
18+
changed-type:aws-cdk-lib.aws_securityhub.CfnAutomationRule.tags
19+
changed-type:aws-cdk-lib.aws_shield.CfnProtection.tags
20+
changed-type:aws-cdk-lib.aws_shield.CfnProtectionGroup.tags
21+
strengthened:aws-cdk-lib.aws_apigateway.CfnMethod.IntegrationProperty
22+
strengthened:aws-cdk-lib.aws_cloudwatch.CfnInsightRuleProps
23+
weakened:aws-cdk-lib.aws_ecs.CfnService.AwsVpcConfigurationProperty
24+
weakened:aws-cdk-lib.aws_ecs.CfnService.LoadBalancerProperty
25+
strengthened:aws-cdk-lib.aws_mediapackage.CfnOriginEndpoint.EncryptionContractConfigurationProperty
26+
strengthened:aws-cdk-lib.aws_mediapackage.CfnPackagingConfiguration.EncryptionContractConfigurationProperty
27+
removed:aws-cdk-lib.aws_neptune.CfnDBClusterProps.port
28+
strengthened:aws-cdk-lib.aws_s3.CfnBucket.EventBridgeConfigurationProperty
29+
removed:aws-cdk-lib.aws_sagemaker.CfnPipeline.PipelineDefinitionProperty.pipelineDefinitionS3Location
30+
strengthened:aws-cdk-lib.aws_sam.CfnFunction.CognitoEventProperty
31+
weakened:aws-cdk-lib.aws_sam.CfnFunction.DeploymentPreferenceProperty
32+
strengthened:aws-cdk-lib.aws_sam.CfnFunction.S3EventProperty

projenrc/aws-cdk-integration-test.ts

+14-79
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as pj from 'projen';
22
import { yarn } from 'cdklabs-projen-project-types';
33
import path from 'path';
4-
import { JobPermission } from 'projen/lib/github/workflows-model';
54

65
export interface AwsCdkIntegrationTestOptions {
76
readonly workflowRunsOn: string[];
@@ -26,8 +25,15 @@ export class AwsCdkIntegrationTest extends pj.Component {
2625
const runsOn = options.workflowRunsOn;
2726
const awsCdkRepo = 'aws/aws-cdk';
2827
const awsCdkPath = 'aws-cdk';
29-
const candidateSpec = 'aws-cdk-lib-candidate';
28+
const candidateSpec = path.join(awsCdkPath, 'packages', 'aws-cdk-lib');
3029
const candidateSpecJobName = 'test-with-new-codegen';
30+
const jsiiDiffIgnore = '.jsiidiffignore';
31+
const diffIgnoreFile = path.join(
32+
root.name,
33+
path.relative(options.serviceSpec.root.outdir, options.serviceSpec.outdir),
34+
jsiiDiffIgnore,
35+
);
36+
options.serviceSpec.addPackageIgnore(jsiiDiffIgnore);
3137

3238
workflow.addJob(candidateSpecJobName, {
3339
runsOn,
@@ -58,50 +64,7 @@ export class AwsCdkIntegrationTest extends pj.Component {
5864
...linkPackage(options.serviceSpecTypes, awsCdkPath),
5965
...useSpec2Cdk(awsCdkPath),
6066
...buildAwsCdkLib(awsCdkRepo, awsCdkPath),
61-
...uploadSpec(candidateSpec, awsCdkPath),
62-
],
63-
});
64-
65-
/**
66-
* @TODO Separate job for now because this it is failing
67-
* Once it passes, this should be merged with the main job above
68-
*/
69-
const jsiiDiffIgnore = '.jsiidiffignore';
70-
const diffIgnoreFile = path.join(
71-
root.name,
72-
path.relative(options.serviceSpec.root.outdir, options.serviceSpec.outdir),
73-
jsiiDiffIgnore,
74-
);
75-
options.serviceSpec.addPackageIgnore(jsiiDiffIgnore);
76-
77-
workflow.addJob('jsii-diff', {
78-
needs: [candidateSpecJobName],
79-
runsOn,
80-
env: {
81-
...awsCdkLibEnv(),
82-
},
83-
permissions: {
84-
contents: JobPermission.READ,
85-
},
86-
steps: [
87-
{
88-
name: `Checkout ${root.name}`,
89-
uses: 'actions/checkout@v3',
90-
with: {
91-
path: root.name,
92-
ref: '${{ github.event.pull_request.head.ref }}',
93-
repository: '${{ github.event.pull_request.head.repo.full_name }}',
94-
},
95-
},
96-
...specFromArtifact(candidateSpec),
97-
{
98-
name: `Install jsii-diff`,
99-
run: 'npm install jsii-diff',
100-
},
101-
{
102-
name: `Compare current and candidate spec`,
103-
run: `npx jsii-diff --verbose --keys --ignore-file=${diffIgnoreFile} --error-on=non-experimental npm:aws-cdk-lib@latest ${candidateSpec}`,
104-
},
67+
...runJsiiDiff(candidateSpec, diffIgnoreFile),
10568
],
10669
});
10770
}
@@ -168,43 +131,15 @@ function buildAwsCdkLib(repository: string, path: string): pj.github.workflows.S
168131
];
169132
}
170133

171-
function uploadSpec(artifactName: string, workingDir: string): pj.github.workflows.Step[] {
134+
function runJsiiDiff(specPath: string, ignoreFilePath: string): pj.github.workflows.Step[] {
172135
return [
173136
{
174-
name: `Prepare artifacts`,
175-
workingDirectory: workingDir,
176-
run: [
177-
`jq 'del(.devDependencies)' packages/aws-cdk-lib/package.json > \${{ runner.temp }}/package.json`,
178-
`cp packages/aws-cdk-lib/.jsii \${{ runner.temp }}/.jsii`,
179-
`cp packages/aws-cdk-lib/.jsii.gz \${{ runner.temp }}/.jsii.gz`,
180-
].join('\n'),
181-
},
182-
{
183-
name: `Upload spec`,
184-
uses: 'actions/upload-artifact@v3',
185-
with: {
186-
name: artifactName,
187-
'if-no-files-found': 'error',
188-
path: ['${{ runner.temp }}/package.json', '${{ runner.temp }}/.jsii', '${{ runner.temp }}/.jsii.gz'].join('\n'),
189-
},
190-
},
191-
];
192-
}
193-
194-
function specFromArtifact(name: string): pj.github.workflows.Step[] {
195-
return [
196-
{
197-
name: `Download ${name}`,
198-
uses: 'actions/download-artifact@v3',
199-
with: {
200-
name: name,
201-
path: name,
202-
},
137+
name: `Install jsii-diff`,
138+
run: 'npm install -g jsii-diff',
203139
},
204140
{
205-
name: `Prepare dependency closure`,
206-
workingDirectory: name,
207-
run: 'npm install',
141+
name: `Compare current and candidate spec`,
142+
run: `npx jsii-diff --verbose --keys --ignore-file=${ignoreFilePath} --error-on=non-experimental npm:aws-cdk-lib@latest ${specPath}`,
208143
},
209144
];
210145
}

0 commit comments

Comments
 (0)