helpers

package
v0.19.1069 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppWorkflowsQueueName          = "app-workflows"
	AppSignalsQueueName            = "app-signals"
	AppWorkflowStepGroupsQueueName = "app-workflow-step-groups"
	AppWorkflowStepsQueueName      = "app-workflow-steps"
	AppGenerateStepsQueueName      = "app-generate-steps"
)
View Source
const AppBranchSandboxBuildsQueueName = "app-branch-sandbox-builds"

Variables

This section is empty.

Functions

func GetActionReferences

func GetActionReferences(cfg *app.AppConfig, action string) []refs.Ref

func GetComponentReferences

func GetComponentReferences(cfg *app.AppConfig, comp string) []refs.Ref

NOTE(jm): this is a function, because it is used directly within a workflow.

func GetFakeSandboxStackData added in v0.19.850

func GetFakeSandboxStackData(appCfg *app.AppConfig, region string, stateMap map[string]interface{}) map[string]any

GetFakeSandboxStackData builds a fake stack output map for sandbox mode orgs, using real keys from the app config with random fake values. stateMap is used to render templated role names (e.g. "{{.install.name}}-admin"). NOTE: this is a standalone function because it is used directly within workflows.

func GetStackReferences

func GetStackReferences(cfg *app.AppConfig) []refs.Ref

func IsEmail

func IsEmail(email string) bool

func PreloadAppActionWorkflowConfigs

func PreloadAppActionWorkflowConfigs(db *gorm.DB) *gorm.DB

preload action workflow configs

func PreloadAppBreakGlassConfig

func PreloadAppBreakGlassConfig(db *gorm.DB) *gorm.DB

break glass config

func PreloadAppConfigComponentConfigConnections

func PreloadAppConfigComponentConfigConnections(db *gorm.DB) *gorm.DB

component config connections

func PreloadAppConfigInputConfig

func PreloadAppConfigInputConfig(db *gorm.DB) *gorm.DB

input config

func PreloadAppConfigKubernetesContextsConfig added in v0.19.1025

func PreloadAppConfigKubernetesContextsConfig(db *gorm.DB) *gorm.DB

kubernetes contexts config

func PreloadAppConfigPermissionsConfig

func PreloadAppConfigPermissionsConfig(db *gorm.DB) *gorm.DB

permissions config

func PreloadAppConfigPolicyConfig

func PreloadAppConfigPolicyConfig(db *gorm.DB) *gorm.DB

policies config

func PreloadAppConfigRunnerConfig

func PreloadAppConfigRunnerConfig(db *gorm.DB) *gorm.DB

runner config

func PreloadAppConfigSandboxConfig

func PreloadAppConfigSandboxConfig(db *gorm.DB) *gorm.DB

sandbox config

func PreloadAppConfigStackConfig

func PreloadAppConfigStackConfig(db *gorm.DB) *gorm.DB

cloudformation stack config

func PreloadAppOperationRoleConfig added in v0.19.807

func PreloadAppOperationRoleConfig(db *gorm.DB) *gorm.DB

component role config

func PreloadAppSecretsConfig

func PreloadAppSecretsConfig(db *gorm.DB) *gorm.DB

secrets config

func PreloadComponentConfigConnections

func PreloadComponentConfigConnections(db *gorm.DB) *gorm.DB

component config connections

Types

type BranchForLabels added in v0.19.1049

type BranchForLabels struct {
	Branch *app.AppBranch
	Group  *app.AppBranchInstallGroup
}

type CreateAppBranchRunRequest added in v0.19.850

type CreateAppBranchRunRequest struct {
	AppBranchID       string
	AppBranchConfigID string
	AppConfigID       string
	Force             bool
	RunType           app.AppBranchRunType
	PlanOnly          bool
	EventType         string
	PRNumber          *int
	HeadSHA           string
	BaseBranch        string
	Labels            labels.Labels
}

type Helpers

type Helpers struct {
	// contains filtered or unexported fields
}

func New

func New(params Params) *Helpers

func (*Helpers) CliVerisionAllowed

func (h *Helpers) CliVerisionAllowed(ctx context.Context, version string) (bool, error)

func (*Helpers) CreateAppBranch

func (h *Helpers) CreateAppBranch(
	ctx context.Context,
	appID string,
	name string,
	opts ...app.AppBranchManagedBy,
) (*app.AppBranch, error)

func (*Helpers) CreateAppBranchConfig added in v0.19.850

func (h *Helpers) CreateAppBranchConfig(
	ctx context.Context,
	appBranchID string,
	connectedGithubVCSConfig *app.ConnectedGithubVCSConfig,
	publicGitVCSConfig *app.PublicGitVCSConfig,
	installGroups []app.AppBranchInstallGroup,
) (*app.AppBranchConfig, error)

func (*Helpers) CreateAppBranchRun added in v0.19.850

func (h *Helpers) CreateAppBranchRun(ctx context.Context, req *CreateAppBranchRunRequest) (*app.AppBranchRun, error)

func (*Helpers) CreateAppSandboxQueue added in v0.19.850

func (h *Helpers) CreateAppSandboxQueue(ctx context.Context, appID string) error

CreateAppSandboxQueue creates a Temporal queue for the app's sandbox build workflow. This enables sandbox-build signals to be enqueued and processed against the app.

func (*Helpers) CreateAppWorkflow added in v0.19.903

func (s *Helpers) CreateAppWorkflow(ctx context.Context,
	appID string,
	workflowType app.WorkflowType,
	metadata map[string]string,
	planOnly bool,
) (*app.Workflow, error)

func (*Helpers) CreateWorkflow

func (s *Helpers) CreateWorkflow(ctx context.Context,
	appBranchID string,
	workflowType app.WorkflowType,
	metadata map[string]string,
	planOnly bool,
) (*app.Workflow, error)

func (*Helpers) DeactivateInstallBranchConnections added in v0.19.1049

func (h *Helpers) DeactivateInstallBranchConnections(ctx context.Context, installID string)

DeactivateInstallBranchConnections deactivates all active branch connections for an install and clears its app_branch_id.

func (*Helpers) DeleteAppComponent

func (s *Helpers) DeleteAppComponent(ctx context.Context, compID string) error

func (*Helpers) EnsureAppBranchQueue added in v0.19.850

func (h *Helpers) EnsureAppBranchQueue(ctx context.Context, branchID string) error

EnsureAppBranchQueue creates Temporal queue workflows for the given app branch. Safe to call multiple times — queueClient.Create is idempotent.

func (*Helpers) EnsureAppQueue added in v0.19.903

func (h *Helpers) EnsureAppQueue(ctx context.Context, appID string) error

EnsureAppQueue creates all Temporal queue workflows needed for an app to execute workflows through the shared flow infrastructure. Safe to call multiple times — queueClient.Create is idempotent.

func (*Helpers) FetchAppBranchesWithConfigs added in v0.19.850

func (h *Helpers) FetchAppBranchesWithConfigs(ctx context.Context, appID string) ([]app.AppBranch, error)

FetchAppBranchesWithConfigs retrieves all app branches for an app with their configs preloaded

func (*Helpers) FindBranchesMatchingLabels added in v0.19.1049

func (h *Helpers) FindBranchesMatchingLabels(ctx context.Context, appID string, lbls labels.Labels) ([]BranchForLabels, error)

FindBranchesMatchingLabels returns all app branches whose latest config has an install group with a label selector that matches the given labels.

func (*Helpers) GetAppComponents

func (s *Helpers) GetAppComponents(ctx context.Context, appID string) ([]app.Component, error)

func (*Helpers) GetAppComponentsAtConfigVersion

func (h *Helpers) GetAppComponentsAtConfigVersion(ctx context.Context, appID string, appCfgVersion int, componentIDs []string) ([]app.Component, error)

This returns all app components for a point in time

func (*Helpers) GetAppInstalls

func (s *Helpers) GetAppInstalls(ctx context.Context, appID string) ([]app.Install, error)

func (*Helpers) GetAppLatestConfig

func (h *Helpers) GetAppLatestConfig(ctx context.Context, appID string) (*app.AppConfig, error)

func (*Helpers) GetComponentDependents

func (h *Helpers) GetComponentDependents(ctx context.Context, appCfgID string, compID string) ([]string, error)

func (*Helpers) GetComponents

func (s *Helpers) GetComponents(ctx context.Context, compIDs []string) ([]app.Component, error)

func (*Helpers) GetConfigComponentDeployOrder

func (h *Helpers) GetConfigComponentDeployOrder(ctx context.Context, cfg *app.AppConfig, compID string) ([]string, error)

func (*Helpers) GetConfigDefaultComponentOrder

func (h *Helpers) GetConfigDefaultComponentOrder(ctx context.Context, cfg *app.AppConfig) ([]string, error)

func (*Helpers) GetConfigGraph

func (h *Helpers) GetConfigGraph(ctx context.Context, cfg *app.AppConfig) (graph.Graph[string, *app.Component], error)

GetConfigGraph builds a directed acyclic graph of component dependencies and returns both the graph and a sorted list of components in deployment order (dependencies first)

func (*Helpers) GetConfigReverseDefaultComponentOrder

func (h *Helpers) GetConfigReverseDefaultComponentOrder(ctx context.Context, cfg *app.AppConfig) ([]string, error)

func (*Helpers) GetFullAppConfig

func (h *Helpers) GetFullAppConfig(ctx context.Context, appConfigID string, skipAdditionalChecks bool) (*app.AppConfig, error)

func (*Helpers) GetPoliciesConfigByAppConfigID

func (h *Helpers) GetPoliciesConfigByAppConfigID(ctx context.Context, appConfigID string) (*app.AppPoliciesConfig, error)

func (*Helpers) GetReverseConfigComponentDeployOrder

func (h *Helpers) GetReverseConfigComponentDeployOrder(ctx context.Context, cfg *app.AppConfig, compID string) ([]string, error)

func (*Helpers) SyncInstallBranchConnection added in v0.19.1049

func (h *Helpers) SyncInstallBranchConnection(ctx context.Context, install *app.Install, branchID string)

SyncInstallBranchConnection ensures the install has an active connection to the given branch, deactivating any other active connections.

func (*Helpers) VCSHelpers added in v0.19.850

func (h *Helpers) VCSHelpers() *vcshelpers.Helpers

VCSHelpers returns the VCS helpers for git source resolution and token creation.

func (*Helpers) ValidateBranchConfigInstallsNotOnOtherBranch added in v0.19.1049

func (h *Helpers) ValidateBranchConfigInstallsNotOnOtherBranch(ctx context.Context, appID, branchID string, selectors []*labels.Selector) error

ValidateBranchConfigInstallsNotOnOtherBranch resolves installs from label selectors and checks none are already assigned to a different branch.

func (*Helpers) ValidateBranchConfigLabelUniqueness added in v0.19.1049

func (h *Helpers) ValidateBranchConfigLabelUniqueness(ctx context.Context, appID, excludeBranchID string, selectors []*labels.Selector) error

ValidateBranchConfigLabelUniqueness checks that no other branch (besides excludeBranchID) already uses the same label selector. This prevents two deployment plans from matching the same installs.

func (*Helpers) ValidateGraph

func (h *Helpers) ValidateGraph(ctx context.Context, appID string) error

func (*Helpers) ValidateInstallBranchExclusivity added in v0.19.1049

func (h *Helpers) ValidateInstallBranchExclusivity(ctx context.Context, install *app.Install, newLabels labels.Labels) error

ValidateInstallBranchExclusivity checks that an install would not end up on two branches after its labels are updated. It returns an error if the install is already on a branch and the new labels match a different branch's install group.

func (*Helpers) ValidateInstallIDsNotOnOtherBranch added in v0.19.1049

func (h *Helpers) ValidateInstallIDsNotOnOtherBranch(ctx context.Context, branchID string, installIDs []string) error

ValidateInstallIDsNotOnOtherBranch checks that installs referenced by explicit IDs are not already assigned to a different branch.

func (*Helpers) ValidateSameRepo added in v0.19.850

func (h *Helpers) ValidateSameRepo(
	branches []app.AppBranch,
	vcsConfigReq *vcshelpers.VCSConfigRequest,
) error

ValidateSameRepo validates that all app branches use the same repository as the provided request Accepts the VCS config request (before creation) to validate early If both publicRepoReq and connectedRepoReq are nil, returns early with no validation Branches with no VCS config (both nil) are ignored during validation

type Params

type Params struct {
	fx.In

	Cfg         *internal.Config
	GhClient    *github.Client
	DB          *gorm.DB `name:"psql"`
	V           *validator.Validate
	L           *zap.Logger
	VcsHelpers  *vcshelpers.Helpers
	QueueClient *queueclient.Client
}

Jump to

Keyboard shortcuts

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