jobstorage

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildsDir string

BuildsDir is the directory where all build jobs are stored

Functions

func GetJobLogPath

func GetJobLogPath(jobID string) (string, error)

getJobLogPath returns the path to a job's log file

func GetJobMetadataPath

func GetJobMetadataPath(jobID string) (string, error)

getJobMetadataPath returns the path to a job's metadata file

func GetJobPath

func GetJobPath(jobID string) (string, error)

getJobPath returns the path to a job's directory

func IsValidStatusTransition

func IsValidStatusTransition(current, next JobStatus) bool

IsValidStatusTransition checks if a status transition is valid

func WriteJob

func WriteJob(jobID string, job BuildJob) error

WriteJob writes a job's metadata to the filesystem

Types

type Artifacts added in v0.8.5

type Artifacts struct {
	RawImage      bool `json:"raw_image"`
	ISO           bool `json:"iso"`
	ContainerFile bool `json:"container_file"`
	AWS           bool `json:"aws"`
	GCP           bool `json:"gcp"`
	Azure         bool `json:"azure"`
}

JobData contains the build configuration Artifacts specifies which artifacts to build

type BuildJob

type BuildJob struct {
	JobData
	Status    JobStatus `json:"status"`
	CreatedAt string    `json:"created_at"`
	UpdatedAt string    `json:"updated_at"`
	WorkerID  string    `json:"worker_id,omitempty"`
}

BuildJob represents a build job in the system

func BindNextAvailableJob

func BindNextAvailableJob(workerID string) (string, BuildJob, error)

BindNextAvailableJob attempts to bind the next available queued job to a worker Returns the job ID and job data if successful, or empty values if no job is available

func ReadJob

func ReadJob(jobID string) (BuildJob, error)

ReadJob reads a job's metadata from the filesystem

type JobData

type JobData struct {
	Variant                string    `json:"variant"`
	Model                  string    `json:"model"`
	TrustedBoot            bool      `json:"trusted_boot"`
	KubernetesDistribution string    `json:"kubernetes_distribution"`
	KubernetesVersion      string    `json:"kubernetes_version"`
	Image                  string    `json:"image"`
	Version                string    `json:"version"`
	Artifacts              Artifacts `json:"artifacts"`
	CloudConfig            string    `json:"cloud_config,omitempty"`
}

type JobStatus

type JobStatus string

JobStatus represents the current status of a build job

const (
	JobStatusQueued   JobStatus = "queued"
	JobStatusAssigned JobStatus = "assigned"
	JobStatusRunning  JobStatus = "running"
	JobStatusComplete JobStatus = "complete"
	JobStatusFailed   JobStatus = "failed"
)

Jump to

Keyboard shortcuts

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