Documentation
¶
Index ¶
- Constants
- func CanRead(format CheckpointFormat) bool
- func CanSatisfyPolicy(policy Policy) bool
- func CanWrite(format CheckpointFormat) bool
- func Compare(a, b CheckpointFormat) int
- func DefaultCheckpointVersion() string
- func Push(ctx context.Context, target Target) error
- func RequiresUpgrade(policy Policy) bool
- func SetRef(repo *git.Repository, ref plumbing.ReferenceName, hash plumbing.Hash) error
- func UnsupportedPolicyMessage(policy Policy, updateCommand string) string
- func UnsupportedWrite(policy Policy) bool
- func ValidatePolicy(policy Policy) error
- func WriteLocal(ctx context.Context, repo *git.Repository, parent plumbing.Hash, policy Policy) (plumbing.Hash, error)
- type CheckpointFamily
- type CheckpointFormat
- type Policy
- type RemoteState
- type Source
- type State
- func ReadFromRef(ctx context.Context, repo *git.Repository, refName plumbing.ReferenceName, ...) (State, error)
- func ReadLocal(ctx context.Context, repo *git.Repository) (State, error)
- func Sync(ctx context.Context, repo *git.Repository, target Target) (State, error)
- func SyncFrom(ctx context.Context, repo *git.Repository, targets []Target) (State, error)
- func Update(ctx context.Context, repo *git.Repository, target Target, opts UpdateOptions) (State, error)
- type Target
- type UpdateOptions
Constants ¶
View Source
const CheckpointVersionBranchV1 = "branch-v1"
CheckpointVersionBranchV1 identifies the branch-backed checkpoint format.
View Source
const PolicyFileName = "policy.json"
View Source
const RefName = plumbing.ReferenceName("refs/entire/policies/checkpoint")
Variables ¶
This section is empty.
Functions ¶
func CanRead ¶
func CanRead(format CheckpointFormat) bool
func CanSatisfyPolicy ¶ added in v0.8.0
func CanWrite ¶
func CanWrite(format CheckpointFormat) bool
func Compare ¶
func Compare(a, b CheckpointFormat) int
func DefaultCheckpointVersion ¶ added in v0.8.0
func DefaultCheckpointVersion() string
func RequiresUpgrade ¶
func SetRef ¶
func SetRef(repo *git.Repository, ref plumbing.ReferenceName, hash plumbing.Hash) error
func UnsupportedPolicyMessage ¶ added in v0.8.0
func UnsupportedWrite ¶
func ValidatePolicy ¶
Types ¶
type CheckpointFamily ¶
type CheckpointFamily string
const ( CheckpointFamilyBranch CheckpointFamily = "branch" CheckpointFamilyRefs CheckpointFamily = "refs" )
type CheckpointFormat ¶
type CheckpointFormat struct {
Family CheckpointFamily
Major int
}
func ParseFormat ¶
func ParseFormat(raw string) (CheckpointFormat, error)
func (CheckpointFormat) String ¶
func (f CheckpointFormat) String() string
type Policy ¶
type Policy struct {
CheckpointVersion string `json:"checkpoint_version,omitempty"`
CheckpointMinVersion string `json:"checkpoint_min_version,omitempty"`
}
func DefaultPolicy ¶
func DefaultPolicy() Policy
type RemoteState ¶
func CheckRemote ¶
func CheckRemote(ctx context.Context, target Target) (RemoteState, error)
type State ¶
func ReadFromRef ¶
func ReadFromRef(ctx context.Context, repo *git.Repository, refName plumbing.ReferenceName, source Source) (State, error)
func SyncFrom ¶ added in v0.10.1
SyncFrom reconciles the local checkpoint policy ref against the first target that has a policy ref. Targets are tried in order; a target lacking the policy ref and a target failing at the transport level both advance to the next target (failures logged at debug); when no target yields a baseline and at least one failed, the FIRST failure is surfaced. A winning target marked SkipLocalUpdate contributes a read-only baseline: it is compared and reported but never advances the local policy ref.
func Update ¶
func Update(ctx context.Context, repo *git.Repository, target Target, opts UpdateOptions) (State, error)
type Target ¶
type Target struct {
Remote string
Dir string
// SkipLocalUpdate marks a read-only (legacy-tier) candidate: a policy
// baseline found on it may be read, compared, and reported, but never
// advances the local policy ref via SetRef. Push targets and the elected
// checkpoint sync remote leave this false. The zero value preserves the
// historical single-target Sync behavior (pre-push hook path).
SkipLocalUpdate bool
}
Click to show internal directories.
Click to hide internal directories.