Documentation ¶
Index ¶
- func BuildCommand() cli.Command
- func RunCommand() cli.Command
- type Artifacts
- type BuildSpec
- type CodeBuild
- func (cb *CodeBuild) CreateContainer(cfg RunConfiguration) (container.ContainerCreateCreatedBody, error)
- func (cb *CodeBuild) DryRun(cfg RunConfiguration)
- func (cb *CodeBuild) EnvVariables(customVariables []string) []string
- func (cb *CodeBuild) NewDefaultVariables() DefaultVariables
- func (cb *CodeBuild) PhaseToStage(p Phase, name string)
- func (cb *CodeBuild) PhasesAsStages()
- func (cb *CodeBuild) RunInContainer(cfg RunConfiguration) error
- func (cb *CodeBuild) SaveScript(location string) error
- func (cb *CodeBuild) StagesAsScript(baseDir, scriptFile string) error
- func (cb *CodeBuild) Validate(cfg RunConfiguration) error
- func (cb *CodeBuild) Volumes(customVolumes []string) ([]string, error)
- func (cb *CodeBuild) WorkingDirectory(customWorkDir string) string
- type DefaultVariables
- type Env
- type Phase
- type Phases
- type RunConfiguration
- type ShellScript
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCommand ¶ added in v0.4.0
BuildCommand registers a cli.Command
Types ¶
type Artifacts ¶
type Artifacts struct { Files interface{} `json:"files"` DiscardPaths string `json:"discard-paths"` // default=yes BaseDirectory string `json:"base-directory"` }
Artifacts describes contents specified in top-root `artifacts` key of the `buildspec.yml` file.
type BuildSpec ¶
type BuildSpec struct { Version string `json:"version"` Env Env `json:"env"` Phases Phases `json:"phases"` Artifacts Artifacts `json:"artifacts"` }
BuildSpec defines top-root contents of `buildspec.yml` file.
See: - https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
func ParseBuildSpec ¶
ParseBuildSpec unmarshals contents of the `buildspec.yml` file to the newly- created BuildSpec struct.
type CodeBuild ¶
type CodeBuild struct { Definition BuildSpec Project cloudformation.AWSCodeBuildProject Pipeline *ci.Pipeline Script *ShellScript }
CodeBuild mimics AWS CodeBuild runtime for the localcb
func NewCodeBuild ¶
func NewCodeBuild(project cloudformation.AWSCodeBuildProject) (*CodeBuild, error)
NewCodeBuild creates new CodeBuild pipeline runtime
func (*CodeBuild) CreateContainer ¶
func (cb *CodeBuild) CreateContainer(cfg RunConfiguration) (container.ContainerCreateCreatedBody, error)
CreateContainer creates a Docker container with given configuration
func (*CodeBuild) DryRun ¶ added in v0.5.0
func (cb *CodeBuild) DryRun(cfg RunConfiguration)
func (*CodeBuild) EnvVariables ¶
EnvVariables binds all variables to one common []string slice which can be further passed to the Docker client.
func (*CodeBuild) NewDefaultVariables ¶
func (cb *CodeBuild) NewDefaultVariables() DefaultVariables
NewDefaultVariables parses all variables provided by default by the CodeBuild and returns them formatted for the Docker client. See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
func (*CodeBuild) PhaseToStage ¶
PhaseToStage parses codebuild.Phase as a ci.Stage
func (*CodeBuild) PhasesAsStages ¶
func (cb *CodeBuild) PhasesAsStages()
PhasesAsStages converts all codebuild.Phases to ci.Stages
func (*CodeBuild) RunInContainer ¶
func (cb *CodeBuild) RunInContainer(cfg RunConfiguration) error
RunInContainer starts Docker container and executes localcb.sh shell script
func (*CodeBuild) SaveScript ¶
SaveScript creates script (i.e. shell) file on host, which can be futher used by the localcb during the runtime.
func (*CodeBuild) StagesAsScript ¶
StagesAsScript saves a localcb.sh shell script into given basedir
func (*CodeBuild) Validate ¶
func (cb *CodeBuild) Validate(cfg RunConfiguration) error
func (*CodeBuild) WorkingDirectory ¶
WorkingDirectory returns working directory for the Docker client
type DefaultVariables ¶
type DefaultVariables struct { AwsDefaultRegion string `env:"AWS_DEFAULT_REGION"` AwsRegion string `env:"AWS_REGION"` CodeBuildBuildArn string `env:"CODEBUILD_BUILD_ARN"` CodeBuildBuildID string `env:"CODEBUILD_BUILD_ID"` CodeBuildBuildImage string `env:"CODEBUILD_BUILD_IMAGE"` CodeBuildBuildSucceeding string `env:"CODEBUILD_BUILD_SUCCEEDING"` CodeBuildInitiator string `env:"CODEBUILD_INITIATOR"` CodeBuildKMSKeyID string `env:"CODEBUILD_KMS_KEY_ID"` CodeBuildResolvedSourceVersion string `env:"CODEBUILD_RESOLVED_SOURCE_VERSION"` CodeBuildSourceRepoURL string `env:"CODEBUILD_SOURCE_REPO_URL"` CodeBuildSourceVersion string `env:"CODEBUILD_SOURCE_VERSION"` CodeBuildSrcDir string `env:"CODEBUILD_SRC_DIR"` Home string `env:"HOME"` }
DefaultVariables contains default variables provided by the CodeBuild See: https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
func (DefaultVariables) KeyValues ¶
func (dv DefaultVariables) KeyValues() []string
KeyValues returns a list of environment variables for the Docker client in key=value format.
type Phase ¶
type Phase struct {
Commands []string `json:"commands"`
}
Phase provides command list which will be run during the build.
type Phases ¶
type Phases struct { Install Phase `json:"install"` PreBuild Phase `json:"pre_build"` Build Phase `json:"build"` PostBuild Phase `json:"post_build"` }
Phases describes contents specified in top-root `phases` key of the `buildspec.yml` file.
type RunConfiguration ¶
type ShellScript ¶
ShellScript transforms CodeBuild definition file to localcb.sh shell script
func NewShellScript ¶
func NewShellScript() *ShellScript
NewShellScript creates new ShellScript with a brand new buffer
func (*ShellScript) ExtractStage ¶
func (sr *ShellScript) ExtractStage(stage *ci.Stage) error