Documentation
¶
Overview ¶
Package ciutil provides core types, helper functions, etc. for running CI tasks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitSystem ¶
func InitSystem() error
InitSystem runs setup & checks against the host itself, so that oscar can run.
func RunCommand ¶
RunCommand takes a string slice containing an entire command & its args to run, and returns a consisten error message in case of failure.
func RunDurationString ¶
RunDurationString returns a calculated duration used to indicate how long a particular task took to run.
Types ¶
type HostInfo ¶
HostInfo holds the final host information values to be used in e.g. release downloads of a tool.
func GetHostInfo ¶
func GetHostInfo(i HostInfoInput) (HostInfo, error)
GetHostInfo returns a populated HostInfo, based on the provided HostInfoInput mappings.
type HostInfoInput ¶
type HostInfoInput struct {
// The name a tool uses for Linux OSes (e.g. "linux", "unknown", etc.)
OSLinux string
// The name a tool uses for the Linux kernel (e.g. "linux", "linux-gnu", etc.)
KernelLinux string
// The name a tool uses for macOS (e.g. "apple")
OSMacOS string
// The name a tool uses for the macOS kernel (e.g. "darwin")
KernelMacOS string
// The name a tool uses for AMD64 architectures (e.g. "x86_64", "amd64", etc.)
ArchAMD64 string
// The name a tool uses for ARM64 architectures (e.g. "aarch64", "arm64", etc.)
ArchARM64 string
}
HostInfoInput allows different tools to specify the different possible values for their host-related information. This is primarily used when downloading a release artifact. This is necessary to provide because different tools use different values for their host info. For example:
- Some tools use "x86_64" for CPU architecture, while some use "amd64", and others even use "x64"
- In addition to a kernel ID, some tools additionally specify an OS value (e.g. both "darwin" and "macos")
type Repo ¶
Repo stores information about the contents of the repository being ran against.
func GetRepoComposition ¶
GetRepoComposition returns a populated Repo.
type Tasker ¶
type Tasker interface {
// InfoText should return a human-readable display string that describes the task, e.g. "Run
// tests". If this is unset, then its banner will not show in the CI log output at all (which
// may be desirable) in the case of implementers of [Tasker.Init])
InfoText() string
// Run should perform the actual task's actions.
Run() error
// Post should perform any post-run actions for the task, if necessary.
Post() error
}
Tasker defines the method set for working with metadata for a given CI Task.
type Tool ¶
type Tool struct {
// The tool's name, used as an identifier. May also be the tool's invocable command, in which
// case it can be interpolated as such.
Name string
// The installable path for the tool, like a URL. Can also be a format string, e.g. with
// placeholders for platform-specific strings.
RemotePath string
// The version of the tool.
Version string
// The path to the tool's config file, if it has one to use.
ConfigFilePath string
}
A Tool is a helper struct used to help other types implementing Tasker pass around their tool versioning/installation information.