Documentation
¶
Overview ¶
Package pin implements the two-phase pin lifecycle: Plan builds a complete Record of what to pin (pure computation + network reads), and Commit writes the Record to disk (workflow files + lockfile).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommitOptions ¶
type CommitOptions struct {
// OnProgress is called at each phase boundary. Nil means no progress.
OnProgress func(phase string)
// SkipNewWorkflowEntries forces the Commit phase to skip workflows with no existing lockfile entry.
SkipNewWorkflowEntries bool
}
CommitOptions configures the Commit pass.
type Entry ¶
type Entry struct {
Hostname string
NWO string
Ref string
SHA string
ObservedSHA string
Resolution Resolution
Issue string
Reason string
Suggestion string
AutoFixedRef string // original ref before sane-release rewrite
OnBranch string
Tag string
Workflows []string
RequiredBy []string
Direct bool
// RenamedFrom lists the lockfile keys this pin had before a
// same-repository rename, so their recorded `uses:` carry over.
RenamedFrom []string
FullScan bool
}
Entry records the plan decision for one action dependency.
type PlanOptions ¶
type PlanOptions struct {
Resolver *resolve.Resolver
Tagger *tag.Lister
Store *lockfile.State
Pool *pinpool.Pool
RepoOwner string // for same-owner narrowing skip
RepoName string
// NoNarrow disables tag narrowing: mutable version refs (v4, v3.1)
// are kept as the lock comment instead of being resolved to full
// patch tags (v4.2.1). Bare-SHA reverse lookup still applies.
NoNarrow bool
// AcceptMoved treats ref-moved and unreachable-pin findings as
// resolvable: affected deps are pruned from the inventory and
// re-resolved to their current live SHA.
AcceptMoved bool
// Relock treats ref-moved findings (a branch or partial-version ref
// that legitimately advanced) as resolvable, re-pinning them to the
// current live SHA. Unlike AcceptMoved it leaves unreachable-pin
// findings untouched so possible tampering stays a hard error.
Relock bool
// PartialScan reports that explicit workflow paths, rather than the full
// workflow directory, define this run's mutation authority.
PartialScan bool
// OnProgress is called at each phase boundary with a human-readable
// label (e.g. "Resolving actions/checkout"). Nil means no progress.
OnProgress func(phase string)
// contains filtered or unexported fields
}
PlanOptions configures the Plan pass.
type Record ¶
type Record struct {
Entries []Entry
Workflows []WorkflowPlan
}
Record is the complete output of Plan: everything Commit needs to write all changes atomically.
func Plan ¶
Plan walks an actionmanager Report and produces a Record describing every pin action to take. It does network reads (resolve, reverse lookup, reachability) but no disk writes.
func (*Record) Investigated ¶
Investigated returns entries with Resolution == Investigate.
func (*Record) Narrowed ¶ added in v0.1.0
Narrowed returns verified entries whose refs were upgraded (AutoFixedRef set).
func (*Record) Unresolved ¶
Unresolved returns entries with Resolution == Unresolved.
type Resolution ¶
type Resolution string
Resolution describes the outcome for a single action reference.
const ( Pinned Resolution = "pinned" Verified Resolution = "verified" Investigate Resolution = "needs-investigation" Skipped Resolution = "skipped" Unresolved Resolution = "unresolved" )
Resolution values reported for an action reference.
func (Resolution) String ¶
func (r Resolution) String() string
String returns the resolution as a string.
type WorkflowPlan ¶
type WorkflowPlan struct {
Path string
Rewrites map[string]string
// RequiredRewrites move redirected `uses:` to the canonical repository;
// Commit fails rather than skip one.
RequiredRewrites map[string]string
// RewrittenIn lists, per RequiredRewrites key, the files Commit found it in.
RewrittenIn map[string][]string
// SelfActionFiles are in-repo action definition files reached from this
// workflow through `$/…`. The same rewrites apply to their `uses:` lines.
SelfActionFiles []string
}
WorkflowPlan records what Commit must write for one workflow file.