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

refactor: split CLI jp command #5566

Merged
merged 11 commits into from
Dec 21, 2022
Merged

Conversation

eddycharly
Copy link
Member

Signed-off-by: Charles-Edouard Brétéché charles.edouard@nirmata.com

Explanation

This PR refactors the jp command into sub commands:

  • parse parses a jmespath expression and shows the AST
  • function shows functions informations
  • query runs queries against objects

Open questions:

  • shall we support multiple queries in the same command ?

With this change, the query being executed is written in the console output, this can be a problem if the tool is used in automation:

$ echo '{"foo": "BAR"}' | kyverno jp query 'to_lower(foo)'
Reading from terminal input.
Enter input object and hit Ctrl+D.
# to_lower(foo)
"bar"

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Merging #5566 (c3852e4) into main (c6ba1c8) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #5566   +/-   ##
=======================================
  Coverage   34.62%   34.62%           
=======================================
  Files         190      190           
  Lines       21106    21106           
=======================================
  Hits         7307     7307           
  Misses      12986    12986           
  Partials      813      813           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eddycharly eddycharly marked this pull request as ready for review December 16, 2022 15:22
@realshuting
Copy link
Member

shall we support multiple queries in the same command ?

We can start with one query per command IMO.

Copy link
Member

@realshuting realshuting left a comment

Choose a reason for hiding this comment

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

Can you look at sonatype-lift comments?

vyankyGH and others added 3 commits December 19, 2022 16:55
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
@realshuting realshuting enabled auto-merge (squash) December 21, 2022 05:34
@realshuting realshuting merged commit b28c16f into kyverno:main Dec 21, 2022
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Dec 29, 2022
* refactor: split CLI jp command

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix sonatype comments

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Signed-off-by: Md Sahil <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
* refactor: split CLI jp command

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix sonatype comments

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
MdSahil-oss pushed a commit to MdSahil-oss/kyverno that referenced this pull request Jan 11, 2023
* refactor: split CLI jp command

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix sonatype comments

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Signed-off-by: MdSahil-oss <Mohdssahil1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants