-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Provide access to k6 CLI definition #4013
Comments
Personally, I see the value of the CLI definitions being exposed along with another related issue, #4015. However, it extends the k6 API surface, so probably good to hear the thoughts of the @grafana/k6-core. Do you have any concerns/thoughts about that? |
I was part of the initial discussions around this. Added it to the "nice to have" list of things we could include for v1 (or v2's) API surface. I'm rather strongly for it considering it would a positive impact on our ecosystem 🙇♂️ |
Yeah, I concur with both of you - I clearly see the tradeoff between slightly more maintenance work/compromise due to the extended API surface, and also see the benefits. I'd suggest to evaluate such tradeoff, and if we consider it doesn't seem to put us in a risky position, I'd advocate to pushing for it 👍🏻 |
What
I would like the k6 command-line Go cobra CLI commands/subcommands to be publicly exposed. Additionally, I would find it practical if there was a single entry-point to obtain an instance of the k6 cobra CLI via a function call as suggested below.
Why
So that as a developer I do not have to attempt to rely on the command line argument from the shell perspective to be able to call k6 from another program reliably. Currently, launcher programs relying on the k6 binary struggle to properly parse k6 command arguments, and without proper programatically accessible definitions, launchers can't reliably identify available flags, and know which flags need arguments. Furthermore, creating our own definitions, and heuristics, and duplicating them in various projects creates technical debt and maintenance issues down the road.
How
The solution implied is to make k6's subcommand definitions accessible to external programs. This would replace current workarounds with a proper integration path. It would provide a single source of truth for command definitions. I suggest creating a
cobra.Command
factory function for the k6 root command in the public k6 go API.Something like this:
Connected issues
The root cause of the following issues is the lack of k6 subcommand definitions:
The text was updated successfully, but these errors were encountered: