Skip to content
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

Simplify CDK ExtraArg processing with jcommander overrides #1016

Closed

Conversation

AndreKurait
Copy link
Member

@AndreKurait AndreKurait commented Sep 25, 2024

Description

Simplify CDK ExtraArg processing with jcommander overrides.

Now, given two parameters --s3-region us-east-2 --s3-region us-west-2, jcommander will use the latter one.

Fixed places where parameter values which may have spaces weren't wrapped in quotes.

Removed cdk dependency on yargs

Fixed an issue where List arguments would split on , incorrectly e.g. --setHeader name "value1,value2"

Note: There's two use cases missing from this PR. 1. being able to remove/set an argument to null. 2. correct behavior with extraArgs in RFS for arguments placed in the ENV variables

  • Category: Bug Fix
  • Why these changes are required? Currently --setHeader in extraArgs is broken along with special characters in the values.
  • What is the old behavior before changes and new behavior after changes? CaptureProxy could crash on startup with otherwise valid arguments.

Issues Resolved

[List any issues this PR will resolve]

Is this a backport? If so, please add backport PR # and/or commits #

Testing

[Please provide details of testing done: unit testing, integration testing and manual testing]

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.27%. Comparing base (3ec8dcd) to head (f934cb5).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1016      +/-   ##
============================================
+ Coverage     80.20%   80.27%   +0.07%     
- Complexity     2722     2728       +6     
============================================
  Files           365      366       +1     
  Lines         13603    13605       +2     
  Branches        941      941              
============================================
+ Hits          10910    10922      +12     
+ Misses         2118     2108      -10     
  Partials        575      575              
Flag Coverage Δ
gradle-test 78.30% <100.00%> (+0.09%) ⬆️
python-test 89.91% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@gregschohn gregschohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love making command line parsing easier. I don't like doing it at the expense of the UX for users using the command line directly. I use the command line directly many times per day and usually I cannot see all of the args that I pass at once.

@AndreKurait AndreKurait force-pushed the FixSetHeaderExtraArgs branch 2 times, most recently from 207e411 to cb16200 Compare September 26, 2024 18:43
// Extract command prefix
const commandPrefix = baseCommand.substring(0, baseCommand.indexOf('--')).trim();
const baseArgs = baseCommand.substring(baseCommand.indexOf('--'));
export function parseArgsToDict(argString: string | undefined): Record<string, string[]> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using the values now, only the keys (except in the unit tests), but i thought it could be useful to keep this in here in case we use it.

I had originally put it in for the RFS Env Variable stuff, but since we don't support overriding the secretArn, we didn't need to use it

@AndreKurait
Copy link
Member Author

Closing due to error - 2024-09-26 18:55:28,638 -- Report creating failed: {"message":"Token required because branch is protected"}

Tracking in codecov/codecov-action#1580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants