-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(integ-runner): Fix call to spawnSync for hooks commands #22429
Changes from 12 commits
a91c3c3
1b798f3
268a3f6
c19f2ff
1661e8f
a0d433f
f71d813
8c44451
049852a
2021e09
85c88b3
4f5e259
b15c9a8
24f7ba8
b015106
3fcd260
952b8a9
937e43d
c5ed430
a899f7f
91f6884
5c93451
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,8 @@ | |
"compat": "cdk-compat", | ||
"rosetta:extract": "yarn --silent jsii-rosetta extract", | ||
"build+extract": "yarn build && yarn rosetta:extract", | ||
"build+test+extract": "yarn build+test && yarn rosetta:extract" | ||
"build+test+extract": "yarn build+test && yarn rosetta:extract", | ||
"integ": "integ-runner" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't needed in this package. |
||
}, | ||
"author": { | ||
"name": "Amazon Web Services", | ||
|
@@ -65,6 +66,7 @@ | |
"@aws-cdk/cdk-build-tools": "0.0.0", | ||
"@aws-cdk/cx-api": "0.0.0", | ||
"@aws-cdk/pkglint": "0.0.0", | ||
"@aws-cdk/integ-runner": "0.0.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nor this. |
||
"@types/fs-extra": "^8.1.2", | ||
"@types/jest": "^27.5.2", | ||
"@types/node": "^14.18.32", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"version": "21.0.0", | ||
"files": { | ||
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { | ||
"source": { | ||
"path": "IntegDefaultTestDeployAssert4E6713E1.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-current_region": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", | ||
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"21.0.0"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": "21.0.0", | ||
"testCases": { | ||
"Integ/DefaultTest": { | ||
"stacks": [ | ||
"Default" | ||
], | ||
"assertionStack": "Integ/DefaultTest/DeployAssert", | ||
"assertionStackName": "IntegDefaultTestDeployAssert4E6713E1", | ||
"hooks": { | ||
"preDeploy": ["echo \"preDeploy\""], | ||
"postDeploy": ["echo \"postDeploy\""], | ||
"preDestroy": ["echo \"preDestroy\""], | ||
"postDestroy": ["echo \"postDestroy\""] | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"version": "21.0.0", | ||
"artifacts": { | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
} | ||
}, | ||
"IntegDefaultTestDeployAssert4E6713E1.assets": { | ||
"type": "cdk:asset-manifest", | ||
"properties": { | ||
"file": "IntegDefaultTestDeployAssert4E6713E1.assets.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"IntegDefaultTestDeployAssert4E6713E1": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "IntegDefaultTestDeployAssert4E6713E1.template.json", | ||
"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}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", | ||
"requiresBootstrapStackVersion": 6, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", | ||
"additionalDependencies": [ | ||
"IntegDefaultTestDeployAssert4E6713E1.assets" | ||
], | ||
"lookupRole": { | ||
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", | ||
"requiresBootstrapStackVersion": 8, | ||
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" | ||
} | ||
}, | ||
"dependencies": [ | ||
"IntegDefaultTestDeployAssert4E6713E1.assets" | ||
], | ||
"metadata": { | ||
"/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "BootstrapVersion" | ||
} | ||
], | ||
"/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CheckBootstrapVersion" | ||
} | ||
] | ||
}, | ||
"displayName": "Integ/DefaultTest/DeployAssert" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"version": "tree-0.1", | ||
"tree": { | ||
"id": "App", | ||
"path": "", | ||
"children": { | ||
"Tree": { | ||
"id": "Tree", | ||
"path": "Tree", | ||
"constructInfo": { | ||
"fqn": "constructs.Construct", | ||
"version": "10.1.102" | ||
} | ||
}, | ||
"Integ": { | ||
"id": "Integ", | ||
"path": "Integ", | ||
"children": { | ||
"DefaultTest": { | ||
"id": "DefaultTest", | ||
"path": "Integ/DefaultTest", | ||
"children": { | ||
"Default": { | ||
"id": "Default", | ||
"path": "Integ/DefaultTest/Default", | ||
"constructInfo": { | ||
"fqn": "constructs.Construct", | ||
"version": "10.1.102" | ||
} | ||
}, | ||
"DeployAssert": { | ||
"id": "DeployAssert", | ||
"path": "Integ/DefaultTest/DeployAssert", | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.Stack", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/integ-tests.IntegTestCase", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/integ-tests.IntegTest", | ||
"version": "0.0.0" | ||
} | ||
} | ||
}, | ||
"constructInfo": { | ||
"fqn": "@aws-cdk/core.App", | ||
"version": "0.0.0" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { App, Stack } from '@aws-cdk/core'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't testing anything. Why is this here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @TheRealAmazonKendra, I can actually remove this I added it to avoid the linter issue saying PR must have at least one integration test update. But integ-runner doesn't have its own integration tests that's why I added this small test. And with this test |
||
import { IntegTest } from '../lib'; | ||
|
||
const app = new App(); | ||
const stack = new Stack(); | ||
|
||
new IntegTest(app, 'Integ', { testCases: [stack] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
return chunks
instead?For example if I had
I would want it to return
['npx', 'cdk', 'deploy']
right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@corymhall, thank you for the comment, for the command you mentioned it could be like that. But for example for the command
echo "preDeploy hook"
if we just split it by space it will result in['echo', '"preDeploy', 'hook"']
which seems to be not the correct input forexec
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do something like this instead in order to keep quoted sections together.
I think if you use arguments with spawnSync each argument to the command needs to be its own element in the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, make sense, I updated the solution. Thank you again for the review.