1
0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2026-10-24 16:59:19 +03:00
Files
runner/act/container/docker/execution_environment.go
Erwan Leboucher 55b6724479 feat(plugin): add experimental gRPC v1alpha plugin backend support (#1500)
Implements an experimental gRPC protocol for plugable backend systems, per https://code.forgejo.org/forgejo/forgejo-actions-feature-requests/issues/107#issuecomment-85284.

---

(Notes from @mfenniak, Forgejo merger):

Implements an experimental gRPC protocol for plugable backend systems, per https://code.forgejo.org/forgejo/forgejo-actions-feature-requests/issues/107#issuecomment-85284.  This allows future development of new job container execution models, such as Firecracker VMs, qEMU VMs, systemd-nspawn containers, Kubernetes pods, etc.

As an v1alpha protocol, the protocol is subject to change with no stability guarantees at the moment.

As an experimental feature, the Forgejo team is not yet willing to fully commit that this feature will be a permanent addition.  We believe it is a good direction, and we believe we can continue to iterate it to a fully supportable and capable feature based upon feedback from ourselves and other users.  But as that feedback is collected and incorporated, we leave open the possibility that we may gain new knowledge and be required to change direction.

---

<!--start release-notes-assistant-->
<!--URL:https://code.forgejo.org/forgejo/runner-->
- features
  - [PR](https://code.forgejo.org/forgejo/runner/pulls/1500): <!--number 1500 --><!--line 0 --><!--description ZmVhdChwbHVnaW4pOiBhZGQgZXhwZXJpbWVudGFsIGdSUEMgdjFhbHBoYSBwbHVnaW4gYmFja2VuZCBzdXBwb3J0-->feat(plugin): add experimental gRPC v1alpha plugin backend support<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1500
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org>
2026-08-16 00:37:20 +00:00

35 lines
1.2 KiB
Go

// Copyright 2026 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
//go:build !WITHOUT_DOCKER && (linux || darwin || windows || freebsd || openbsd)
package docker
import (
actcontainer "code.forgejo.org/forgejo/runner/v13/act/container"
)
// ExecutionEnvironment creates containers against one daemon Endpoint. It is
// the reusable Docker piece the docker and host back-ends share, so container
// creation is the same regardless of which back-end selected the daemon.
type ExecutionEnvironment struct {
ep Endpoint
}
// NewExecutionEnvironment binds an ExecutionEnvironment to a daemon Endpoint.
func NewExecutionEnvironment(ep Endpoint) *ExecutionEnvironment {
return &ExecutionEnvironment{ep: ep}
}
// Endpoint returns the daemon these containers run against.
func (x *ExecutionEnvironment) Endpoint() Endpoint {
return x.ep
}
// NewContainer creates a container against this environment's daemon. The job
// container, service containers, and step containers are all made the same way;
// they differ only in the input, not in how the environment builds them.
func (x *ExecutionEnvironment) NewContainer(input *actcontainer.NewContainerInput) actcontainer.ExecutionsEnvironment {
return NewContainer(x.ep, input)
}