Documentation
¶
Index ¶
- Constants
- func ExpandFromContext(context map[string]string, value string) string
- type BuilderContext
- type ContextAware
- type ContextAwareFileSystem
- func (r *ContextAwareFileSystem) Chdir(path string) error
- func (r *ContextAwareFileSystem) DoesDirExist(path string) (bool, error)
- func (r *ContextAwareFileSystem) DoesFileExist(path string) (bool, error)
- func (r *ContextAwareFileSystem) Getwd() (string, error)
- func (r *ContextAwareFileSystem) IsDirEmpty(path string) (bool, error)
- func (r *ContextAwareFileSystem) SetContext(context *BuilderContext)
- type DockerCredential
- type EnvVar
- type FileSystem
- type GitReference
- type ImageDependencies
- type ImageReference
- type Request
- type Runner
- type Source
- type SourceTarget
- type Target
Constants ¶
const DockerHubRegistry = "registry.hub.docker.com"
DockerHubRegistry is the docker hub registry
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BuilderContext ¶
type BuilderContext struct {
// contains filtered or unexported fields
}
BuilderContext is the context for Runners
func NewContext ¶
func NewContext(userDefined []EnvVar, systemGenerated []EnvVar) *BuilderContext
NewContext creates a new running context
func (*BuilderContext) Append ¶
func (r *BuilderContext) Append(newlyGenerated []EnvVar) *BuilderContext
Append append environment variables that the commands are run on
func (*BuilderContext) Expand ¶
func (r *BuilderContext) Expand(value string) string
Expand expands an string given the runner's environment
func (*BuilderContext) Export ¶
func (r *BuilderContext) Export() []string
Export the environment variables to child cmd to use
type ContextAware ¶
type ContextAware interface { SetContext(context *BuilderContext) GetContext() *BuilderContext }
ContextAware are any objects that are aware of build contexts
type ContextAwareFileSystem ¶
type ContextAwareFileSystem struct {
// contains filtered or unexported fields
}
ContextAwareFileSystem is a collections of file sysetm operations which will resolves the input with respect to BuilderContext
func NewContextAwareFileSystem ¶
func NewContextAwareFileSystem(context *BuilderContext) *ContextAwareFileSystem
NewContextAwareFileSystem creates a new file system with no context
func (*ContextAwareFileSystem) Chdir ¶
func (r *ContextAwareFileSystem) Chdir(path string) error
Chdir changes current working directory for the runner
func (*ContextAwareFileSystem) DoesDirExist ¶
func (r *ContextAwareFileSystem) DoesDirExist(path string) (bool, error)
DoesDirExist checks if a given directory exists
func (*ContextAwareFileSystem) DoesFileExist ¶
func (r *ContextAwareFileSystem) DoesFileExist(path string) (bool, error)
DoesFileExist checks if a given file exists
func (*ContextAwareFileSystem) Getwd ¶
func (r *ContextAwareFileSystem) Getwd() (string, error)
Getwd gets the current working directory
func (*ContextAwareFileSystem) IsDirEmpty ¶
func (r *ContextAwareFileSystem) IsDirEmpty(path string) (bool, error)
IsDirEmpty checks if given directory is empty
func (*ContextAwareFileSystem) SetContext ¶
func (r *ContextAwareFileSystem) SetContext(context *BuilderContext)
SetContext changes the context that the file system uses
type DockerCredential ¶
DockerCredential denote how to authenticate to a docker registry
type FileSystem ¶
type FileSystem interface { Getwd() (string, error) Chdir(path string) error DoesDirExist(path string) (bool, error) DoesFileExist(path string) (bool, error) IsDirEmpty(path string) (bool, error) }
FileSystem contains a few interfaces that we are using in acr-builder
type GitReference ¶
type GitReference struct {
GitHeadRev string `json:"git-head-revision"`
}
GitReference defines the reference to git source code
type ImageDependencies ¶
type ImageDependencies struct { Image *ImageReference `json:"image"` Runtime *ImageReference `json:"runtime-dependency"` Buildtime []*ImageReference `json:"buildtime-dependency"` Git *GitReference `json:"git,omitempty"` }
ImageDependencies denotes docker image dependencies
func NewImageDependencies ¶
func NewImageDependencies(env *BuilderContext, image string, runtime string, buildtimes []string) (*ImageDependencies, error)
NewImageDependencies creates ImageDependencies with no references registered
type ImageReference ¶
type ImageReference struct { Registry string `json:"registry"` Repository string `json:"repository"` Tag string `json:"tag,omitempty"` Digest string `json:"digest"` // contains filtered or unexported fields }
ImageReference defines the reference to a docker image
func NewImageReference ¶
func NewImageReference(path string) (*ImageReference, error)
NewImageReference parses a path of a image and creates a ImageReference object
func (*ImageReference) String ¶
func (ref *ImageReference) String() string
String method converts the ImageReference to string
type Request ¶
type Request struct { DockerRegistry string DockerCredentials []DockerCredential Targets []SourceTarget }
Request defines a acr-builder build
type Runner ¶
type Runner interface { GetFileSystem() FileSystem SetContext(context *BuilderContext) GetContext() *BuilderContext ExecuteCmd(cmdExe string, cmdArgs []string, reader io.Reader) error QueryCmd(cmdExe string, cmdArgs []string) (string, error) // Note: ExecuteCmdWithObfuscation allow obfuscating sensitive data such as // authentication tokens or passwords not to be shown in logs // However, passing these sensitive data through command lines are not // quite safe anyway because OS would keep command logs // We need to think about the security implications ExecuteCmdWithObfuscation(obfuscate func([]string), cmdExe string, cmdArgs []string) error }
Runner is used to run shell commands
type SourceTarget ¶
SourceTarget defines a source and a set of BuildTargets to run
type Target ¶
type Target interface { // Build task can't be a generic tasks now because it needs to return ImageDependencies // If we use docker events to figure out dependencies, we can make build tasks a generic task Build(runner Runner) error Push(runner Runner) error ScanForDependencies(runner Runner) ([]ImageDependencies, error) Export() []EnvVar }
Target is the build part of SourceTarget