Skip to content

executor: Extract executor from precise-code-intel-executor-vm

Administrator requested to merge ef/extract-executor into main

Created by: efritz

Note: There are actually only 1,405 SLOC in this PR. The rest are test, mocks, and dev plumbing scripts.

This PR extracts generic execution behavior from the precise-code-intel-executor-vm service.

How jobs are executed

If a job specifies a repository name and commit, then a working directory is prepared with a clone of that repo at that commit. Otherwise, it's just an empty directory.

If a job specifies file contents to be inserted into the working directory, it is written on top of any files in the repository. This will be useful for things like campaigns, where a spec file needs to be present on disk.

If the executor is configured to use Firecracker, it will move the FS context into a fresh virtual machine which will be torn down after the job has completed (or failed).

Then, any docker commands are run in sequence, either in the Firecracker VM or on the host.

Lastly, any src- cli commands are run in the working directory.

Things to note

The executor must have a periodic heartbeat to the queue-api, otherwise it will close transactions after a liveness timeout assuming that the executor has just noped off after telling a bunch of lies.

This closes https://github.com/sourcegraph/sourcegraph/issues/14833.

Merge request reports

Loading