Documentation
¶
Index ¶
- func ConfigExists(rootDir string) bool
- func GetDefinitionByNameOrID(cfg *RunConfig, nameOrID string) (string, *string, string, error)
- func IsValidUUID(s string) bool
- func MapVcsTypeToOrgType(vcsType string) string
- func SaveRunConfig(workDir string, cfg *RunConfig) error
- func TriggerRun(ctx context.Context, client *circleci.Client, cfg *RunConfig, params RunParams) (*circleci.RunResponse, error)
- type ProjectDetailFunc
- type Prompts
- type RunConfig
- type RunDefinition
- type RunParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigExists ¶
ConfigExists checks whether .chunk/run.json exists at the given root directory.
func GetDefinitionByNameOrID ¶
GetDefinitionByNameOrID looks up a definition by name first, then checks if the input is a raw UUID. Returns the definition ID, the chunk environment ID, and the default branch.
func IsValidUUID ¶
IsValidUUID checks if a string is a valid UUID format.
func MapVcsTypeToOrgType ¶
MapVcsTypeToOrgType maps a VCS type string to the org type used in run config. "github" and "gh" map to "github"; everything else maps to "circleci".
func SaveRunConfig ¶
SaveRunConfig writes run config to .chunk/run.json.
Types ¶
type ProjectDetailFunc ¶ added in v0.7.28
ProjectDetailFunc fetches project detail by slug (e.g. "gh/org/repo").
type Prompts ¶ added in v0.7.28
type Prompts struct {
Confirm func(label string, defaultVal bool) (bool, error)
SelectFrom func(label string, items []string) (int, error)
PromptText func(label string, defaultVal string) (string, error)
Warn func(msg string)
}
Prompts provides the interactive UI operations needed to collect run config.
type RunConfig ¶
type RunConfig struct {
OrgID string `json:"org_id"`
ProjectID string `json:"project_id"`
OrgType string `json:"org_type"`
Definitions map[string]RunDefinition `json:"definitions"`
}
func CollectRunConfig ¶ added in v0.7.28
func CollectRunConfig( ctx context.Context, prompts Prompts, projects []circleci.FollowedProject, collabs []circleci.Collaboration, fetchDetail ProjectDetailFunc, envOrgID string, ) (*RunConfig, error)
CollectRunConfig drives the interactive form to build a RunConfig. It takes already-fetched projects and collaborations plus injected UI and data-fetch dependencies so the logic is testable without a TTY. envOrgID is the org ID read from the environment by the caller; pass "" to skip the mismatch check.