bitbucket

package module
v0.0.0-...-123eda3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2017 License: BSD-3-Clause Imports: 13 Imported by: 0

README

This project provides tooling to compile a bitbucket-pipelines.yml file to an intermediate representation. The intermediate representation is a portable format for executing pipelines using a common runtime.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

Compiler compiles the yaml

func NewCompiler

func NewCompiler(opts ...Option) *Compiler

NewCompiler creates a new Compiler with options.

func (*Compiler) Compile

func (c *Compiler) Compile(conf *Config) *backend.Config

Compile compiles the YAML configuration to the pipeline intermediate representation configuration format.

type Config

type Config struct {
	// Image specifies the Docker image with
	// which we run your builds.
	Image string

	// Clone defines the depth of Git clones
	// for all pipelines.
	Clone struct {
		Depth int
	}

	// Pipeline defines the pipeline configuration
	// which includes a list of all steps for default,
	// tag, and branch-specific execution.
	Pipelines struct {
		Default  Stage
		Tags     map[string]Stage
		Branches map[string]Stage
	}
}

Config defines the pipeline configuration.

func Parse

func Parse(r io.Reader) (*Config, error)

Parse parses the configuration from bytes b.

func ParseBytes

func ParseBytes(b []byte) (*Config, error)

ParseBytes parses the configuration from bytes b.

func ParseFile

func ParseFile(p string) (*Config, error)

ParseFile parses the configuration from path p.

func ParseString

func ParseString(s string) (*Config, error)

ParseString parses the configuration from string s.

func (*Config) Pipeline

func (c *Config) Pipeline(ref, branch string) Stage

Pipeline returns the pipeline stage that best matches the branch and ref. If there is no matching pipeline specific to the branch or tag, the default pipeline is returned.

type Option

type Option func(*Compiler)

Option configures a compiler option.

func WithEnviron

func WithEnviron(env map[string]string) Option

WithEnviron configures the compiler with environment variables added by default to every container in the pipeline.

func WithLocal

func WithLocal(local bool) Option

WithLocal configures the compiler with the local flag. The local flag indicates the pipeline execution is running in a local development environment with a mounted local working directory.

func WithMetadata

func WithMetadata(metadata frontend.Metadata) Option

WithMetadata configutes the compiler with the repostiory, build and system metadata. The metadata is used to remove steps from the compiled pipeline configuration that should be skipped. The metadata is also added to each container as environment variables.

func WithNetrc

func WithNetrc(username, password, machine string) Option

WithNetrc configures the compiler with netrc authentication credentials added by default to every container in the pipeline.

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix configures the compiler with the prefix. The prefix is used to prefix container, volume and network names to avoid collision at runtime.

func WithProxy

func WithProxy(http, https, none string) Option

WithProxy configures the compiler with HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables added by default to every container in the pipeline.

func WithVolumes

func WithVolumes(volumes ...string) Option

WithVolumes configutes the compiler with default volumes that are mounted to each container in the pipeline.

func WithWorkspace

func WithWorkspace(base, path string) Option

WithWorkspace configures the compiler with the workspace base and path. The workspace base is a volume created at runtime and mounted into all containers in the pipeline. The base and path are joined to provide the working directory for all build and plugin steps in the pipeline.

type Stage

type Stage struct {
	Name  string
	Steps []*Step
}

Stage contains a list of steps executed for a specific branch or tag.

func (*Stage) UnmarshalYAML

func (s *Stage) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements custom parsing for the stage section of the yaml to cleanup the structure a bit.

type Step

type Step struct {
	// Image specifies the Docker image with
	// which we run your builds.
	Image string

	// Script contains the list of bash commands
	// that are executed in sequence.
	Script []string
}

Step defines a build execution unit.

Directories

Path Synopsis
cmd
bitbucketc command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL