-
Notifications
You must be signed in to change notification settings - Fork 12
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
refactor(cli): require approval is a part of the CliIoHost #151
Open
kaizencc
wants to merge
15
commits into
main
Choose a base branch
from
conroy/requireapproval
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+193
−44
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
da639aa
start of requireapproval in cliiohost
kaizencc 3451f77
extra file
kaizencc 6d3337c
small changes
kaizencc a6a8d48
Merge branch 'main' into conroy/requireapproval
kaizencc ff1bda3
wip
kaizencc 5b36c5d
small changes
kaizencc 1999502
delete extra file
kaizencc deb751c
tests pass
kaizencc d756eaf
Merge branch 'main' into conroy/requireapproval
kaizencc b127679
tests that dont work
kaizencc cd89490
tests pass
kaizencc 9bf2d21
require approval
kaizencc 8357e52
tests pass now
kaizencc 83be7ef
minor change
kaizencc d7f41b8
Merge branch 'main' into conroy/requireapproval
kaizencc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 10 additions & 12 deletions
22
packages/@aws-cdk/toolkit-lib/lib/actions/diff/private/helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { DescribeChangeSetOutput, fullDiff } from '@aws-cdk/cloudformation-diff'; | ||
import * as cxapi from '@aws-cdk/cx-api'; | ||
import { ToolkitError } from '../../../api/errors'; | ||
import { RequireApproval } from '../../deploy'; | ||
|
||
/** | ||
* Return whether the diff has security-impacting changes that need confirmation | ||
* Return whether the diff has security-impacting changes that need confirmation. | ||
*/ | ||
export function diffRequiresApproval( | ||
export function determinePermissionType( | ||
oldTemplate: any, | ||
newTemplate: cxapi.CloudFormationStackArtifact, | ||
requireApproval: RequireApproval, | ||
changeSet?: DescribeChangeSetOutput, | ||
): boolean { | ||
// @todo return or print the full diff. | ||
): 'non-broadening' | 'broadening' | 'none' { | ||
// @todo return a printable version of the full diff. | ||
const diff = fullDiff(oldTemplate, newTemplate.template, changeSet); | ||
|
||
switch (requireApproval) { | ||
case RequireApproval.NEVER: return false; | ||
case RequireApproval.ANY_CHANGE: return diff.permissionsAnyChanges; | ||
case RequireApproval.BROADENING: return diff.permissionsBroadened; | ||
default: throw new ToolkitError(`Unrecognized approval level: ${requireApproval}`); | ||
if (diff.permissionsBroadened) { | ||
return 'broadening'; | ||
} else if (diff.permissionsAnyChanges) { | ||
return 'non-broadening'; | ||
} else { | ||
return 'none'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this breaks the behavior of the
requireApproval
option but i don't have a good way or hooking it up to therequireApproval
governed by theCliIoHost
--toolkit.ts
only has a concept of anIIoHost