build

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreateCreatedIndex represents a query to create an
	// index on the builds table for the created column.
	CreateCreatedIndex = `
CREATE INDEX
IF NOT EXISTS
builds_created
ON builds (created);
`

	// CreateRepoIDIndex represents a query to create an
	// index on the builds table for the repo_id column.
	CreateRepoIDIndex = `
CREATE INDEX
IF NOT EXISTS
builds_repo_id
ON builds (repo_id);
`

	// CreateSourceIndex represents a query to create an
	// index on the builds table for the source column.
	CreateSourceIndex = `
CREATE INDEX
IF NOT EXISTS
builds_source
ON builds (source);
`

	// CreateStatusIndex represents a query to create an
	// index on the builds table for the status column.
	CreateStatusIndex = `
CREATE INDEX
IF NOT EXISTS
builds_status
ON builds (status);
`
)
View Source
const (
	// CreatePostgresTable represents a query to create the Postgres builds table.
	CreatePostgresTable = `` /* 993-byte string literal not displayed */

	// CreateSqliteTable represents a query to create the Sqlite builds table.
	CreateSqliteTable = `` /* 825-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func New

func New(opts ...EngineOpt) (*engine, error)

New creates and returns a Vela service for integrating with builds in the database.

Types

type BuildInterface

type BuildInterface interface {

	// CreateBuildIndexes defines a function that creates the indexes for the builds table.
	CreateBuildIndexes(context.Context) error
	// CreateBuildTable defines a function that creates the builds table.
	CreateBuildTable(context.Context, string) error

	// CleanBuilds defines a function that sets pending or running builds to error created before a given time.
	CleanBuilds(context.Context, string, int64) (int64, error)
	// CountBuilds defines a function that gets the count of all builds.
	CountBuilds(context.Context) (int64, error)
	// CountBuildsForDeployment defines a function that gets the count of builds by deployment url.
	CountBuildsForDeployment(context.Context, *library.Deployment, map[string]interface{}) (int64, error)
	// CountBuildsForOrg defines a function that gets the count of builds by org name.
	CountBuildsForOrg(context.Context, string, map[string]interface{}) (int64, error)
	// CountBuildsForRepo defines a function that gets the count of builds by repo ID.
	CountBuildsForRepo(context.Context, *library.Repo, map[string]interface{}) (int64, error)
	// CountBuildsForStatus defines a function that gets the count of builds by status.
	CountBuildsForStatus(context.Context, string, map[string]interface{}) (int64, error)
	// CreateBuild defines a function that creates a new build.
	CreateBuild(context.Context, *library.Build) (*library.Build, error)
	// DeleteBuild defines a function that deletes an existing build.
	DeleteBuild(context.Context, *library.Build) error
	// GetBuild defines a function that gets a build by ID.
	GetBuild(context.Context, int64) (*library.Build, error)
	// GetBuildForRepo defines a function that gets a build by repo ID and number.
	GetBuildForRepo(context.Context, *library.Repo, int) (*library.Build, error)
	// LastBuildForRepo defines a function that gets the last build ran by repo ID and branch.
	LastBuildForRepo(context.Context, *library.Repo, string) (*library.Build, error)
	// ListBuilds defines a function that gets a list of all builds.
	ListBuilds(context.Context) ([]*library.Build, error)
	// ListBuildsForDeployment defines a function that gets a list of builds by deployment url.
	ListBuildsForDeployment(context.Context, *library.Deployment, map[string]interface{}, int, int) ([]*library.Build, int64, error)
	// ListBuildsForOrg defines a function that gets a list of builds by org name.
	ListBuildsForOrg(context.Context, string, map[string]interface{}, int, int) ([]*library.Build, int64, error)
	// ListBuildsForRepo defines a function that gets a list of builds by repo ID.
	ListBuildsForRepo(context.Context, *library.Repo, map[string]interface{}, int64, int64, int, int) ([]*library.Build, int64, error)
	// ListPendingAndRunningBuilds defines a function that gets a list of pending and running builds.
	ListPendingAndRunningBuilds(context.Context, string) ([]*library.BuildQueue, error)
	// ListPendingAndRunningBuildsForRepo defines a function that gets a list of pending and running builds for a repo.
	ListPendingAndRunningBuildsForRepo(context.Context, *library.Repo) ([]*library.Build, error)
	// UpdateBuild defines a function that updates an existing build.
	UpdateBuild(context.Context, *library.Build) (*library.Build, error)
}

BuildInterface represents the Vela interface for build functions with the supported Database backends.

type EngineOpt

type EngineOpt func(*engine) error

EngineOpt represents a configuration option to initialize the database engine for Builds.

func WithClient

func WithClient(client *gorm.DB) EngineOpt

WithClient sets the gorm.io/gorm client in the database engine for Builds.

func WithContext added in v0.21.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for Builds.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Builds.

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

WithSkipCreation sets the skip creation logic in the database engine for Builds.

Jump to

Keyboard shortcuts

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