Documentation
¶
Index ¶
- Constants
- func List(cfg *ProjectConfig, streams iostream.Streams) error
- func RunAll(ctx context.Context, workDir string, force bool, cfg *ProjectConfig, ...) error
- func RunDryRun(cfg *ProjectConfig, name string, streams iostream.Streams) error
- func RunInline(ctx context.Context, workDir, name, command string, force bool, ...) error
- func RunNamed(ctx context.Context, workDir, name string, force bool, cfg *ProjectConfig, ...) error
- func RunRemote(ctx context.Context, client *circleci.Client, cfg *ProjectConfig, ...) error
- func SaveCommand(workDir, name, command string) error
- func SaveProjectConfig(workDir string, cfg *ProjectConfig) error
- func Status(workDir, name string, cfg *ProjectConfig, streams iostream.Streams) error
- func WriteCache(workDir, name, fileExt string, exitCode int, output string) error
- type CachedResult
- type Command
- type ProjectConfig
Constants ¶
const DefaultTimeout = 300
DefaultTimeout is the per-command execution timeout in seconds.
Variables ¶
This section is empty.
Functions ¶
func List ¶
func List(cfg *ProjectConfig, streams iostream.Streams) error
List prints all configured command names and their run strings.
func RunAll ¶
func RunAll(ctx context.Context, workDir string, force bool, cfg *ProjectConfig, streams iostream.Streams) error
RunAll runs all configured commands with optional cache bypass.
func RunDryRun ¶
func RunDryRun(cfg *ProjectConfig, name string, streams iostream.Streams) error
RunDryRun prints commands without executing them.
func RunInline ¶
func RunInline(ctx context.Context, workDir, name, command string, force bool, streams iostream.Streams) error
RunInline runs an inline command string, caching the result under the given name.
func RunNamed ¶
func RunNamed(ctx context.Context, workDir, name string, force bool, cfg *ProjectConfig, streams iostream.Streams) error
RunNamed runs a single named command from config with caching.
func RunRemote ¶
func RunRemote(ctx context.Context, client *circleci.Client, cfg *ProjectConfig, sandboxID, _ string, streams iostream.Streams) error
RunRemote runs commands on a remote sandbox.
func SaveCommand ¶
SaveCommand upserts a command in .chunk/config.json.
func SaveProjectConfig ¶
func SaveProjectConfig(workDir string, cfg *ProjectConfig) error
SaveProjectConfig writes the config back to .chunk/config.json.
Types ¶
type CachedResult ¶
type CachedResult struct {
Status string `json:"status"` // "pass" or "fail"
ExitCode int `json:"exitCode"`
Output string `json:"output"`
ContentHash string `json:"contentHash"`
Timestamp int64 `json:"timestamp"`
}
CachedResult is the sentinel file format for validate command caching.
func CheckCache ¶
func CheckCache(workDir, name, fileExt string) *CachedResult
CheckCache reads a cached result and returns it if the content hash still matches. fileExt optionally scopes the content hash to files matching the extension.
type ProjectConfig ¶
type ProjectConfig struct {
Commands []Command `json:"commands"`
}
func LoadProjectConfig ¶
func LoadProjectConfig(workDir string) (*ProjectConfig, error)
func (*ProjectConfig) FindCommand ¶
func (c *ProjectConfig) FindCommand(name string) *Command
FindCommand returns the command with the given name, or nil if not found.
func (*ProjectConfig) HasCommands ¶
func (c *ProjectConfig) HasCommands() bool