step

package
v0.27.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// CreatePostgresTable represents a query to create the Postgres steps table.
	CreatePostgresTable = `` /* 527-byte string literal not displayed */

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

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine added in v0.27.0

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

Engine represents the step functionality that implements the StepInterface interface.

func New

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

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

func (*Engine) CleanSteps added in v0.27.0

func (e *Engine) CleanSteps(ctx context.Context, msg string, before int64) (int64, error)

CleanSteps updates steps to an error with a created timestamp prior to a defined moment.

func (*Engine) CountSteps added in v0.27.0

func (e *Engine) CountSteps(ctx context.Context) (int64, error)

CountSteps gets the count of all steps from the database.

func (*Engine) CountStepsForBuild added in v0.27.0

func (e *Engine) CountStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}) (int64, error)

CountStepsForBuild gets the count of steps by build ID from the database.

func (*Engine) CreateStep added in v0.27.0

func (e *Engine) CreateStep(ctx context.Context, s *api.Step) (*api.Step, error)

CreateStep creates a new step in the database.

func (*Engine) CreateStepTable added in v0.27.0

func (e *Engine) CreateStepTable(ctx context.Context, driver string) error

CreateStepTable creates the steps table in the database.

func (*Engine) DeleteStep added in v0.27.0

func (e *Engine) DeleteStep(ctx context.Context, s *api.Step) error

DeleteStep deletes an existing step from the database.

func (*Engine) GetStep added in v0.27.0

func (e *Engine) GetStep(ctx context.Context, id int64) (*api.Step, error)

GetStep gets a step by ID from the database.

func (*Engine) GetStepForBuild added in v0.27.0

func (e *Engine) GetStepForBuild(ctx context.Context, b *api.Build, number int32) (*api.Step, error)

GetStepForBuild gets a step by number and build ID from the database.

func (*Engine) ListStepImageCount added in v0.27.0

func (e *Engine) ListStepImageCount(ctx context.Context) (map[string]float64, error)

ListStepImageCount gets a list of all step images and the count of their occurrence from the database.

func (*Engine) ListStepStatusCount added in v0.27.0

func (e *Engine) ListStepStatusCount(ctx context.Context) (map[string]float64, error)

ListStepStatusCount gets a list of all step statuses and the count of their occurrence from the database.

func (*Engine) ListSteps added in v0.27.0

func (e *Engine) ListSteps(ctx context.Context) ([]*api.Step, error)

ListSteps gets a list of all steps from the database.

func (*Engine) ListStepsForBuild added in v0.27.0

func (e *Engine) ListStepsForBuild(ctx context.Context, b *api.Build, filters map[string]interface{}, page int, perPage int) ([]*api.Step, error)

ListStepsForBuild gets a list of all steps from the database.

func (*Engine) UpdateStep added in v0.27.0

func (e *Engine) UpdateStep(ctx context.Context, s *api.Step) (*api.Step, error)

UpdateStep updates an existing step in the database.

type EngineOpt

type EngineOpt func(*Engine) error

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

func WithClient

func WithClient(client *gorm.DB) EngineOpt

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

func WithContext added in v0.23.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for Steps.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

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

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

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

type StepInterface added in v0.20.0

type StepInterface interface {

	// CreateStepTable defines a function that creates the steps table.
	CreateStepTable(context.Context, string) error

	// CleanSteps defines a function that sets running or pending steps to error status before a given created time.
	CleanSteps(context.Context, string, int64) (int64, error)
	// CountSteps defines a function that gets the count of all steps.
	CountSteps(context.Context) (int64, error)
	// CountStepsForBuild defines a function that gets the count of steps by build ID.
	CountStepsForBuild(context.Context, *api.Build, map[string]interface{}) (int64, error)
	// CreateStep defines a function that creates a new step.
	CreateStep(context.Context, *api.Step) (*api.Step, error)
	// DeleteStep defines a function that deletes an existing step.
	DeleteStep(context.Context, *api.Step) error
	// GetStep defines a function that gets a step by ID.
	GetStep(context.Context, int64) (*api.Step, error)
	// GetStepForBuild defines a function that gets a step by number and build ID.
	GetStepForBuild(context.Context, *api.Build, int32) (*api.Step, error)
	// ListSteps defines a function that gets a list of all steps.
	ListSteps(ctx context.Context) ([]*api.Step, error)
	// ListStepsForBuild defines a function that gets a list of steps by build ID.
	ListStepsForBuild(context.Context, *api.Build, map[string]interface{}, int, int) ([]*api.Step, error)
	// ListStepImageCount defines a function that gets a list of all step images and the count of their occurrence.
	ListStepImageCount(context.Context) (map[string]float64, error)
	// ListStepStatusCount defines a function that gets a list of all step statuses and the count of their occurrence.
	ListStepStatusCount(context.Context) (map[string]float64, error)
	// UpdateStep defines a function that updates an existing step.
	UpdateStep(context.Context, *api.Step) (*api.Step, error)
}

Jump to

Keyboard shortcuts

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