-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Binary provisioning/use loadsource #4811
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: master
Are you sure you want to change the base?
Conversation
e6edf2e
to
9066d48
Compare
internal/cmd/launcher.go
Outdated
@@ -277,37 +276,37 @@ func extractToken(gs *state.GlobalState) (string, error) { | |||
// Presently, only the k6 input script or archive (if any) is passed to k6deps for scanning. | |||
// TODO: if k6 receives the input from stdin, it is not used for scanning because we don't know | |||
// if it is a script or an archive | |||
func analyze(gs *state.GlobalState, args []string) (k6deps.Dependencies, error) { | |||
func analyze(gs *state.GlobalState, _ *cobra.Command, args []string) (k6deps.Dependencies, error) { |
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.
func analyze(gs *state.GlobalState, _ *cobra.Command, args []string) (k6deps.Dependencies, error) { | |
func analyze(gs *state.GlobalState, args []string) (k6deps.Dependencies, error) { |
I don't like the fact we are passing Cobra primitives around. Is it really required to have this dependency? Can we break it in Go/k6 primitives and more scoped for the function?
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'm not sure what the problem is with using Cobra types, as we are within the execution of a Cobra command. Can you elaborate on what problems you see?
And, I'm not sure what you mean by "break it in Go/k6 primitives". Create abstractions around Cobra?
👀 |
internal/cmd/launcher.go
Outdated
// is we are here, it is possible that the analyze function read the stdin to analyse it | ||
// and restored the content into gs.Stdin, so we pass it to the command |
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 comment needs a re-arrangement.
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.
Not sure what you refer to, but the initial "is" should be "if".
} | ||
|
||
if strings.HasSuffix(scriptname, ".tar") { | ||
dopts.Archive.Name = scriptname | ||
if strings.HasSuffix(sourceRootPath, ".tar") { |
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 facilitate maintenance, I suggest creating a constant for the tar file extension. This could be done in a separate PR though 🙇🏻
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.
LGTM
The base branch was changed.
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
e6e0018
to
0758402
Compare
Signed-off-by: Pablo Chacin <pablochacin@gmail.com>
What?
Use the loadsource function for dependency analysis
Why?
Presently, binary provisioning uses its own logic for loading the input for dependency analysis. This logic has some shortcomings like not handling input for stdin or limiting the processing of scripts with specific extensions.
Checklist
make check
) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)
Depens on #4801
Closes #4727
Closes #4696