internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExitCodeResultSuccess is the exit code for scceeded builds
	ExitCodeResultSuccess = 0
	// ExitCodeResultUnknown is the exit code for builds with unexpected or unknown statuses.
	ExitCodeResultUnknown = 10
	// ExitCodeResultFailure is the exit code for failed builds
	ExitCodeResultFailure = 11
	// ExitCodeResultInternalError is the exit code for builds failed for internal errors
	ExitCodeResultInternalError = 12
	// ExitCodeResultTimeout is the exit code for timed-out builds
	ExitCodeResultTimeout = 13
	// ExitCodeResultCancelled is the exit code for cancelled builds
	ExitCodeResultCancelled = 14
	// ExitCodeUnexpectedError is the exit code for unexpected errors.
	ExitCodeUnexpectedError = 100
	// ExitCodeConfigurationError is the exit code for configuration errors.
	ExitCodeConfigurationError = 101
	// ExitCodeServiceError is the exit code for service errors such as Google Cloud Platform services.
	ExitCodeServiceError = 102
)

Variables

This section is empty.

Functions

func ExitCodeForError

func ExitCodeForError(err error) int

ExitCodeForError returns the exit code appropriate for the passed error.

func ExitCodeForStatus

func ExitCodeForStatus(status string) int

ExitCodeForStatus returns the exit code for the build status.

func NewBuildResultError

func NewBuildResultError(buildID, status string) error

NewBuildResultError create a new BuildResultError

func NewConfigError

func NewConfigError(message string, cause error) error

NewConfigError creates a new ConfigError

func NewServiceError

func NewServiceError(message string, cause error) error

NewServiceError creates a new ConfigError

Types

type Backoff

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

Backoff calculates sleep time for back off

func NewBackoff

func NewBackoff() *Backoff

NewBackoff returns the default backoff configuration

func (*Backoff) Attempt

func (b *Backoff) Attempt() int

Attempt returns the current attempt count.

func (*Backoff) Sleep

func (b *Backoff) Sleep()

Sleep sleeps with backoff algorithm.

type BuildResultError

type BuildResultError struct {
	BuildID string
	Status  string
}

BuildResultError indicates build failures.

func (*BuildResultError) Error

func (err *BuildResultError) Error() string

type CloudBuildSubmit

type CloudBuildSubmit struct {
	Config
	// contains filtered or unexported fields
}

CloudBuildSubmit holds running state of build submission

func (*CloudBuildSubmit) Cancel added in v0.2.0

func (s *CloudBuildSubmit) Cancel() error

Cancel cancels running build

func (*CloudBuildSubmit) Execute

func (s *CloudBuildSubmit) Execute() error

Execute performs the sequence to submit a build to CloudBuild

type Config

type Config struct {
	// SourceDir is the source directory to archive.
	SourceDir string

	// Project is the ID of Google Cloud Project
	Project string

	// GcsSourceStagingDir is the directory on the Google Cloud Storage
	// to upload source archives.
	GcsSourceStagingDir string

	// IgnoreFile is the ignore file to use instead of .gcloudignore
	IgnoreFile string

	// Config is the file to use instead of cloudbuild.yaml
	Config string

	// Substitutions is the key=value expressions to replace keywords in cloudbuild.yaml
	Substitutions []string

	// PollingIntervalMsec is the interval for polling build statuses and logs.
	PollingIntervalMsec int

	// UploadTimeoutMsec is the milliseconds to consider the upload is timed out.
	UploadTimeoutMsec int

	// MaxUploadTryCount is the maximum number to give up uploading source arvhive. 0 is infinite
	MaxUploadTryCount int

	// CloudBuildTimeoutMsec is the millieseconds to consider Cloud Build operations are timed out.
	CloudBuildTimeoutMsec int

	// MaxStartBuildTryCount is the maximum number to give up starting Cloud Build. 0 is infinite
	MaxStartBuildTryCount int

	// MaxGetBuildTryCount is the maximum number to give up to get build informations. 0 is infinite
	MaxGetBuildTryCount int

	// ReadLogTimeoutMsec is the milliseconds to consider fetching logs from Cloud Storage is timed out.
	ReadLogTimeoutMsec int

	// MaxReadLogErrorCount is the maximum number to give up to read logs. 0 is infinite
	MaxReadLogTryCount int
}

Config holds the configuration for cloudbuild

func (*Config) ResolveDefaults

func (c *Config) ResolveDefaults() error

ResolveDefaults fills default values for configurations.

type ConfigError

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

ConfigError indicates error caused for configuration issues.

func (ConfigError) Error

func (e ConfigError) Error() string

func (ConfigError) Format

func (e ConfigError) Format(s fmt.State, v rune)

func (ConfigError) FormatError

func (e ConfigError) FormatError(p xerrors.Printer) error

func (ConfigError) Unwrap

func (e ConfigError) Unwrap() error

type GcsPath

type GcsPath struct {
	// Bucket is the bucket name
	Bucket string
	// Object is the path to the object in the bucket
	Object string
}

GcsPath represents the location of the object on Google Cloud Storage

func ParseGcsURL

func ParseGcsURL(gcsURL string) (*GcsPath, error)

ParseGcsURL parses gs://... URL and returns the bucket name and the object name

func (*GcsPath) String

func (p *GcsPath) String() string

type ServiceError

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

ServiceError indicates error caused for external services like Google Cloud Platform.

func (ServiceError) Error

func (e ServiceError) Error() string

func (ServiceError) Format

func (e ServiceError) Format(s fmt.State, v rune)

func (ServiceError) FormatError

func (e ServiceError) FormatError(p xerrors.Printer) error

func (ServiceError) Unwrap

func (e ServiceError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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