-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Create setup and initial runtime checkers #9703
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
base: debug-migration
Are you sure you want to change the base?
Conversation
Looks like we have a couple of CI tests that need attention |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## debug-migration #9703 +/- ##
==================================================
Coverage ? 93.27%
==================================================
Files ? 210
Lines ? 16833
Branches ? 0
==================================================
Hits ? 15701
Misses ? 1132
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
``--migrate-v2`` (boolean) | ||
|
||
Enable AWS CLI v2 migration assistance. Prints warnings if the command would face a breaking change after swapping AWS CLI v1 for AWS CLI v2 in the current environment. Prints one warning for each breaking change detected. | ||
|
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.
Thinking about it during review, --migrate-v2
feels a little too "action-y" like we're performing some sort of migration. What do folks think about --v2-debug
or --migration-debug
?
awscli/clidriver.py
Outdated
def _detect_command_migration_breakage(self, parsed_args, remaining, command_table): | ||
if parsed_args.command == 'ecr' and remaining[0] == 'get-login': | ||
MIGRATION_CHECKERS['ecr_get_login'].triggered = True | ||
|
||
|
||
def _print_migration_warnings(self): | ||
migration_warnings = [] | ||
for key, value in MIGRATION_CHECKERS.items(): | ||
if value.triggered: | ||
migration_warnings.append(value.warning_message) | ||
for warning in migration_warnings: | ||
uni_print(f"AWS CLI v2 MIGRATION WARNING: {warning}") | ||
|
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.
I'd rather not build up all of this state in classes and pollute clidriver.py
like this. Could we treat it like to our existing logger.debug
calls?
For this case, can we just move the printing to the call site
aws-cli/awscli/customizations/ecr.py
Lines 69 to 70 in 44f4c6f
def _run_main(self, parsed_args, parsed_globals): | |
ecr_client = create_client_from_parsed_globals( |
with something like
def _run_main(self, parsed_args, parsed_globals):
if parsed_globals.migrate_v2:
uni_print(...) # or maybe a migration_warning_print(...) if we wanted to centralize formatting
ecr_client = create_client_from_parsed_globals( ...
That way we don't need to worry about printing later if an error happened once we passed the call site.
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.
Thought might be tough if there are places we don't have access to parsed_globals
.
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.
To add a bit of context, the ecr get-login may be the only breaking change that occurs within a customization.
Here's the full list of breaking changes that depend only on the arguments entered to the CLI:
- A blob type parameter starts with
file://
(args only, globalargs.py) - A parameter starts with
http://
orhttps://
(args only, globalargs.py) - ecr get-login replaced with ecr get-login-password (args only, you're proposing ecr customization)
- Removed ~20 aliases (args only, globalargs.py)
- Specifying pagination params via
--cli-input-json
(args only, globalargs.py)
4 of them are not tied to any specific customization and just exist on the level of args/values. Do you agree 1-3, and 5 make sense to implement in globalargs.py since all they depend on is the value of the args? I think its a good place because we're implementing a global arg, and we'd have access to all parsed args from this file.
Also, one breaking change doesn't depend on any information at all (all output will pass through default pager), we may also be able to lump that into globalargs.py
. We may be able to lump others into globalargs, such as ones depending on env vars and configs. Are we good with implementing as many of these as we can in globalargs.py
instead of clidriver.py
, because I think that's what I'm leaning towards now.
And with this context in mind, would you still prefer 3 be implemented within the ecr customization? I feel globalargs.py
may be a better place since it only depends on value of the args rather than anything specific to ecr such as ecr client creation, or the command implementation itself, etc., and it would be consistent with a lot of other checks, but still open to take more feedback on this, or any of the other breakages I listed.
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.
Also, for the point on not building up state in a new migrationcheckers class, I can address that in next revision. Rather than the dictionary approach I'll just print from wherever we choose to implement the checks.
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.
Also, for the point about printing later if an error happens, I think I was being overcautious there and we can likely remove the printing from within the exceptions. The only concern is if the error occurs before the migration checkers get printed. And if that occurs, the command won't run anyways, and the error is within somewhere else in CLI that would need to be addressed by the user or us, and would likely even occur in v2 anyways.
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.
- Yeah, fine with shifting over to
globalargs.py
if that's where the majority of them will be - just didn't want to do that here inclidriver.py
if possible. - Not too worried about printing in the error mode, and like printing as we go.
Co-authored-by: Alex Shovlin <[email protected]>
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.