Runners support config files and dynamic config #2201
Merged
+2,918
−2,603
Conversation
|
Nice, makes sense! 👍🏻 |
|
|
| if key == envLogLevel { | ||
| value := pair[idx+1:] | ||
| level := hclog.LevelFromString(value) | ||
| if level == hclog.NoLevel { | ||
| // We warn this | ||
| log.Warn("log level provided in env var is invalid", value) | ||
| } else { | ||
| // We set the log level on the root logger so it | ||
| // affects all runner logs. | ||
| r.logger.SetLevel(level) |
Comment on lines
+182
to
+191
| // If this is a runner, we don't support dynamic values currently. | ||
| if value.Target.Runner != nil { | ||
| if _, ok := value.Value.(*pb.ConfigVar_Static); !ok { | ||
| return status.Errorf(codes.FailedPrecondition, | ||
| "runner-scoped configuration must be static") | ||
| } | ||
| } | ||
|
|
Comment on lines
-105
to
-112
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.




Runner configuration has always supported env vars (using the
-runnerflag onwaypoint config). This PR enhances runners to also support dynamic config and config files, which apps have supported for a couple releases. This brings parity between runner and app config.Implementation Details
Months ago I extracted
internal/appconfigfrom our entrypoint so that the "app config" logic is reusable. We never refactored runners to be built on top of that, so I did that in this PR. The rest mostly comes "for free" from that.I did have to update
internal/appconfigto support detecting unset env vars and to replace unset env vars with their original value. This is important for runners because we run the jobs directly in the same process. We never had to do this before because entrypoints subprocess, so keeping track of unset env vars was unnecessary and so was replacing old values, since if they don't exist anymore, the next subprocess would just pick up the parent process old values.