models

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RPCTimestampFromTime

func RPCTimestampFromTime(t time.Time) furanrpc.Timestamp

RPCTimestampFromTime takes a time.Time and returns an RPC timestamp

func TimeFromRPCTimestamp

func TimeFromRPCTimestamp(ts *furanrpc.Timestamp) time.Time

TimeFromRPCTimestamp returns a UTC time.Time for an RPC timestamp

Types

type APIKey

type APIKey struct {
	ID                            uuid.UUID
	Created                       time.Time
	GitHubUser, Name, Description string
	ReadOnly                      bool
}

APIKey models a user-created API key

type Build

type Build struct {
	ID                          uuid.UUID
	Created, Updated, Completed time.Time
	GitHubRepo, GitHubRef       string
	EncryptedGitHubCredential   []byte
	ImageRepos                  []string
	Tags                        []string
	CommitSHATag                bool
	BuildOptions                *BuildOpts
	Request                     *furanrpc.BuildRequest
	Status                      BuildStatus
	Events                      []string
}

func (*Build) CanAddEvent

func (b *Build) CanAddEvent() bool

CanAddEvent indicates whether b is in a state where events can be added

func (*Build) EncryptAndSetGitHubCredential

func (b *Build) EncryptAndSetGitHubCredential(cred []byte, key [32]byte) error

EncryptAndSetGitHubCredential takes a GitHub credential, encrypts it and sets EncryptedGitHubCredential accordingly

func (*Build) EventListenable

func (b *Build) EventListenable() bool

EventListenable indicates where b is in a state where events can be listened for

func (*Build) GetGitHubCredential

func (b *Build) GetGitHubCredential(key [32]byte) (string, error)

GetGitHubCredential returns the decrypted user token using key or error

func (*Build) Running

func (b *Build) Running() bool

type BuildManager

type BuildManager interface {
	Start(ctx context.Context, opts *BuildOpts) error
	Run(ctx context.Context, id uuid.UUID) error
}

BuildManager describes an object that manages builds

type BuildOpts

type BuildOpts struct {
	BuildID                uuid.UUID                `json:"-"`
	ContextPath, CommitSHA string                   `json:"-"` // set by Builder
	RelativeDockerfilePath string                   `json:"relative_dockerfile_path"`
	DockerfileName         string                   `json:"filename"`
	BuildArgs              map[string]string        `json:"build_args"`
	Cache                  *furanrpc.BuildCacheOpts `json:"cache_opts"`
	Resources              *furanrpc.BuildResources `json:"resources"`
}

BuildOpts models all options required to perform a build

type BuildStatus

type BuildStatus int
const (
	// BuildStatusUnknown Invalid or unknown status
	BuildStatusUnknown BuildStatus = iota
	// BuildStatusNotStarted Build has been requested but not started yet
	BuildStatusNotStarted
	// BuildStatusSkipped Build was requested but determined to be unnecessary
	BuildStatusSkipped
	// BuildStatusRunning Build is currently running in a k8s job
	BuildStatusRunning
	// BuildStatusFailure Build failed or internal error
	BuildStatusFailure
	// BuildStatusSuccess Build successfully completed & pushed
	BuildStatusSuccess
	// BuildStatusCancelRequested Build cancellation was requested but build has not yet aborted
	BuildStatusCancelRequested
	// BuildStatusCancelled Build was aborted due to cancellation request
	BuildStatusCancelled
)

func BuildStatusFromState

func BuildStatusFromState(s furanrpc.BuildState) BuildStatus

func (BuildStatus) State

func (bs BuildStatus) State() furanrpc.BuildState

func (BuildStatus) String

func (i BuildStatus) String() string

func (BuildStatus) TerminalState

func (bs BuildStatus) TerminalState() bool

TerminalState returns whether the status is in a final (terminal) state that will not change

type Builder

type Builder interface {
	Build(ctx context.Context, opts *BuildOpts) error
}

Builder describes an image build backend

type CacheFetcher

type CacheFetcher interface {
	// Fetch fetches the build cache for a build and returns a local filesystem
	// path where it was written. Caller is responsible for cleaning up the path when finished.
	Fetch(ctx context.Context, b *Build) (string, error)
	// Save persists the build cache for a build located at path.
	// Caller is responsible for cleaning up the path afterward.
	Save(ctx context.Context, b *Build, path string) error
}

CacheFetcher describes an object that fetches and saves build cache

type CodeFetcher

type CodeFetcher interface {
	GetCommitSHA(ctx context.Context, repo, ref string) (string, error)
	Fetch(ctx context.Context, repo, ref, destinationPath string) error
}

CodeFetcher represents an object capable of fetching code

type Job

type Job interface {
	// Error returns a channel that will contain any errors associated with this Job
	Error() chan error
	// Running returns a channel that signals that the build the Job is executing has been updated to status Running
	// This indicates that the Furan sidecar has started and is executing successfully and will take responsibility for
	// tracking the build status from this point forward
	Running() chan struct{}
	// Logs returns all pod logs associated with the Job
	Logs() (map[string]map[string][]byte, error)
}

Job describes methods on a single abstract build job

type JobRunner

type JobRunner interface {
	Run(build *Build) (Job, error)
}

type TagChecker

type TagChecker interface {
	AllTagsExist(tags []string, repo string) (bool, []string, error)
}

Jump to

Keyboard shortcuts

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