api

package
v0.1.18-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobSBOMUploadRequest

type JobSBOMUploadRequest struct {
	Packages []RunSBOMPackage `json:"packages"`
}

type JobSBOMUploadResponse

type JobSBOMUploadResponse struct {
	JobID    domaintypes.JobID `json:"job_id"`
	RowCount int               `json:"row_count"`
}

type ListRunJobsResponse

type ListRunJobsResponse struct {
	RunID   domaintypes.RunID  `json:"run_id"`
	RepoID  domaintypes.RepoID `json:"repo_id"`
	Attempt int32              `json:"attempt"`
	Jobs    []RunJob           `json:"jobs"`
}

ListRunJobsResponse is the response for GET /v1/runs/{run_id}/jobs.

type RunJob

type RunJob struct {
	JobID       domaintypes.JobID     `json:"job_id"`
	Name        string                `json:"name"`
	JobType     domaintypes.JobType   `json:"job_type"`
	JobImage    string                `json:"job_image"`
	RepoShaIn   string                `json:"repo_sha_in,omitempty"`
	RepoShaOut  string                `json:"repo_sha_out,omitempty"`
	NextID      *domaintypes.JobID    `json:"next_id"`
	NodeID      *domaintypes.NodeID   `json:"node_id"`
	Status      domaintypes.JobStatus `json:"status"`
	ExitCode    *int32                `json:"exit_code,omitempty"`
	StartedAt   *time.Time            `json:"started_at,omitempty"`
	FinishedAt  *time.Time            `json:"finished_at,omitempty"`
	DurationMs  int64                 `json:"duration_ms"`
	DisplayName string                `json:"display_name,omitempty"`
	BugSummary  string                `json:"bug_summary,omitempty"`
	// Build-gate stack detection fields (gate jobs only).
	// Populated from gate metadata's detected_stack when present.
	Lang    string `json:"lang,omitempty"`
	Version string `json:"version,omitempty"`
	Tooling string `json:"tooling,omitempty"`
}

RunJob represents a job within a run.

type RunSBOMDiffPackage

type RunSBOMDiffPackage struct {
	Package     string `json:"package"`
	VersionPre  string `json:"version_pre"`
	VersionPost string `json:"version_post"`
	Change      string `json:"change"`
}

type RunSBOMDiffResponse

type RunSBOMDiffResponse struct {
	RunID    domaintypes.RunID    `json:"run_id"`
	View     string               `json:"view"`
	Packages []RunSBOMDiffPackage `json:"packages"`
}

type RunSBOMPackage

type RunSBOMPackage struct {
	Package string `json:"package"`
	Version string `json:"version"`
}

type RunSBOMPackagesResponse

type RunSBOMPackagesResponse struct {
	RunID    domaintypes.RunID `json:"run_id"`
	View     string            `json:"view"`
	Packages []RunSBOMPackage  `json:"packages"`
}

type RunState

type RunState string

RunState mirrors Migs run lifecycle states exposed over the API.

const (
	RunStatePending    RunState = "pending"
	RunStateRunning    RunState = "running"
	RunStateSucceeded  RunState = "succeeded"
	RunStateFailed     RunState = "failed"
	RunStateError      RunState = "error"
	RunStateCancelling RunState = "cancelling"
	RunStateCancelled  RunState = "cancelled"
)

func RunStatusFromDomain

func RunStatusFromDomain(status domaintypes.RunStatus) (RunState, error)

RunStatusFromDomain converts domain RunStatus to migs API RunState.

type RunSummary

type RunSummary struct {
	RunID      domaintypes.RunID `json:"run_id"`
	State      RunState          `json:"state"`
	Submitter  string            `json:"submitter,omitempty"`
	Repository string            `json:"repository,omitempty"`
	Metadata   map[string]string `json:"metadata,omitempty"`
	CreatedAt  time.Time         `json:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at"`
	// Stages is keyed by job ID (KSUID string from jobs.id). Each entry represents
	// a row from the `jobs` table. Use StageStatus.NextID to follow successor links
	// in the execution chain.
	Stages map[domaintypes.JobID]StageStatus `json:"stages"`
}

RunSummary is the canonical response type for GET /v1/runs/{id}/status (status) and SSE `event: run` payloads. No wrapper types are used — the JSON shape is RunSummary directly (run_id, state, stages, etc.).

RunSummary summarises run lifecycle state and associated stages. The RunID field uses domaintypes.RunID and marshals as "run_id" in JSON.

type StageMetadata

type StageMetadata struct {
	// JobType identifies the job phase: "pre_gate", "mig", or "post_gate".
	JobType domaintypes.JobType `json:"job_type,omitempty"`
	// JobImage is the container image for this job (optional, for diagnostics).
	JobImage string `json:"job_image,omitempty"`
}

StageMetadata captures job-level metadata for Migs runs. It mirrors information exposed via GET /v1/runs/{id}/status and is derived from jobs and related artifacts rather than being tied to a specific storage layout for jobs.meta JSONB.

Each execution unit (pre_gate, mig, post_gate) has a jobs row with job_type identifying the phase type.

type StageState

type StageState string

StageState mirrors Migs stage lifecycle states exposed over the API.

const (
	StageStatePending    StageState = "pending"
	StageStateQueued     StageState = "queued"
	StageStateRunning    StageState = "running"
	StageStateSucceeded  StageState = "succeeded"
	StageStateFailed     StageState = "failed"
	StageStateCancelling StageState = "cancelling"
	StageStateCancelled  StageState = "cancelled"
)

func StageStatusFromDomain

func StageStatusFromDomain(status domaintypes.JobStatus) (StageState, error)

StageStatusFromDomain converts domain JobStatus to migs API StageState.

type StageStatus

type StageStatus struct {
	State       StageState `json:"state"`
	Attempts    int        `json:"attempts"`
	MaxAttempts int        `json:"max_attempts"`
	// CurrentJobID is the job identifier for execution jobs.
	CurrentJobID domaintypes.JobID `json:"current_job_id,omitempty"`
	Artifacts    map[string]string `json:"artifacts,omitempty"`
	LastError    string            `json:"last_error,omitempty"`
	// NextID points to the successor job in the run chain. Nil means this stage
	// is currently a chain tail.
	NextID *domaintypes.JobID `json:"next_id,omitempty"`
}

StageStatus summarises the execution state for a job. Each StageStatus maps to a row in the `jobs` table.

Jump to

Keyboard shortcuts

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