-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Integrate Binary provisioning #4671
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
Changes from 61 commits
3b52a41
cebb21e
6b9282c
09021bf
890fb4b
3cfd619
96ac5d7
4961632
458cfe7
4d40785
3fc4ebb
d0e8faf
92d6012
cb9b3f5
fe0c0d9
d5eae2b
4c111b7
524a232
85fd837
d3de2c0
8fc8641
605679e
5d827da
ecc2186
9df7a32
692508a
4d2f5d7
e1e2148
3cd2e7f
720d031
154481f
4a7c7aa
9baa845
7faf234
f00debc
4054b6e
3fec225
64b99c0
6ebfd7d
9abc0a5
29e78f2
29639c5
69a8530
a6764fe
528f280
bafbabf
1d61bcc
68141c0
9872be4
ca56958
9d3cdaf
2a6f52b
ba9558d
2a5e97b
e182f5a
2c3c934
aa987af
2fea117
dec77b0
e6027d1
bdbba30
b5e77b3
0d1951e
bdfea21
7034e39
eed742e
9968498
143403b
ddb7836
7f3b93d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import ( | |
| "os" | ||
| "os/signal" | ||
| "path/filepath" | ||
| "slices" | ||
| "sync" | ||
|
|
||
| "go.k6.io/k6/lib" | ||
|
|
@@ -102,7 +103,12 @@ func NewGlobalState(ctx context.Context) *GlobalState { | |
|
|
||
| env := BuildEnvMap(os.Environ()) | ||
| defaultFlags := GetDefaultFlags(confDir) | ||
| globalFlags := getFlags(defaultFlags, env) | ||
| globalFlags := getFlags(defaultFlags, env, os.Args) | ||
|
|
||
| logLevel := logrus.InfoLevel | ||
| if globalFlags.Verbose { | ||
| logLevel = logrus.DebugLevel | ||
| } | ||
|
|
||
| logger := &logrus.Logger{ | ||
| Out: stderr, | ||
|
|
@@ -111,7 +117,7 @@ func NewGlobalState(ctx context.Context) *GlobalState { | |
| DisableColors: !stderrTTY || globalFlags.NoColor, | ||
| }, | ||
| Hooks: make(logrus.LevelHooks), | ||
| Level: logrus.InfoLevel, | ||
| Level: logLevel, | ||
| } | ||
|
|
||
| return &GlobalState{ | ||
|
|
@@ -155,6 +161,9 @@ type GlobalFlags struct { | |
| SecretSource []string | ||
| LogFormat string | ||
| Verbose bool | ||
|
|
||
| BinaryProvisioning bool | ||
| BuildServiceURL string | ||
| } | ||
|
|
||
| // GetDefaultFlags returns the default global flags. | ||
|
|
@@ -164,10 +173,11 @@ func GetDefaultFlags(homeDir string) GlobalFlags { | |
| ProfilingEnabled: false, | ||
| ConfigFilePath: filepath.Join(homeDir, "k6", defaultConfigFileName), | ||
| LogOutput: "stderr", | ||
| BuildServiceURL: "https://ingest.k6.io/builder/api/v1", | ||
| } | ||
| } | ||
|
|
||
| func getFlags(defaultFlags GlobalFlags, env map[string]string) GlobalFlags { | ||
| func getFlags(defaultFlags GlobalFlags, env map[string]string, args []string) GlobalFlags { | ||
| result := defaultFlags | ||
|
|
||
| // TODO: add env vars for the rest of the values (after adjusting | ||
|
|
@@ -193,5 +203,17 @@ func getFlags(defaultFlags GlobalFlags, env map[string]string) GlobalFlags { | |
| if _, ok := env["K6_PROFILING_ENABLED"]; ok { | ||
| result.ProfilingEnabled = true | ||
| } | ||
| if env["K6_BINARY_PROVISIONING"] == "true" { | ||
|
||
| result.BinaryProvisioning = true | ||
| } | ||
| if val, ok := env["K6_BUILD_SERVICE_URL"]; ok { | ||
| result.BuildServiceURL = val | ||
| } | ||
|
|
||
| // check if verbose flag is set | ||
| if slices.Contains(args, "-v") || slices.Contains(args, "--verbose") { | ||
| result.Verbose = true | ||
| } | ||
|
Comment on lines
+231
to
+234
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity, are they here just for simplicity or something is blocking us from to move
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My guess is that @olegbespalov tried to minimize the blast radius of this chane set and I keep it. I'm not sure of how
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pablochacin I'll try to directly work on this, I leave it open as a reminder for myself.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pablochacin we don't have the time to address it, we should add an issue to the epic for researching and exploring the alternative solution by using pre-run as you have in the other pull request. Can you open it, plaese? |
||
|
|
||
| return result | ||
| } | ||
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.
Nit; Can we define this as a
const, likedefaultConfigFileName, please? So, this way we have the consts that belong to the default flags together.