pipeline

package
v0.0.0-...-31a1cf3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 62 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDeploymentTimeoutSeconds = 30 * 6
View Source
var TEST_SUBSCRIPTION_ID = "test"

Functions

func GetAllRequiredAzureClients

func GetAllRequiredAzureClients(ctx context.Context, subscriptionIDs []string) (map[string]string, error)

func Inspect

func Inspect(p *types.Pipeline, ctx context.Context, options *InspectOptions) error

func KubeConfig

func KubeConfig(ctx context.Context, subscriptionID, resourceGroup, aksClusterName string) (string, error)

func NewStepInspectScopes

func NewStepInspectScopes(subscriptions map[string]string) map[string]StepInspectScope

func ResolvePipelineSubscriptions

func ResolvePipelineSubscriptions(ctx context.Context, lookup SubscriptionLookup, pipelines ...*types.Pipeline) ([]string, error)

func RunStep

func RunStep(id graph.Identifier, s types.Step, ctx context.Context, executionTarget ExecutionTarget, options *StepRunOptions, state *ExecutionState) (Output, DetailsProducer, error)

Types

type ARMExecutionDetails

type ARMExecutionDetails struct {
	Operations []Operation `json:"operations,omitempty"`
}

type ArmOutput

type ArmOutput map[string]any

func (ArmOutput) GetValue

func (o ArmOutput) GetValue(key string) (*OutPutValue, error)

type BaseRunOptions

type BaseRunOptions struct {
	Cloud                    string
	Configuration            configtypes.Configuration
	NoPersist                bool
	DeploymentTimeoutSeconds int
	StepCacheDir             string
	BicepClient              *bicep.LSPClient

	SkipBicepparamValidation bool

	SubscriptionIdToAzureConfigDirectory map[string]string
}

type DetailsProducer

type DetailsProducer func(ctx context.Context) (*ExecutionDetails, error)

func DetermineOperationsForResourceGroupDeployment

func DetermineOperationsForResourceGroupDeployment(getClient OperationsClientGetter, subscriptionID, resourceGroup, deploymentName string) DetailsProducer

func DetermineOperationsForSubscriptionDeployment

func DetermineOperationsForSubscriptionDeployment(getClient OperationsClientGetter, subscriptionID, deploymentName string) DetailsProducer

type ExecutionDetails

type ExecutionDetails struct {
	ARM *ARMExecutionDetails `json:"arm,omitempty"`
}

type ExecutionInfo

type ExecutionInfo struct {
	QueuedAt   string `json:"queuedAt"`
	StartedAt  string `json:"startedAt"`
	FinishedAt string `json:"finishedAt"`
	Preempted  bool   `json:"preempted"`
	RunCount   int    `json:"runCount"`
	State      string `json:"state"`
}

type ExecutionState

type ExecutionState struct {
	*sync.RWMutex

	Executed sets.Set[graph.Identifier]
	Queued   sets.Set[graph.Identifier]

	Timing  map[graph.Identifier]*ExecutionInfo
	Details map[graph.Identifier]*ExecutionDetails
	Logging map[graph.Identifier][]byte
	// contains filtered or unexported fields
}

func NewExecutionState

func NewExecutionState() *ExecutionState

func RunEntrypoint

func RunEntrypoint(topo *topology.CombinedTopology, entrypoint *topology.Entrypoint, pipelines map[string]*types.Pipeline, ctx context.Context, options *PipelineRunOptions, executor Executor) (*ExecutionState, error)

func RunPipeline

func RunPipeline(service *topology.Service, pipeline *types.Pipeline, ctx context.Context, options *PipelineRunOptions, executor Executor) (*ExecutionState, error)

func RunStampedPipeline

func RunStampedPipeline(service *topology.Service, pipeline *types.Pipeline, ctx context.Context, options *PipelineRunOptions, executor Executor) (*ExecutionState, error)

func (*ExecutionState) GetOutputs

func (s *ExecutionState) GetOutputs(stamp graph.Stamp) Outputs

GetOutputs returns a snapshot of outputs for the given stamp. For stamped nodes, the stamp layer is merged over the base layer (stamp wins on conflict). During concurrent execution, caller must hold state.RLock() or state.Lock().

func (*ExecutionState) RecordOutput

func (s *ExecutionState) RecordOutput(node graph.Identifier, output Output)

RecordOutput stores step output in the correct layer. Stamped nodes write to stampOutputs[stamp], unstamped to outputs. Caller must hold state.Lock() (write lock).

type ExecutionTarget

type ExecutionTarget interface {
	GetSubscriptionID() string
	GetResourceGroup() string
	GetRegion() string
}

type Executor

type Executor func(id graph.Identifier, s types.Step, ctx context.Context, executionTarget ExecutionTarget, options *StepRunOptions, state *ExecutionState) (Output, DetailsProducer, error)

type Identifier

type Identifier struct {
	ServiceGroup  string `json:"serviceGroup"`
	ResourceGroup string `json:"resourceGroup"`
	Step          string `json:"step"`
}

func (Identifier) String

func (i Identifier) String() string

type InspectOptions

type InspectOptions struct {
	Scope          string
	Format         string
	Step           string
	Region         string
	Configuration  configtypes.Configuration
	ScopeFunctions map[string]StepInspectScope
	OutputFile     io.Writer
	Concurrency    int

	Service           *topology.Service
	TopoDirLookupFunc TopoDirLookup
}

InspectOptions contains the options for the Inspect method

type NodeInfo

type NodeInfo struct {
	Identifier Identifier        `json:"identifier"`
	Info       ExecutionInfo     `json:"info"`
	Details    *ExecutionDetails `json:"details,omitempty"`
}

type Operation

type Operation struct {
	// OperationType is what the operation did - known values: "Create", "Read", "EvaluateDeploymentOutput"
	OperationType string `json:"operationType"`

	// StartTimestamp is the time at which the operation started, formatted as RFC3339 date+time: 2025-11-05T13:16:20.624264+00:00
	StartTimestamp string `json:"startTimestamp"`
	// Duration is the time taken to run the operation, formatted as RFC3339 duration: PT3M12.9884364S
	Duration string `json:"duration"`

	// Resource defines the object of this operation.
	Resource *Resource `json:"resource,omitempty"`

	// Children holds the child operations when the resource is another deployment.
	Children []Operation `json:"children,omitempty"`
}

Operation describes an ARM deployment rollout operation taken to realize a template.

type OperationsClientGetter

type OperationsClientGetter func(subscriptionID string) (*armresources.DeploymentOperationsClient, error)

OperationsClientGetter returns a DeploymentOperationsClient for the given subscription ID. Implementations should cache clients to avoid redundant authentication.

func NewCachedOperationsClientGetter

func NewCachedOperationsClientGetter(subscriptionID string, defaultClient *armresources.DeploymentOperationsClient, cred azcore.TokenCredential, opts *azcorearm.ClientOptions) OperationsClientGetter

NewCachedOperationsClientGetter creates an OperationsClientGetter that caches clients per subscription. The provided defaultClient is used for the given subscriptionID; clients for other subscriptions are created lazily using the provided credential.

type OutPutValue

type OutPutValue struct {
	Type  string `json:"type"`
	Value any    `json:"value"`
}

type Output

type Output interface {
	GetValue(key string) (*OutPutValue, error)
}

type Outputs

type Outputs map[string]map[string]map[string]Output

Outputs stores output values indexed by service group, resource group and step name.

type PipelineRunOptions

type PipelineRunOptions struct {
	BaseRunOptions

	Step                  string
	Region                string
	Environment           string
	Stamp                 string
	SubsciptionLookupFunc SubscriptionLookup

	TopoDirLookupFunc TopoDirLookup
	Concurrency       int

	TimingOutputFile string
	JUnitOutputFile  string

	AbortIfRegionalExist bool
	RegionRGNames        []string // Specific RG names to check for concurrent execution prevention

	StampConfigs   map[graph.Stamp]configtypes.Configuration
	StampPipelines map[graph.Stamp]map[string]*types.Pipeline
}

type Resource

type Resource struct {
	// ResourceType is the resource provider and resource name, like "Microsoft.KeyVault/vaults".
	ResourceType string `json:"resourceType"`
	// SubscriptionID is the Azure subscription in which the resource exists.
	// Not serialized to avoid leaking sensitive identifiers into published artifacts.
	SubscriptionID string `json:"-"`
	// ResourceGroup is the Azure resource group in which the resource exists.
	ResourceGroup string `json:"resourceGroup"`
	// Name is the name of the resource.
	Name string `json:"name"`
}

type ShellOutput

type ShellOutput string

func (ShellOutput) GetValue

func (o ShellOutput) GetValue(_ string) (*OutPutValue, error)

type StepRunOptions

type StepRunOptions struct {
	BaseRunOptions
	PipelineDirectory string
	RetryAttempt      int // 0 for first attempt, >0 for retries
	Environment       string
	Stamp             string
}

type SubscriptionLookup

type SubscriptionLookup func(ctx context.Context, subscriptionName string) (string, error)

func LookupSubscriptionID

func LookupSubscriptionID(subscriptions map[string]string) SubscriptionLookup

type TopoDirLookup

type TopoDirLookup func(serviceGroup string) (string, error)

Jump to

Keyboard shortcuts

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