Documentation
¶
Index ¶
- Constants
- Variables
- func AzureDevOpsTaskWorkingDir(workingDir string) string
- func CloudBuildWorkingDir(workingDir string) string
- func ConcourseResourceWorkingDir(workingDir string) string
- func GitHubActionPath(workingDir string) string
- func GitHubEnv(workingDir string) string
- func GitHubOutput(workingDir string) string
- func GitHubPath(workingDir string) string
- func GitHubRunnerTmp(workingDir string) string
- func GitHubRunnerToolCache(workingDir string) string
- func GitHubState(workingDir string) string
- func GitHubWorkspace(workingDir string) string
- func InterceptingDockerSock(workingDir string) string
- type Action
- type CloudBuild
- type Container
- type ContainerConfig
- type ContainerRuntime
- type Hook
- type Image
- type ImageBuilder
- type Mount
- type Pipe
- type Pure
- type Resource
- type RunOpt
- type RunOpts
- type Runnable
- type SleepingShimContainer
- type Streams
- type Task
Constants ¶
const ( DefaultNode10ImageReference = "docker.io/library/node:10" DefaultNode12ImageReference = "docker.io/library/node:12" DefaultNode16ImageReference = "docker.io/library/node:16" DefaultNode20ImageReference = "docker.io/library/node:20" DefaultNodeImageReference = DefaultNode16ImageReference )
const DefaultDetachKeys = "ctrl-d"
DefaultDetachKeys are the default key combinations to use when detaching from a Container that has been attached to.
Variables ¶
var ( ShimName = "shim" ScriptName = "script" )
var ( // ErrContainerExecutedWithNonzeroExitCode is returned when a container // returns an unexpected nonzero exit code. Used with errors.Is to avoid // printing this error's text so that os.Exit doesn't double-inform a user // of the same nonzero exit code. ErrContainerExitedWithNonzeroExitCode = errors.New("container exited with nonzero exit code") // ErrCannotBuildDockerfile will be returned when a forge.ContainerRuntime // does not implement ImageBuilder. ErrCannotBuildDockerfile = errors.New("runtime cannot build Dockerfile") )
var ( Node10ImageReference = DefaultNode10ImageReference Node12ImageReference = DefaultNode12ImageReference Node16ImageReference = DefaultNode16ImageReference Node20ImageReference = DefaultNode20ImageReference NodeImageReference = DefaultNodeImageReference )
var HookContainerStarted = new(Hook[Container])
Functions ¶
func AzureDevOpsTaskWorkingDir ¶ added in v1.0.0
func CloudBuildWorkingDir ¶ added in v1.0.0
func ConcourseResourceWorkingDir ¶ added in v1.0.0
func GitHubActionPath ¶ added in v1.0.0
func GitHubOutput ¶ added in v1.0.0
func GitHubPath ¶ added in v1.0.0
func GitHubRunnerTmp ¶ added in v1.0.0
func GitHubRunnerToolCache ¶ added in v1.0.0
func GitHubState ¶ added in v1.0.0
func GitHubWorkspace ¶ added in v1.0.0
func InterceptingDockerSock ¶ added in v1.0.0
Types ¶
type Action ¶ added in v1.0.0
type Action struct { ID string Uses string With map[string]string Env map[string]string GlobalContext *githubactions.GlobalContext }
type CloudBuild ¶ added in v1.0.0
type CloudBuild struct {
cloudbuild.Step
}
func (*CloudBuild) Run ¶ added in v1.0.0
func (o *CloudBuild) Run(ctx context.Context, containerRuntime ContainerRuntime, opts ...RunOpt) error
type Container ¶
type Container interface { GetID() string CopyTo(context.Context, string, io.Reader) error CopyFrom(context.Context, string) (io.ReadCloser, error) Run(context.Context, *Streams) (int, error) Start(context.Context) error Restart(context.Context) error Exec(context.Context, *ContainerConfig, *Streams) (int, error) Stop(context.Context) error Remove(context.Context) error Kill(context.Context) error }
Container represents a container created by a ContainerRuntime.
type ContainerConfig ¶
type ContainerConfig struct { Entrypoint []string Cmd []string WorkingDir string Env []string User string Privileged bool Mounts []Mount }
ContainerConfig is the configuration that is used to create a container or an exec in a running container.
type ContainerRuntime ¶
type ContainerRuntime interface { GetContainer(context.Context, string) (Container, error) CreateContainer(context.Context, Image, *ContainerConfig) (Container, error) PullImage(context.Context, string) (Image, error) Close() error }
ContainerRuntime represents the functionality needed by Runnables to pull OCI images and run containers when being processed.
type Image ¶
type Image interface { Manifest() (*imagespecsv1.Manifest, error) Config() (*imagespecsv1.ImageConfig, error) Digest() (digest.Digest, error) Blob() io.Reader Name() string }
Image represents a image pulled by a ContainerRuntime. Used to create Containers from.
type ImageBuilder ¶ added in v1.0.0
ImageBuilder is for a ContainerRuntime to implement building a Dockerfile. Because building an OCI image is not ubiquitous, forge.ContainerRuntimes are not required to implement this, but they may. The default runtime (Docker) happens to so as to support GitHub Actions that run using "docker".
type Resource ¶ added in v1.0.0
type RunOpt ¶ added in v1.0.0
type RunOpt interface {
Apply(*RunOpts)
}
func WithStdStreams ¶ added in v1.0.0
func WithStdStreams() RunOpt
func WithStreams ¶ added in v1.0.0
type Runnable ¶ added in v1.0.0
type Runnable interface {
Run(context.Context, ContainerRuntime, ...RunOpt) error
}
type SleepingShimContainer ¶ added in v1.0.0
func (*SleepingShimContainer) Exec ¶ added in v1.0.0
func (c *SleepingShimContainer) Exec(ctx context.Context, cc *ContainerConfig, s *Streams) (int, error)
type Streams ¶
Streams represents streams to and from a process inside of a Container.
func StdStreams ¶
func StdStreams() *Streams
StdStreams returns a Streams consisting of os.Stdin, os.Stdout and os.Stderr.
func StdTerminalStreams ¶
StdTerminalStreams creates a Streams with os.Stdin, os.Stdout and os.Stderr made raw and a restore function to return them to their previous state. For use with attaching to a shell inside of a Container.
func TerminalStreams ¶
TerminalStreams creates a Streams with each of the given streams that is a terminal made raw and a restore function to return them to their previous states. For use with attaching to a shell inside of a Container.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
package cloudbuild contains types compatible with the data structures in Google CloudBuild build config file schema as well as commonly used filepaths and environment variables.
|
package cloudbuild contains types compatible with the data structures in Google CloudBuild build config file schema as well as commonly used filepaths and environment variables. |
cmd
|
|
package command exports functions that return (*github.com/spf13/cobra.Command)s which act as the entrypoint to `forge` and its subcommands.
|
package command exports functions that return (*github.com/spf13/cobra.Command)s which act as the entrypoint to `forge` and its subcommands. |
package concourse contains types compatible with the data structures in Concourse such as its pipeline schema and the inputs and outputs to and from Concourse Resources.
|
package concourse contains types compatible with the data structures in Concourse such as its pipeline schema and the inputs and outputs to and from Concourse Resources. |
package envconv contains functionality for converting between data types commonly used to represent environment variables i.e.
|
package envconv contains functionality for converting between data types commonly used to represent environment variables i.e. |
package githubactions contains types compatible with the data structures in GitHub Actions such as a GitHub Actions Workflow Step; common environment variables; parsing of $GITHUB_PATH files, $GITHUB_ENV files, and GitHub Actions Workflow commands; downloading GitHub Actions, and more.
|
package githubactions contains types compatible with the data structures in GitHub Actions such as a GitHub Actions Workflow Step; common environment variables; parsing of $GITHUB_PATH files, $GITHUB_ENV files, and GitHub Actions Workflow commands; downloading GitHub Actions, and more. |
internal
|
|
package rangemap provides functions to range over a map in an order sorted by its orderable keys.
|
package rangemap provides functions to range over a map in an order sorted by its orderable keys. |
runtime
|
|
docker
package docker provides an implementation of github.com/frantjc/forge.ContainerRuntime by interacting with a Docker daemon via a *github.com/docker/docker/client.Client.
|
package docker provides an implementation of github.com/frantjc/forge.ContainerRuntime by interacting with a Docker daemon via a *github.com/docker/docker/client.Client. |