script

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 14 Imported by: 0 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 script is the command provider (Design v3 §7): a person's own build script. It is given a request file naming the revision, as a Git bundle, the targets in order, the platform, and the test policy; it writes a result file with each target's outcome. Dockhand cannot vouch for how it built, so its results read "reported by <name>".

Index

Constants

View Source
const Version = 1

Version is the request and result files' format.

Variables

This section is empty.

Functions

This section is empty.

Types

type Git

type Git struct {
	URL    string `json:"url"`
	Branch string `json:"branch,omitempty"`
	Commit string `json:"commit,omitempty"`
}

Git is what a Git-fetched target's fetch clones, and must check out (batch 20): git.url, git.branch, empty for the default branch, and the commit git.branch named when the check was planned. Commit is absent where dockhand couldn't resolve it, and where git.branch abbreviates a commit, which only a clone expands.

type Provider

type Provider struct {
	// Run is the command, run by sh with the request file's path as $1.
	Run   string
	Label string
	Repo  *git.Repository
	// Grace is how long a canceled command has to stop, after an
	// interrupt, before what still runs is killed; 30 seconds when zero.
	Grace time.Duration
	// Env is the environment the command runs in, the command line's,
	// with DOCKHAND_REQUEST beside it.
	Env []string
}

Provider runs the script.

func (*Provider) Execute

func (p *Provider) Execute(ctx context.Context, job buildenv.Job, build buildenv.Build) error

func (*Provider) Name

func (p *Provider) Name() string

type Request

type Request struct {
	Version int    `json:"version"`
	Run     string `json:"run"`
	Attempt int    `json:"attempt"`
	// Execution is this provider run's ID, command_7y62p4sigena6xlr, which
	// the pull request names and dockhand logs finds it by.
	Execution string `json:"execution"`
	// Bundle holds Commit under Ref, less what Base already holds: fetch
	// Base (MacPorts' master has it) before fetching the bundle.
	Bundle   string         `json:"bundle"`
	Ref      string         `json:"ref"`
	Commit   string         `json:"commit"`
	Base     string         `json:"base"`
	Platform model.Platform `json:"platform"`
	Tests    string         `json:"tests"`
	Targets  []Target       `json:"targets"`
	// Result is where the script writes its result file, and Logs a
	// directory for its logs.
	Result string `json:"result"`
	Logs   string `json:"logs"`
}

Request is the file the script is given.

type Result

type Result struct {
	Version int            `json:"version"`
	Targets []TargetResult `json:"targets"`
	// Reference is the script's own name for the run, such as its CI's
	// URL, which dockhand records, and a pull request names when it's a
	// link.
	Reference string `json:"reference,omitempty"`
}

Result is the file the script writes.

type Target

type Target struct {
	ID        string          `json:"id"`
	Name      string          `json:"name"`
	Portfile  string          `json:"portfile"`
	Subport   string          `json:"subport,omitempty"`
	Variants  map[string]bool `json:"variants,omitempty"`
	Kind      string          `json:"kind"`
	Role      string          `json:"role"`
	DependsOn []string        `json:"depends_on,omitempty"`
	// Git is what a port fetched with Git fetches; absent for one fetched
	// otherwise.
	Git *Git `json:"git,omitempty"`
}

Target is one port to build, in the order given.

type TargetResult

type TargetResult struct {
	ID      string `json:"id"`
	Outcome string `json:"outcome"`
	Phase   string `json:"phase,omitempty"`
	Tests   string `json:"tests,omitempty"`
	Log     string `json:"log,omitempty"`
	// Fetched is the commit a Git-fetched target's fetch checked out,
	// where the script read it; one other than its request's commit fails
	// the target at fetch, whatever its outcome says.
	Fetched string `json:"fetched,omitempty"`
}

TargetResult is one target's outcome: passed, failed (with the phase it stopped at), or blocked.

Jump to

Keyboard shortcuts

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