Documentation
¶
Index ¶
- Constants
- type Binary
- type Config
- type ErrChecksumMismatch
- type ErrCorruptExtensionManifest
- type ErrDownloadFailed
- type ErrExited
- type ErrExtensionBinaryNotFound
- type ErrExtensionNotFound
- type ErrExtensionNotInstalled
- type ErrExtensionTooLarge
- type ErrInvalidName
- type ErrNoBinaryForPlatform
- type Extension
- type LatestData
- type Manager
- type Manifest
- type Reference
- type ReferenceArg
- type ReferenceFlag
- type ReferenceSub
- type Store
- type Unmanaged
Constants ¶
const ReferenceAnnotation = "extension:reference"
ReferenceAnnotation is the cobra command annotation key for when an extension provides reference documentation.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrChecksumMismatch ¶
ErrChecksumMismatch is returned when the downloaded binary does not match the expected SHA256.
func (*ErrChecksumMismatch) Error ¶
func (e *ErrChecksumMismatch) Error() string
type ErrCorruptExtensionManifest ¶
func (*ErrCorruptExtensionManifest) Error ¶
func (e *ErrCorruptExtensionManifest) Error() string
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.
type ErrExtensionBinaryNotFound ¶
ErrExtensionBinaryNotFound is returned when the extension binary named in a manifest does not exist on disk
func (*ErrExtensionBinaryNotFound) Error ¶
func (e *ErrExtensionBinaryNotFound) Error() string
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 ¶
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 ¶
ErrNoBinaryForPlatform is returned when the registry has no binary for the current OS/arch.
func (*ErrNoBinaryForPlatform) Error ¶
func (e *ErrNoBinaryForPlatform) Error() string
type LatestData ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
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"`
Ref *Reference `yaml:"reference,omitempty"`
}
func (*Manifest) Run ¶
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 Reference ¶
type Reference struct {
Use string `json:"use,omitempty" yaml:"use,omitempty"`
Short string `json:"short,omitempty" yaml:"short,omitempty"`
Long string `json:"long,omitempty" yaml:"long,omitempty"`
Args []ReferenceArg `json:"args,omitempty" yaml:"args,omitempty"`
Flags []ReferenceFlag `json:"flags,omitempty" yaml:"flags,omitempty"`
Subcommands []ReferenceSub `json:"subcommands,omitempty" yaml:"subcommands,omitempty"`
}
Reference describes an extension command and, recursively, its subcommands. It is owned by the extension and fetched from the extension registry's release.json. When present, it enriches the CLI's generated reference docs; when absent, the CLI falls back to the base extension docs.
type ReferenceArg ¶
type ReferenceArg struct {
Name string `json:"name" yaml:"name"`
Help string `json:"help,omitempty" yaml:"help,omitempty"`
}
ReferenceArg describes a single argument for Reference.
type ReferenceFlag ¶
type ReferenceFlag struct {
Name string `json:"name" yaml:"name"`
Shorthand string `json:"shorthand,omitempty" yaml:"shorthand,omitempty"`
Usage string `json:"usage,omitempty" yaml:"usage,omitempty"`
// Type is the value placeholder shown after the flag name, e.g. "string".
// Empty means the flag takes no value (boolean-style).
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Default string `json:"default,omitempty" yaml:"default,omitempty"`
}
ReferenceFlag describes a single flag for Reference.
type ReferenceSub ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) FindAll ¶
FindAll scans path for extension manifest.yml files. It loads extension data from each manifest.yml and returns all loaded extension manifests.
type Unmanaged ¶
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 ¶
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.