Adding a direct backend option of the self hosted runner #33
Open
Adding a direct backend option of the self hosted runner #33
Conversation
Member
Author
bnavetta
reviewed
Mar 18, 2026
internal/worker/direct.go
Outdated
| // must take precedence over the worker's own WARP_API_KEY). | ||
| cmd := exec.CommandContext(ctx, b.ozPath, params.BaseArgs...) | ||
| cmd.Dir = workspaceDir | ||
| cmd.Env = mergeEnvVars(os.Environ(), envVars) |
Collaborator
There was a problem hiding this comment.
Instead of automatically inheriting env vars, I think it's safer to start with an empty set and use the backend config to opt in specific variables. The worker environment may have sensitive values that individual tasks shouldn't get access to.
We can default to inheriting standard variables like HOME, TMPDIR, and PATH for convenience.
967e674 to
f028895
Compare
f6d01ef to
99cce2b
Compare
f028895 to
19c51d4
Compare
99cce2b to
d0ad4cf
Compare
d0ad4cf to
2fa8273
Compare
bnavetta
approved these changes
Mar 19, 2026
| func (b *DirectBackend) runCommand(ctx context.Context, command, dir string, env []string) error { | ||
| cmd := exec.CommandContext(ctx, "/bin/sh", "-c", command) | ||
| cmd.Dir = dir | ||
| cmd.Env = mergeEnvVars(hostBaseEnv(), env) |
Collaborator
There was a problem hiding this comment.
I think setup/teardown commands should probably inherit the worker env, unlike the agent process - that way, they can decide to pass along certain variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

As a
Directoption for the backend with relevant parameters. This does not actually mount a docker container but allows for users to run the oz-agent in their own way with setup and teardown commands