provisionerdserver

package
v0.23.7 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: AGPL-3.0 Imports: 38 Imported by: 0

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 added in v0.12.8

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.

func ProvisionerJobLogsNotifyChannel

func ProvisionerJobLogsNotifyChannel(jobID uuid.UUID) string

ProvisionerJobLogsNotifyChannel is the PostgreSQL NOTIFY channel to publish updates to job logs on.

Types

type ProvisionerJobLogsNotifyMessage

type ProvisionerJobLogsNotifyMessage struct {
	CreatedAfter int64 `json:"created_after"`
	EndOfLogs    bool  `json:"end_of_logs,omitempty"`
}

ProvisionerJobLogsNotifyMessage is the payload published on the provisioner job logs notify channel.

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                database.Pubsub
	Telemetry             telemetry.Reporter
	Tracer                trace.Tracer
	QuotaCommitter        *atomic.Pointer[proto.QuotaCommitter]
	Auditor               *atomic.Pointer[audit.Auditor]
	TemplateScheduleStore *atomic.Pointer[schedule.TemplateScheduleStore]
	DeploymentValues      *codersdk.DeploymentValues

	AcquireJobDebounce time.Duration
	OIDCConfig         httpmw.OAuth2Config
}

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 added in v0.12.7

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"`
	ParameterValues     []database.ParameterValue          `json:"parameter_values"`
	RichParameterValues []database.WorkspaceBuildParameter `json:"rich_parameter_values"`
}

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

type TemplateVersionImportJob added in v0.15.0

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