Executor Runtimes#47496
Conversation
…executor-job-specific-tokens # Conflicts: # enterprise/cmd/executor/internal/apiclient/queue/job/client.go # enterprise/cmd/executor/internal/apiclient/queue/job/client_test.go # enterprise/cmd/executor/internal/worker/store/store.go
# Conflicts: # internal/database/permission_sync_jobs.go # mockgen.test.yaml
…executor-job-specific-tokens
|
Pushed these changes to executor-patch-notest/runtime-interface to get an image built without merging to Edit (3/30): Updated GCP dogfood use use image |
| } | ||
|
|
||
| cmd.Env = env | ||
| cmd.Env = append(cmd.Env, env...) |
There was a problem hiding this comment.
does this still unset env vars from the host? We never want os.Environ to spill into this env.
There was a problem hiding this comment.
Yea not sure what my brain was thinking. I changed this back to cmd.Env = env
There was a problem hiding this comment.
Now I remember why. This was allowing me to inject the ENV vars when running the unit test with the tricky cmd.Exec
sanderginn
left a comment
There was a problem hiding this comment.
I really like the patterns you implemented here. Awesome job 👍
Most of my comments are actually questions I have to understand executors better. A few nits otherwise.
| if err != nil { | ||
| return "", err | ||
| } | ||
| cniConfigFile := path.Join(cniConfigDir, "10-sourcegraph-executors.conflist") |
There was a problem hiding this comment.
What's the significance of the 10-?
There was a problem hiding this comment.
Good question 🤔
@eseliger what is the significance of this? (I'll add a comment with the why)
…nterface # Conflicts: # enterprise/cmd/executor/internal/run/util.go # enterprise/cmd/executor/internal/run/validate.go # enterprise/cmd/executor/internal/run/validate_test.go # enterprise/cmd/executor/singlebinary/service.go
|
If there are no more comments, I will merge this tomorrow (one more day of running in dogfood) |
|
All good from me 👍 |
Closes #46175 and #46176.
Note: Most of the new lines are from adding Unit Tests. Over 120 new unit tests were added.
This PR will help position us into a situation where Executors can understand the environment they are deployed to and handle Jobs with that specific environment.
So for example if docker has been configured, the executor will handle all jobs with docker.
In the future, we will add runtimes for Firecracker, K8s, and more.
Changes
commandinto two packagesworker/commandandworker/runnerworker/runtimepackage more easilyRuntimein the executor appJobis processed, the configured runtime is used to execute theJobdockerRuntimestruct to handle "docker" runtimessrcJob.CLIStepsis set, then we fallback to the "legacy" wayNew Issues
Created the following Issue as I was implementing this PR.
Demo
The following is using the native SSBC for testing.
This just shows that,
"Legacy" Flow
Screen.Recording.2023-03-03.at.11.40.51.mov
Runtime flow (docker)
Screen.Recording.2023-03-03.at.11.29.01.mov
Test plan
Added unit tests and did functional testing.