deploy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 20 Imported by: ? modules, 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

Overview

Package deploy implements the credential-scoped, always-waiting release client.

Index

Constants

View Source
const MaxResponse = 64 << 10

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveLookup

type ActiveLookup func(context.Context) ([]Job, error)

ActiveLookup projects the active jobs for the tenant's scoped result reader. xyOps workflow.jobs contains completed stubs only.

type Broker

type Broker struct {
	Directory string
	Begin     func(context.Context, Request, string) error
	Start     func(context.Context, Request, string) (Launch, error)
	Lookup    JobLookup
	Active    ActiveLookup
	Lifetime  time.Duration
}

Broker hooks are trusted site code. Begin validates OIDC and Forgejo evidence without writing; Start is called only after durable reservation. No caller may select the launch or lookup implementation.

func (Broker) Handler

func (b Broker) Handler() (http.Handler, error)

Handler exposes only POST submit/result on a private site-configured mount. Authentication failures and upstream errors never echo tokens or job data.

type Build

type Build struct {
	RunID          uint64 `json:"run_id"`
	Attempt        uint64 `json:"attempt"`
	ManifestDigest string `json:"manifest_digest,omitempty"`
}

type Client

type Client struct {
	// Set by the CLI/site, never from a release declaration. The caller does not
	// get to supply an API base URL along with a source revision.
	IssuerOrigin string
	OpsOrigin    string
	HTTP         *http.Client
	// contains filtered or unexported fields
}

func (Client) Run

func (c Client) Run(ctx context.Context, in Invocation, report func(Event)) error

Run submits exactly once, then follows only the scoped result ticket. A transport interruption after submission never causes another launch.

type Event

type Event struct{ State, Job, Approval string }

type Invocation

type Invocation struct {
	Entry           string
	Source          Source
	Digest          string
	TokenURL        string
	TokenCredential string
	// Audience is a first-party contract for existing Arch, Corn and signing entries.
	Audience string
	Signing  bool
}

type Job

type Job struct {
	ID        string          `json:"id"`
	Event     string          `json:"event"`
	Source    string          `json:"source"`
	Complete  bool            `json:"complete"`
	Aborted   bool            `json:"aborted"`
	Suspended bool            `json:"suspended"`
	Replay    bool            `json:"replay"`
	Test      bool            `json:"test"`
	Code      json.RawMessage `json:"code"`
	Data      json.RawMessage `json:"data"`
	Parent    Parent          `json:"parent"`
	Workflow  Workflow        `json:"workflow"`
	Jobs      []JobRef        `json:"jobs"`
}

type JobLookup

type JobLookup func(context.Context, string) (Job, error)

type JobRef

type JobRef struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
}

JobRef is the scheduler's authoritative reference, not a caller parameter.

type Launch

type Launch struct {
	// Store alongside the private ticket: later API calls must not choose these.
	IntakeID, IntakeEvent, IntakeSource, EntryEvent string
	Request                                         Request
}

type Mode

type Mode string
const (
	Approval   Mode = "approval"
	Unattended Mode = "unattended"
)

type Parent

type Parent struct {
	Job   string `json:"job"`
	Event string `json:"event"`
}

type Policy

type Policy struct {
	Issuer       string `json:"issuer"`
	Audience     string `json:"audience"`
	Repository   string `json:"repository"`
	RepositoryID uint64 `json:"repository_id"`
	OwnerID      uint64 `json:"owner_id"`
	Entry        string `json:"entry"`
	Rules        []Rule `json:"rules"`
}

func (Policy) Validate

func (p Policy) Validate() error

func (Policy) Verify

func (p Policy) Verify(r Request, token string, keys oidc.KeySet, now time.Time) (*oidc.Claims, Mode, error)

Verify matches the signed token to the existing v1 wire request. The caller must additionally check Forgejo protection/CI and persist a replay reservation before queueing any job or opening deployment credentials.

type Receipt

type Receipt struct {
	Code   int    `json:"code"`
	ID     string `json:"id"`
	Ticket string `json:"ticket"`
}

type Request

type Request struct {
	Version int    `json:"version"`
	Entry   string `json:"entry"`
	Source  Source `json:"source"`
	Build   Build  `json:"build"`
}

func ParseRequest

func ParseRequest(raw string) (Request, error)

ParseRequest accepts the canonical v1 wire format used by the released clients.

type Rule

type Rule struct {
	Workflow string `json:"workflow"`
	Event    string `json:"event"`
	RefType  string `json:"ref_type"` // main or version-tag
	Mode     Mode   `json:"mode"`
}

Rule binds a workflow and an event as one authorization decision. A release cannot opt itself into unattended apply via a request field or CLI flag.

type Source

type Source struct {
	RepositoryID uint64 `json:"repository_id"`
	Ref          string `json:"ref"`
	SHA          string `json:"sha"`
}

type Status

type Status struct {
	ID         string `json:"id"`
	ReleaseID  string `json:"release_id,omitempty"`
	ApprovalID string `json:"approval_id,omitempty"`
	State      string `json:"state"`
}

func Observe

func Observe(ctx context.Context, r Launch, lookup JobLookup, active ActiveLookup) (Status, error)

Observe projects only identities and status from a trusted xyOps lookup. An intake success or a successful sibling is never deployment success.

type Submission

type Submission struct {
	IDToken string `json:"id_token"`
	Request string `json:"release_request"`
}

type Workflow

type Workflow struct {
	Job   string              `json:"job"`
	Event string              `json:"event"`
	Node  string              `json:"node"`
	Jobs  map[string][]JobRef `json:"jobs"`
}

Jump to

Keyboard shortcuts

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