#1057  Job executor to run job on specified VM
Open
cppdude opened 1 year ago

I'm trying to make a switch from Jenkins. I need hypervisor agent(s) to create and destroy new VMs as requested by a pipeline. The VMs spawned are connected as agents dedicated to that pipeline run, as other jobs could contaminate benchmarking and other test results (or even cause a kernel crash, as drivers are being developed). The process goes something like:

"Spawn VMs" (hypervisor agent) -> "Build" (VM agent) -> "Test" (same or different VM agent, only need "Build" done once but "Test" could be several VMs) -> "Destroy VMs" (hypervisor agent)

Maybe it's currently possible with OneDev, but I haven't been able to figure it out. There has to be an executor per VM requested as the agent selection criteria must point to a single VM, and agent selection alone (would presumably use a script?) is not available via the "Jobs" tab in the build spec. You could in theory use the REST API, but the APIs for this in particular are getting all and setting all executors which means a data race could occur in between since it's not atomic like a "Create" API would be.

Robin Shen commented 1 year ago

Thanks for looking into OneDev. So you need a mechanism to spawn new VM per build, and destroys it after build finishes?

cppdude commented 1 year ago

@robin Correct. I have bash scripts to do the work on a hypervisor agent using libvirt, although the exact virtualization platform could vary. GitLab has an example of a "custom executor" for this purpose at https://docs.gitlab.com/runner/executors/custom_examples/libvirt.html, but that doesn't look like enough because it is using a single base VM image when I would like jobs to be able to parameterize which VM images they want to use.

Robin Shen commented 1 year ago

OneDev currently does not have that ability yet. Converting this as a feature request.

Robin Shen changed title 1 year ago
Previous Value Current Value
Autoprovisioning use case
Job executor to run job on specified VM
Robin Shen changed fields 1 year ago
Name Previous Value Current Value
Type
Discussion
New Feature
issue 1 of 1
Type
New Feature
Priority
Normal
Assignee
Issue Votes (0)
Watchers (4)
Reference
onedev/server#1057
Please wait...
Page is in error, reload to recover