prebuilds

package
v2.37.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: AGPL-3.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TemplatePrefix = "scaletest-prebuilds-template-"

TemplatePrefix is the name prefix applied to all templates created by the scaletest prebuilds runner.

Variables

This section is empty.

Functions

func TemplateTarData

func TemplateTarData(numPresets, numPresetPrebuilds int) ([]byte, error)

Types

type Config

type Config struct {
	// OrganizationID is the ID of the organization to create the prebuilds in.
	OrganizationID uuid.UUID `json:"organization_id"`
	// ProvisionerTags are optional tags used to route template version
	// provisioning jobs to specific provisioner daemons.
	ProvisionerTags map[string]string `json:"provisioner_tags"`
	// NumPresets is the number of presets the template should have.
	NumPresets int `json:"num_presets"`
	// NumPresetPrebuilds is the number of prebuilds per preset.
	// Total prebuilds = NumPresets * NumPresetPrebuilds
	NumPresetPrebuilds int `json:"num_preset_prebuilds"`

	// TemplateVersionJobTimeout is how long to wait for template version
	// provisioning jobs to complete.
	TemplateVersionJobTimeout time.Duration `json:"template_version_job_timeout"`

	// PrebuildWorkspaceTimeout is how long to wait for all prebuild
	// workspaces to be created and completed.
	PrebuildWorkspaceTimeout time.Duration `json:"prebuild_workspace_timeout"`

	Metrics *Metrics `json:"-"`

	// SetupBarrier is used to ensure all templates have been created
	// before unpausing prebuilds.
	SetupBarrier *sync.WaitGroup `json:"-"`

	// CreationBarrier is used to ensure all prebuild creation has completed
	// before pausing prebuilds for deletion.
	CreationBarrier *sync.WaitGroup `json:"-"`

	// DeletionSetupBarrier is used by the runner owner (CLI/test) to signal when
	// prebuilds have been paused, allowing runners to create new template versions
	// with 0 prebuilds. Only the owner calls Done(), runners only Wait().
	DeletionSetupBarrier *sync.WaitGroup `json:"-"`

	// DeletionBarrier is used to ensure all templates have been updated
	// with 0 prebuilds before resuming prebuilds.
	DeletionBarrier *sync.WaitGroup `json:"-"`

	Clock quartz.Clock `json:"-"`
}

func (Config) Validate

func (c Config) Validate() error

type Metrics

type Metrics struct {
	PrebuildJobsCreated   prometheus.GaugeVec
	PrebuildJobsRunning   prometheus.GaugeVec
	PrebuildJobsFailed    prometheus.GaugeVec
	PrebuildJobsCompleted prometheus.GaugeVec

	PrebuildDeletionJobsCreated   prometheus.GaugeVec
	PrebuildDeletionJobsRunning   prometheus.GaugeVec
	PrebuildDeletionJobsFailed    prometheus.GaugeVec
	PrebuildDeletionJobsCompleted prometheus.GaugeVec

	PrebuildErrorsTotal prometheus.CounterVec
}

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *Metrics

func (*Metrics) AddError

func (m *Metrics) AddError(templateName string, action string)

func (*Metrics) SetDeletionJobsCompleted

func (m *Metrics) SetDeletionJobsCompleted(count int, templateName string)

func (*Metrics) SetDeletionJobsCreated

func (m *Metrics) SetDeletionJobsCreated(count int, templateName string)

func (*Metrics) SetDeletionJobsFailed

func (m *Metrics) SetDeletionJobsFailed(count int, templateName string)

func (*Metrics) SetDeletionJobsRunning

func (m *Metrics) SetDeletionJobsRunning(count int, templateName string)

func (*Metrics) SetJobsCompleted

func (m *Metrics) SetJobsCompleted(count int, templateName string)

func (*Metrics) SetJobsCreated

func (m *Metrics) SetJobsCreated(count int, templateName string)

func (*Metrics) SetJobsFailed

func (m *Metrics) SetJobsFailed(count int, templateName string)

func (*Metrics) SetJobsRunning

func (m *Metrics) SetJobsRunning(count int, templateName string)

type Runner

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

func NewRunner

func NewRunner(client *codersdk.Client, cfg Config) *Runner

func (*Runner) Cleanup

func (r *Runner) Cleanup(ctx context.Context, _ string, logs io.Writer) error

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, id string, logs io.Writer) error

Jump to

Keyboard shortcuts

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