build

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 8 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() error
	// CreateBuildTable defines a function that creates the builds table.
	CreateBuildTable(string) error

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