cockpitaction

package
v0.220.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 20 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 cockpitaction binds browser-approved dispositions to exact, signed snapshots. Its payload is held by the existing durable operation queue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySigned

func ApplySigned(ctx context.Context, publicKey, signed, executable string, out, errOut io.Writer) error

ApplySigned receives its public key and immutable payload through the existing authenticated worker assignment. This is not a standalone authorization API: the queue controls both arguments and a worker operation must already exist.

func Execute

func Execute(ctx context.Context, p Payload, executable string, ports Ports, out, errOut io.Writer) error

func Sign

func Sign(p Payload, private []byte) (string, error)

Sign binds every byte of the approved action to the existing owner credential.

func ValidateAction

func ValidateAction(action string, s Snapshot, comment string) error

ValidateAction permits only the explicitly selected kind and bounded comment.

Types

type Payload

type Payload struct {
	Action                     string
	Target                     Snapshot
	Comment, Root, Worker, Key string
	Expires                    time.Time
}

Payload contains no credential and accepts no user-supplied command.

func Verify

func Verify(raw string, public []byte, now time.Time) (Payload, error)

type Ports

type Ports struct {
	Read   func(context.Context, string, string, ...string) (string, error)
	PR     func(context.Context, string, string) (githubchecks.PullRequestView, error)
	Run    func(context.Context, string, string, []string, io.Writer, io.Writer) error
	Remote func(context.Context, string, string) (string, error)
	Now    func() time.Time
}

Ports keeps unit tests entirely away from real GitHub and fleet mutations.

func DefaultPorts

func DefaultPorts() Ports

type Snapshot

type Snapshot struct {
	Kind, ID, Repository, Branch, Path, Task string
	Number                                   int
	Canonical                                bool
	Head, LocalHead, RemoteHead, Base, State string
}

Snapshot is the immutable identity approved by the operator.

func Observe

func Observe(ctx context.Context, s Snapshot, p Ports) (Snapshot, error)

Observe requires a clean checkout and takes fresh local and remote ref reads. A branch or provider head change invalidates the operator's preview.

Jump to

Keyboard shortcuts

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