provisionerdserver

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: AGPL-3.0 Imports: 38 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 (
	TagScope = "scope"
	TagOwner = "owner"

	ScopeUser         = "user"
	ScopeOrganization = "organization"
)

Variables

This section is empty.

Functions

func InsertWorkspaceResource

func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.UUID, transition database.WorkspaceTransition, protoResource *sdkproto.Resource, snapshot *telemetry.Snapshot) error

func MutateTags

func MutateTags(userID uuid.UUID, tags map[string]string) map[string]string

MutateTags adjusts the "owner" tag dependent on the "scope". If the scope is "user", the "owner" is changed to the user ID. This is for user-scoped provisioner daemons, where users should own their own operations.

Types

type Server

type Server struct {
	AccessURL                   *url.URL
	ID                          uuid.UUID
	Logger                      slog.Logger
	Provisioners                []database.ProvisionerType
	GitAuthConfigs              []*gitauth.Config
	Tags                        json.RawMessage
	Database                    database.Store
	Pubsub                      pubsub.Pubsub
	Telemetry                   telemetry.Reporter
	Tracer                      trace.Tracer
	QuotaCommitter              *atomic.Pointer[proto.QuotaCommitter]
	Auditor                     *atomic.Pointer[audit.Auditor]
	TemplateScheduleStore       *atomic.Pointer[schedule.TemplateScheduleStore]
	UserQuietHoursScheduleStore *atomic.Pointer[schedule.UserQuietHoursScheduleStore]
	DeploymentValues            *codersdk.DeploymentValues

	AcquireJobDebounce time.Duration
	OIDCConfig         httpmw.OAuth2Config

	TimeNowFn func() time.Time
}

func (*Server) AcquireJob

func (server *Server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.AcquiredJob, error)

AcquireJob queries the database to lock a job.

func (*Server) CommitQuota

func (server *Server) CommitQuota(ctx context.Context, request *proto.CommitQuotaRequest) (*proto.CommitQuotaResponse, error)

func (*Server) CompleteJob

func (server *Server) CompleteJob(ctx context.Context, completed *proto.CompletedJob) (*proto.Empty, error)

CompleteJob is triggered by a provision daemon to mark a provisioner job as completed.

func (*Server) FailJob

func (server *Server) FailJob(ctx context.Context, failJob *proto.FailedJob) (*proto.Empty, error)

func (*Server) UpdateJob

func (server *Server) UpdateJob(ctx context.Context, request *proto.UpdateJobRequest) (*proto.UpdateJobResponse, error)

type TemplateVersionDryRunJob

type TemplateVersionDryRunJob struct {
	TemplateVersionID   uuid.UUID                          `json:"template_version_id"`
	WorkspaceName       string                             `json:"workspace_name"`
	RichParameterValues []database.WorkspaceBuildParameter `json:"rich_parameter_values"`
}

TemplateVersionDryRunJob is the payload for the "template_version_dry_run" job type.

type TemplateVersionImportJob

type TemplateVersionImportJob struct {
	TemplateVersionID  uuid.UUID                `json:"template_version_id"`
	UserVariableValues []codersdk.VariableValue `json:"user_variable_values"`
}

type WorkspaceProvisionJob

type WorkspaceProvisionJob struct {
	WorkspaceBuildID uuid.UUID `json:"workspace_build_id"`
	DryRun           bool      `json:"dry_run"`
	LogLevel         string    `json:"log_level,omitempty"`
}

WorkspaceProvisionJob is the payload for the "workspace_provision" job type.

Jump to

Keyboard shortcuts

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