Documentation
¶
Overview ¶
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Flags = []cli.Flag{ &cli.StringFlag{ Name: "cache.driver", Usage: "driver to be used for the cache", Sources: cli.NewValueSourceChain( cli.EnvVar("VELA_CACHE_DRIVER"), cli.EnvVar("CACHE_DRIVER"), cli.File("/vela/cache/driver"), ), Required: true, }, &cli.StringFlag{ Name: "cache.addr", Usage: "fully qualified url (<scheme>://<host>) for the cache", Sources: cli.NewValueSourceChain( cli.EnvVar("VELA_CACHE_ADDR"), cli.EnvVar("CACHE_ADDR"), cli.File("/vela/cache/addr"), ), Action: func(_ context.Context, _ *cli.Command, v string) error { if !strings.Contains(v, "://") { return fmt.Errorf("cache address must be fully qualified (<scheme>://<host>)") } if strings.HasSuffix(v, "/") { return fmt.Errorf("cache address must not have trailing slash") } return nil }, }, &cli.BoolFlag{ Name: "cache.cluster", Usage: "enables connecting to a cache cluster", Sources: cli.NewValueSourceChain( cli.EnvVar("VELA_CACHE_CLUSTER"), cli.EnvVar("CACHE_CLUSTER"), cli.File("/vela/cache/cluster"), ), }, &cli.StringFlag{ Name: "cache.install-token-key", Usage: "set cache install token key", Sources: cli.NewValueSourceChain( cli.EnvVar("VELA_CACHE_INSTALL_TOKEN_KEY"), cli.EnvVar("CACHE_INSTALL_TOKEN_KEY"), cli.File("/vela/cache/install_token_key"), ), Required: true, }, }
Flags represents all supported command line interface (CLI) flags for the queue.
Functions ¶
func WithGinContext ¶
WithGinContext inserts the cache Service into the gin.Context.
Types ¶
type Service ¶
type Service interface {
// Driver defines a function that outputs
// the configured queue driver.
Driver() string
StoreInstallToken(ctx context.Context, token *models.InstallToken, timeout int32) error
GetInstallToken(ctx context.Context, token string) (*models.InstallToken, error)
EvictInstallToken(ctx context.Context, token string) error
StoreCheckRuns(ctx context.Context, buildID int64, checkRuns []models.CheckRun, repo *api.Repo) error
StoreStepCheckRuns(ctx context.Context, stepID int64, checkRuns []models.CheckRun, repo *api.Repo) error
GetCheckRuns(ctx context.Context, build *api.Build) ([]models.CheckRun, error)
GetStepCheckRuns(ctx context.Context, step *api.Step) ([]models.CheckRun, error)
}
Service represents the interface for Vela integrating with the different supported Queue backends.
func FromCLICommand ¶
FromCLICommand helper function to setup the queue from the CLI arguments.
func FromContext ¶
FromContext retrieves the cache Service from the context.Context.
func FromGinContext ¶
FromGinContext retrieves the cache Service from the gin.Context.
type Setup ¶
type Setup struct {
// specifies the driver to use for the queue client
Driver string
// specifies the address to use for the queue client
Address string
// enables the queue client to integrate with a queue cluster
Cluster bool
InstallTokenKey string
}
Setup represents the configuration necessary for creating a Vela service capable of integrating with a configured queue environment.
Click to show internal directories.
Click to hide internal directories.