extension

package
v1.0.45159-pre Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary struct {
	Path   string `json:"name"`
	Arch   string `json:"arch"`
	Sys    string `json:"sys"`
	Sha256 string `json:"sha256"`
}

type Config

type Config struct {
	Version       string
	Agent         string
	BaseURL       string
	ExtensionsDir string
}

type ErrChecksumMismatch

type ErrChecksumMismatch struct {
	Expected string
	Got      string
}

ErrChecksumMismatch is returned when the downloaded binary does not match the expected SHA256.

func (*ErrChecksumMismatch) Error

func (e *ErrChecksumMismatch) Error() string

type ErrCorruptExtensionManifest

type ErrCorruptExtensionManifest struct {
	ManifestPath string
	Err          error
}

func (*ErrCorruptExtensionManifest) Error

type ErrDownloadFailed

type ErrDownloadFailed struct {
	StatusCode int
}

ErrDownloadFailed is returned when the binary download returns a non-200 status.

func (*ErrDownloadFailed) Error

func (e *ErrDownloadFailed) Error() string

type ErrExited

type ErrExited struct {
	Code int
}

ErrExited is returned by Run when the extension process exits with a non-zero status code. The caller should exit with Code rather than printing an error message — the extension is responsible for its own error output.

func (*ErrExited) Error

func (e *ErrExited) Error() string

type ErrExtensionBinaryNotFound

type ErrExtensionBinaryNotFound struct {
	Name string
	Path string
}

ErrExtensionBinaryNotFound is returned when the extension binary named in a manifest does not exist on disk

func (*ErrExtensionBinaryNotFound) Error

type ErrExtensionNotFound

type ErrExtensionNotFound struct {
	Name string
}

ErrExtensionNotFound is returned when the extension does not exist in the registry.

func (*ErrExtensionNotFound) Error

func (e *ErrExtensionNotFound) Error() string

type ErrExtensionNotInstalled

type ErrExtensionNotInstalled struct {
	Name string
}

ErrExtensionNotInstalled is returned when attempting to remove an extension that is not installed.

func (*ErrExtensionNotInstalled) Error

func (e *ErrExtensionNotInstalled) Error() string

type ErrExtensionTooLarge

type ErrExtensionTooLarge struct {
	Name    string
	MaxSize int64
}

ErrExtensionTooLarge is returned when the decompressed extension binary exceeds the maximum allowed size.

func (*ErrExtensionTooLarge) Error

func (e *ErrExtensionTooLarge) Error() string

type ErrInvalidName

type ErrInvalidName struct {
	Name string
}

ErrInvalidName is returned when the extension name contains invalid characters.

func (*ErrInvalidName) Error

func (e *ErrInvalidName) Error() string

type ErrNoBinaryForPlatform

type ErrNoBinaryForPlatform struct {
	Name string
	OS   string
	Arch string
}

ErrNoBinaryForPlatform is returned when the registry has no binary for the current OS/arch.

func (*ErrNoBinaryForPlatform) Error

func (e *ErrNoBinaryForPlatform) Error() string

type Extension

type Extension struct {
	BinaryName string
	Version    string
	Arch       string
	Sys        string
	Sha256     string
	URL        string
}

type LatestData

type LatestData struct {
	Version  string   `json:"version"`
	Binaries []Binary `json:"binaries"`
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(cfg Config) *Manager

func (*Manager) Get

func (m *Manager) Get(ctx context.Context, binaryName string) (Extension, error)

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, ext Extension) error

func (*Manager) Remove

func (m *Manager) Remove(_ context.Context, binaryName string) error

Remove removes the given extension. The full contents of the extension directory are removed. If the extension manifest points to a binary outside the directory, the binary is not removed. Returns ErrExtensionNotInstalled if the extension is not installed.

type Manifest

type Manifest struct {
	Name       string `yaml:"name"`
	BinaryName string `yaml:"binary_name"`
	Version    string `yaml:"version"`
	Sha256     string `yaml:"sha256"`
	URL        string `yaml:"url"`
	Path       string `yaml:"path"`
}

func FindAll

func FindAll(path string) ([]Manifest, error)

FindAll scans path for extension manifest.yml files. It loads extension data from each manifest.yml and returns all loaded extension manifests.

func (*Manifest) Run

func (ext *Manifest) Run(ctx context.Context, client *apiclient.Client, args []string) error

Run executes the extension binary with args, injecting CircleCI environment variables.

The current process is replaced by the extension via syscall exec on Unix; on Windows the extension is run as a child process and its exit code is propagated.

If the extension binary is not found, ErrExtensionBinaryNotFound is returned and the caller should show prompt the user to reinstall the extension.

type Unmanaged

type Unmanaged struct {
	Name       string
	BinaryName string
	Path       string
}

Unmanaged represents an extension not managed by the CLI.

func FindAllOnPATH

func FindAllOnPATH() []Unmanaged

FindAllOnPATH scans PATH for executables named "circleci-<name>" and returns the extension names (the part after "circleci-"). The first entry in PATH wins for duplicate names, matching exec.LookPath semantics.

func (*Unmanaged) Run

func (ext *Unmanaged) Run(ctx context.Context, client *apiclient.Client, args []string) error

Run executes the extension binary with args, injecting CircleCI environment variables.

The current process is replaced by the extension via syscall exec on Unix; on Windows the extension is run as a child process and its exit code is propagated.

If the extension binary is not found, ErrExtensionBinaryNotFound is returned and the caller should prompt the user to reinstall the extension.

Jump to

Keyboard shortcuts

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