plangenerate

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuitableWorkflowFound = errors.New("no suitable workflow found")
)

Functions

This section is empty.

Types

type GeneratePlanRequest

type GeneratePlanRequest struct {
	Modules      []*analyzerapi.ProjectModule        `json:"modules"`
	Registry     catalog.Config                      `json:"registry"`
	ProjectDir   string                              `json:"project_dir"`
	Env          map[string]string                   `json:"env"`
	Executables  []executable.Executable             `json:"executables"`
	PinVersions  bool                                `json:"pin_versions"`
	Variables    []api.CIVariable                    `json:"variables"`
	Environments map[string]appcommon.VCSEnvironment `json:"environments"`
	WorkflowType string                              `json:"workflow_type"`
}

type Plan

type Plan struct {
	Name              string                  `json:"name"`
	Stages            []string                `json:"stages"`
	Steps             []Step                  `json:"steps"`
	PinnedExecutables []executable.Executable `json:"pinned-executables,omitempty"`
}

func GeneratePlan

func GeneratePlan(request GeneratePlanRequest) (Plan, error)

type PlanContext

type PlanContext struct {
	ProjectDir      string
	Environment     map[string]string
	Stages          []string
	VCSVariables    []api.CIVariable
	VCSEnvironments map[string]appcommon.VCSEnvironment
	Registry        catalog.Config
	Modules         []*analyzerapi.ProjectModule
}

type Stage

type Stage struct {
	Name  string   `json:"name"`
	Steps []Step   `json:"steps,omitempty"`
	Needs []string `json:"needs,omitempty"`
}

type Step

type Step struct {
	ID                 string                 `json:"id"`
	Name               string                 `json:"name"`
	Slug               string                 `json:"slug"`
	Stage              string                 `json:"stage"`
	Scope              actionsdk.ActionScope  `json:"scope"`
	Action             string                 `json:"action"`
	Module             string                 `json:"module,omitempty"`
	ModuleDir          string                 `json:"module-dir,omitempty"`             // Directory of the module, if applicable
	RunAfter           []string               `json:"run-after,omitempty"`              // List of steps that need to be completed before this step starts (by slug)
	RunAfterByName     []string               `json:"run-after-by-name,omitempty"`      // List of steps that need to be completed before this step starts (by name)
	RunIfChanged       []string               `json:"run-if-changed,omitempty"`         // List of files that trigger this step if changed
	UsesOutputOf       []string               `json:"uses-output-of,omitempty"`         // List of steps whose outputs need to be downloaded (by slug)
	UsesOutputOfByName []string               `json:"uses-output-of-by-name,omitempty"` // List of steps whose outputs need to be downloaded (by name)
	Environment        string                 `json:"environment,omitempty"`
	Access             StepAccess             `json:"access,omitempty"`
	Inputs             actionsdk.ActionInput  `json:"inputs,omitempty"`
	Outputs            actionsdk.ActionOutput `json:"outputs,omitempty"`
	Order              int                    `json:"order"` // Topological order
	Config             interface{}            `json:"config,omitempty"`
}

func SortSteps

func SortSteps(steps []Step) ([]Step, error)

SortSteps sorts the steps using the Topological Sort Algorithm

func (*Step) HasOutputWithTypeAndFormat

func (s *Step) HasOutputWithTypeAndFormat(artifactType string, artifactFormat string) bool

type StepAccess added in v0.11.13

type StepAccess struct {
	Environment []StepAccessEnv                    `json:"env,omitempty"`         // Environment variables that the step may access during execution
	Executables []actionsdk.ActionAccessExecutable `json:"executables,omitempty"` // Executables that the step may invoke during execution
	Network     StepAccessNetwork                  `json:"network,omitempty"`     // Network endpoints (host:port) that the step may use during execution
	Resources   []actionsdk.ActionAccessResource   `json:"resources,omitempty"`   // Resources the step may access (e.g. releases, packages, ...)
}

StepAccess is the compact access definition persisted with each step of a plan. It keeps everything required to render and execute the step, but omits documentation-only fields of the action metadata.

func NewStepAccess added in v0.11.13

func NewStepAccess(access actionsdk.ActionAccess) StepAccess

NewStepAccess converts the access definition of an action into the compact step access definition

type StepAccessEnv added in v0.11.13

type StepAccessEnv struct {
	Name     string `json:"name"`
	Pattern  bool   `json:"pattern,omitempty"`
	Required bool   `json:"required,omitempty"`
	Secret   bool   `json:"secret,omitempty"`
}

type StepAccessNetwork added in v0.11.13

type StepAccessNetwork []string

StepAccessNetwork is a list of network endpoints (host:port)

func MergeNetworkHosts added in v0.11.13

func MergeNetworkHosts(groups ...StepAccessNetwork) StepAccessNetwork

MergeNetworkHosts concatenates endpoint lists into a new slice, deduplicating and preserving order

func NetworkHosts added in v0.11.13

func NetworkHosts(network []actionsdk.ActionAccessNetwork) StepAccessNetwork

NetworkHosts converts action network access entries into a list of endpoints

func RemoveNetworkHosts added in v0.11.13

func RemoveNetworkHosts(network StepAccessNetwork, remove StepAccessNetwork) StepAccessNetwork

RemoveNetworkHosts returns the endpoints of network that are not contained in remove, preserving order

func (*StepAccessNetwork) UnmarshalJSON added in v0.11.13

func (n *StepAccessNetwork) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts both plain endpoint strings and the legacy {"host": "..."} object form

type StepMetadata

type StepMetadata struct {
	ExecutableConstraints map[string]string `json:"executable-constraints,omitempty"`
}

Jump to

Keyboard shortcuts

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