diff --git a/container.go b/container.go index d426789a..ec28b71a 100644 --- a/container.go +++ b/container.go @@ -8,15 +8,12 @@ import ( // Container represents a container created by a ContainerRuntime. 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 diff --git a/forgeactions/doc.go b/forgeactions/doc.go index 71c607a3..4a46a252 100644 --- a/forgeactions/doc.go +++ b/forgeactions/doc.go @@ -1,4 +1,4 @@ // package forgeactions utilizes types and functionality specific to // GitHub Actions to create types and functionality specific to Forge -// to enable the execution of a GitHub Action. +// to enable the execution of GitHub Actions. package forgeactions diff --git a/forgeazure/doc.go b/forgeazure/doc.go index 23fad9b9..1877cc7e 100644 --- a/forgeazure/doc.go +++ b/forgeazure/doc.go @@ -1,4 +1,4 @@ // package forgeazure utilizes types and functionality specific to // Azure DevOps to create types and functionality specific to Forge -// to enable the execution of a Azure Devops Task. +// to enable the execution of Azure Devops Tasks. package forgeazure diff --git a/forgecloudbuild/doc.go b/forgecloudbuild/doc.go index 73404f50..cc5da9e8 100644 --- a/forgecloudbuild/doc.go +++ b/forgecloudbuild/doc.go @@ -1,4 +1,4 @@ // package forgecloudbuild utilizes types and functionality specific to // Google CloudBuild to create types and functionality specific to Forge -// to enable the execution of a Google CloudBuild Step. +// to enable the execution of Google CloudBuild Steps. package forgecloudbuild diff --git a/forgeconcourse/doc.go b/forgeconcourse/doc.go index 78a1d09f..2e2586f4 100644 --- a/forgeconcourse/doc.go +++ b/forgeconcourse/doc.go @@ -1,4 +1,4 @@ // package forgeconcourse utilizes types specific to Concourse // to create types and functionality specific to Forge to enable -// the execution of a Concourse Resource. +// the execution of Concourse Resources. package forgeconcourse diff --git a/githubactions/uses.go b/githubactions/uses.go index ec3b2048..f64121f3 100644 --- a/githubactions/uses.go +++ b/githubactions/uses.go @@ -17,10 +17,13 @@ type Uses struct { Version string } +// IsLocal returns if the Uses refers to an Action on the local filesystem. func (u *Uses) IsLocal() bool { + // A GitHub org cannot start with ".", so this correctly identifies if the path is "." or "./path/to/action". return strings.HasPrefix(u.Path, ".") || filepath.IsAbs(u.Path) || len(strings.Split(u.Path, "/")) < 2 } +// IsRemote returns if the Uses refers to an Action in a GitHub repository. func (u *Uses) IsRemote() bool { return !u.IsLocal() } diff --git a/runtime/docker/container_runtime.go b/runtime/docker/container_runtime.go index a25caf93..471c7531 100644 --- a/runtime/docker/container_runtime.go +++ b/runtime/docker/container_runtime.go @@ -6,8 +6,13 @@ func New(c *client.Client, dind bool) *ContainerRuntime { return &ContainerRuntime{c, dind} } +// ContainerRuntime implements github.com/frantjc/forge.ContainerRuntime. type ContainerRuntime struct { + // Client interacts with a Docker daemon. *client.Client + // DockerInDocker signals whether or not to mount the docker.sock of the + // *github.com/docker/docker/client.Client and configuration to direct + // `docker` to it into each container that it runs. DockerInDocker bool } diff --git a/streams.go b/streams.go index 057ead98..b57c5534 100644 --- a/streams.go +++ b/streams.go @@ -10,7 +10,7 @@ import ( // DefaultDetachKeys are the default key combinations // to use when detaching from a Container that has // been attached to. -var DefaultDetachKeys = "ctrl-d" +const DefaultDetachKeys = "ctrl-d" // Streams represents streams to and from a process // inside of a Container.