Documentation
¶
Overview ¶
Package build converts parsed app config into ctl-api database models. Both the HTTP handlers and the branch-sync DB syncer call it, so the two sync paths cannot drift. Builders are pure; the caller resolves anything needing a database.
Index ¶
- func ActionWorkflowConfig(in ActionWorkflowInput) *app.ActionWorkflowConfig
- func AppInputs(inputs []AppInputInput, cfg *app.AppInputConfig) ([]app.AppInput, error)
- func AttachTypeConfig(ccc *app.ComponentConfigConnection, comp *config.Component, vcs VCS, ...) error
- func BreakGlassConfig(appID, appConfigID string, roles []*config.AppAWSIAMRole) (*app.AppBreakGlassConfig, error)
- func ComponentChecksum(comp *config.Component) (string, error)
- func ComponentConnection(in ComponentConnectionInput) (*app.ComponentConfigConnection, error)
- func ComponentOverrideInputCopy(syn config.SyntheticOverrideInput) (description, displayName string)
- func ComponentRepos(comp *config.Component) (*config.ConnectedRepoConfig, *config.PublicRepoConfig)
- func DerefMap(in map[string]*string) map[string]string
- func DockerBuildComponentConfig(obj *config.DockerBuildComponentConfig, vcs VCS) (*app.DockerBuildComponentConfig, error)
- func ExternalImageComponentConfig(obj *config.ExternalImageComponentConfig) (*app.ExternalImageComponentConfig, error)
- func HelmComponentConfig(obj *config.HelmChartComponentConfig, vcs VCS) (*app.HelmComponentConfig, error)
- func Hstore(in map[string]string) pgtype.Hstore
- func IAMPolicies(policies []config.AppAWSIAMPolicy, appConfigID string) []app.AppAWSIAMPolicyConfig
- func IAMRole(role *config.AppAWSIAMRole, appConfigID string, roleType app.AWSIAMRoleType) app.AppAWSIAMRoleConfig
- func IAMRoles(roles []*config.AppAWSIAMRole, appConfigID string, roleType app.AWSIAMRoleType) []app.AppAWSIAMRoleConfig
- func InputConfig(groups []InputGroupInput, appID, appConfigID, orgID string) *app.AppInputConfig
- func InputsFromConfig(cfg *config.AppConfig) ([]InputGroupInput, []AppInputInput)
- func JobComponentConfig(obj *config.JobComponentConfig) (*app.JobComponentConfig, error)
- func KubernetesContextsConfig(contexts []KubernetesContextInput, componentIDByName map[string]string, ...) (*app.AppKubernetesContextsConfig, error)
- func KubernetesManifestComponentConfig(obj *config.KubernetesManifestComponentConfig, vcs VCS) (*app.KubernetesManifestComponentConfig, error)
- func NamedIAMPolicies(policies []config.NamedIAMPolicy, appConfigID string) []app.AppNamedIAMPolicyConfig
- func NeedsTerraformVersion(comp *config.Component) bool
- func OperationRoleConfig(appID, appConfigID string) *app.AppOperationRoleConfig
- func OperationRoleRules(rules []OperationRoleRuleInput, configID string) ([]*app.AppOperationRoleRule, error)
- func OperationRoles(roles []config.EntityOperationRole) pgtype.Hstore
- func PermissionsConfig(in PermissionsInput) (*app.AppPermissionsConfig, error)
- func PoliciesConfig(policies []PolicyInput, appID, appConfigID string) (*app.AppPoliciesConfig, error)
- func PulumiComponentConfig(obj *config.PulumiComponentConfig, vcs VCS) (*app.PulumiComponentConfig, error)
- func RequiresFreshBuild(ccc *app.ComponentConfigConnection) bool
- func ResolveSandboxType(sandboxType, terraformVersion, runtime string) (string, error)
- func RunnerConfig(in RunnerInput) *app.AppRunnerConfig
- func SandboxConfig(in SandboxInput) (*app.AppSandboxConfig, error)
- func SecretsConfig(secrets []SecretInput, appID, appConfigID string) (*app.AppSecretsConfig, error)
- func StackConfig(stack *config.StackConfig, appID, appConfigID string) (*app.AppStackConfig, error)
- func TerraformModuleComponentConfig(obj *config.TerraformModuleComponentConfig, vcs VCS, version string) (*app.TerraformModuleComponentConfig, error)
- func ValidateAzureBuiltInRoles(roleName string, policies []config.AppAWSIAMPolicy) error
- func ValidateInlinePolicyContents(roles []app.AppAWSIAMRoleConfig) error
- func ValidateNamedIAMPolicies(in PermissionsInput, roles []app.AppAWSIAMRoleConfig) error
- func ValidateOperationRoles(roles []config.EntityOperationRole) error
- func ValidatePolicyMutualExclusivity(roleName string, policies []config.AppAWSIAMPolicy) error
- type ActionWorkflowInput
- type AppInputInput
- type ComponentConnectionInput
- type InputGroupInput
- type KubernetesContextInput
- type OperationRoleRuleInput
- type PermissionsInput
- type PolicyInput
- type RunnerInput
- type SandboxInput
- type SecretInput
- type VCS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionWorkflowConfig ¶
func ActionWorkflowConfig(in ActionWorkflowInput) *app.ActionWorkflowConfig
ActionWorkflowConfig builds the row; the caller attaches triggers and steps.
func AppInputs ¶
func AppInputs(inputs []AppInputInput, cfg *app.AppInputConfig) ([]app.AppInput, error)
AppInputs resolves each input's group name to the ID assigned on insert.
func AttachTypeConfig ¶
func AttachTypeConfig(ccc *app.ComponentConfigConnection, comp *config.Component, vcs VCS, terraformVersion string) error
AttachTypeConfig wires the per-type config onto the shared connection.
func BreakGlassConfig ¶
func BreakGlassConfig(appID, appConfigID string, roles []*config.AppAWSIAMRole) (*app.AppBreakGlassConfig, error)
func ComponentChecksum ¶ added in v0.19.1102
ComponentChecksum hashes the resolved component. Sync compares this against the checksum on the previous config connection to decide whether a component changed, so it must cover everything that resolution folded in — vars from other files, interpolated values — not just the component's own file. The config's own Checksum field is a per-file hash and misses those.
func ComponentConnection ¶
func ComponentConnection(in ComponentConnectionInput) (*app.ComponentConfigConnection, error)
ComponentConnection validates and builds the shared connection; the caller attaches the per-type config before persisting.
func ComponentOverrideInputCopy ¶
func ComponentOverrideInputCopy(syn config.SyntheticOverrideInput) (description, displayName string)
func ComponentRepos ¶
func ComponentRepos(comp *config.Component) (*config.ConnectedRepoConfig, *config.PublicRepoConfig)
ComponentRepos returns the git sources from whichever type config is set.
func DockerBuildComponentConfig ¶
func DockerBuildComponentConfig(obj *config.DockerBuildComponentConfig, vcs VCS) (*app.DockerBuildComponentConfig, error)
func ExternalImageComponentConfig ¶
func ExternalImageComponentConfig(obj *config.ExternalImageComponentConfig) (*app.ExternalImageComponentConfig, error)
func HelmComponentConfig ¶
func HelmComponentConfig(obj *config.HelmChartComponentConfig, vcs VCS) (*app.HelmComponentConfig, error)
func IAMPolicies ¶
func IAMPolicies(policies []config.AppAWSIAMPolicy, appConfigID string) []app.AppAWSIAMPolicyConfig
func IAMRole ¶
func IAMRole(role *config.AppAWSIAMRole, appConfigID string, roleType app.AWSIAMRoleType) app.AppAWSIAMRoleConfig
func IAMRoles ¶
func IAMRoles(roles []*config.AppAWSIAMRole, appConfigID string, roleType app.AWSIAMRoleType) []app.AppAWSIAMRoleConfig
func InputConfig ¶
func InputConfig(groups []InputGroupInput, appID, appConfigID, orgID string) *app.AppInputConfig
InputConfig builds the config and its groups; inputs attach separately since they need the group IDs assigned on insert.
func InputsFromConfig ¶
func InputsFromConfig(cfg *config.AppConfig) ([]InputGroupInput, []AppInputInput)
InputsFromConfig also materializes the reserved per-component override inputs: they must exist as app inputs for the install-input system to accept the values the install config carries under [components.<name>].
func JobComponentConfig ¶
func JobComponentConfig(obj *config.JobComponentConfig) (*app.JobComponentConfig, error)
func KubernetesContextsConfig ¶
func KubernetesContextsConfig(contexts []KubernetesContextInput, componentIDByName map[string]string, appID, appConfigID string) (*app.AppKubernetesContextsConfig, error)
KubernetesContextsConfig resolves each context's source component name against componentIDByName, which the caller looks up. The name is persisted alongside the ID so the binding stays intelligible if the component is renamed.
func KubernetesManifestComponentConfig ¶
func KubernetesManifestComponentConfig(obj *config.KubernetesManifestComponentConfig, vcs VCS) (*app.KubernetesManifestComponentConfig, error)
func NamedIAMPolicies ¶ added in v0.19.1178
func NamedIAMPolicies(policies []config.NamedIAMPolicy, appConfigID string) []app.AppNamedIAMPolicyConfig
func NeedsTerraformVersion ¶
NeedsTerraformVersion means the caller must resolve the latest release.
func OperationRoleConfig ¶
func OperationRoleConfig(appID, appConfigID string) *app.AppOperationRoleConfig
func OperationRoleRules ¶
func OperationRoleRules(rules []OperationRoleRuleInput, configID string) ([]*app.AppOperationRoleRule, error)
OperationRoleRules validates and builds the rules for an already-persisted operation role config.
func OperationRoles ¶
func OperationRoles(roles []config.EntityOperationRole) pgtype.Hstore
func PermissionsConfig ¶
func PermissionsConfig(in PermissionsInput) (*app.AppPermissionsConfig, error)
func PoliciesConfig ¶
func PoliciesConfig(policies []PolicyInput, appID, appConfigID string) (*app.AppPoliciesConfig, error)
func PulumiComponentConfig ¶
func PulumiComponentConfig(obj *config.PulumiComponentConfig, vcs VCS) (*app.PulumiComponentConfig, error)
func RequiresFreshBuild ¶ added in v0.19.1102
func RequiresFreshBuild(ccc *app.ComponentConfigConnection) bool
RequiresFreshBuild reports whether a component must build even when its config is unchanged. An external image with an update_policy resolves tags against the registry at build time, so an unchanged config does not imply an unchanged artifact; the runner no-ops when the digest matches.
func ResolveSandboxType ¶
ResolveSandboxType defaults to terraform and enforces per-type required fields.
func RunnerConfig ¶
func RunnerConfig(in RunnerInput) *app.AppRunnerConfig
func SandboxConfig ¶
func SandboxConfig(in SandboxInput) (*app.AppSandboxConfig, error)
func SecretsConfig ¶
func SecretsConfig(secrets []SecretInput, appID, appConfigID string) (*app.AppSecretsConfig, error)
func StackConfig ¶
func StackConfig(stack *config.StackConfig, appID, appConfigID string) (*app.AppStackConfig, error)
func TerraformModuleComponentConfig ¶
func TerraformModuleComponentConfig(obj *config.TerraformModuleComponentConfig, vcs VCS, version string) (*app.TerraformModuleComponentConfig, error)
func ValidateAzureBuiltInRoles ¶ added in v0.19.1125
func ValidateAzureBuiltInRoles(roleName string, policies []config.AppAWSIAMPolicy) error
ValidateAzureBuiltInRoles rejects a built-in role that cannot be resolved to a definition GUID. ARM assignments reference a definition by GUID with no name lookup, and the renderer forwards an unresolvable value verbatim -- so a typo, or a real role absent from the name map, passes sync and generation and instead fails the customer's stack deployment with InvalidRoleDefinitionId. Catch it here, where the error can name the offending value.
func ValidateInlinePolicyContents ¶
func ValidateInlinePolicyContents(roles []app.AppAWSIAMRoleConfig) error
ValidateInlinePolicyContents rejects malformed inline policies at sync; the AWS Terraform path would otherwise render them empty and under-permission the runner at apply time.
func ValidateNamedIAMPolicies ¶ added in v0.19.1178
func ValidateNamedIAMPolicies(in PermissionsInput, roles []app.AppAWSIAMRoleConfig) error
func ValidateOperationRoles ¶
func ValidateOperationRoles(roles []config.EntityOperationRole) error
ValidateOperationRoles fails a typo at sync rather than never matching a role.
func ValidatePolicyMutualExclusivity ¶
func ValidatePolicyMutualExclusivity(roleName string, policies []config.AppAWSIAMPolicy) error
ValidatePolicyMutualExclusivity rejects two grant mechanisms for one cloud: the renderers would silently pick one and under-permission the role.
Types ¶
type ActionWorkflowInput ¶
type AppInputInput ¶
type ComponentConnectionInput ¶
type ComponentConnectionInput struct {
ComponentID string
AppConfigID string
References []string
Checksum string
DependencyIDs []string
BuildTimeout string
DeployTimeout string
MaxAutoRetries *int
SkipNoops *bool
Toggleable *bool
DefaultEnabled *bool
AutoApproveOnPoliciesPassing *bool
DriftSchedule *string
HealthEnabled *bool
HealthStabilizationWindow string
HealthBlockDeploy *bool
HealthProbes []config.ComponentHealthProbeConfig
HealthRequiredChecks []string
OperationRoles []config.EntityOperationRole
KubernetesContextName string
}
ComponentConnectionInput is everything that lands on ComponentConfigConnection rather than on the per-type config row.
func ComponentConnectionInputFromConfig ¶
func ComponentConnectionInputFromConfig(comp *config.Component, componentID, appConfigID string, dependencyIDs []string) (ComponentConnectionInput, error)
ComponentConnectionInputFromConfig is the single place that knows which shared connection fields each component type exposes.
type InputGroupInput ¶
type KubernetesContextInput ¶
func KubernetesContextInputsFromConfig ¶
func KubernetesContextInputsFromConfig(contexts *config.KubernetesContextsConfig) []KubernetesContextInput
type OperationRoleRuleInput ¶
type OperationRoleRuleInput struct {
Principal string
Operation app.OperationType
Role string
}
func OperationRoleRuleInputsFromConfig ¶
func OperationRoleRuleInputsFromConfig(roles *config.OperationRolesConfig) []OperationRoleRuleInput
type PermissionsInput ¶
type PermissionsInput struct {
AppID string
AppConfigID string
Permissions *config.PermissionsConfig
// Also written onto the permissions config so the rows are reachable from
// both owners, matching the CLI sync path.
BreakGlassRoles []*config.AppAWSIAMRole
// StackType is the app stack.toml type. Named policies are CloudFormation-only.
StackType string
}
type PolicyInput ¶
type PolicyInput struct {
Type config.AppPolicyType
Engine config.AppPolicyEngine
Name string
Description string
Contents string
Components []string
}
func PolicyInputsFromConfig ¶
func PolicyInputsFromConfig(policies *config.PoliciesConfig) []PolicyInput
PolicyInputsFromConfig leaves Description empty: it has no config form.
type RunnerInput ¶
type RunnerInput struct {
AppID string
AppConfigID string
Type string
HelmDriver string
EnvVars map[string]string
InitScriptURL string
InstanceType string
RunnerAPIURL string
PublicAPIURL string
PhoneHomeScriptURL string
}
func RunnerInputFromConfig ¶
func RunnerInputFromConfig(runner config.AppRunnerConfig, appID, appConfigID string) RunnerInput
type SandboxInput ¶
type SandboxInput struct {
AppID string
AppConfigID string
Type string
TerraformVersion string
Runtime string
PulumiVersion string
PulumiConfig map[string]string
Variables map[string]string
EnvVars map[string]string
VariablesFiles []string
References []string
OperationRoles []config.EntityOperationRole
DriftSchedule *string
MaxAutoRetries *int
SkipNoops *bool
AutoApproveOnPoliciesPassing *bool
GithubVCSConfig *app.ConnectedGithubVCSConfig
PublicGitVCSConfig *app.PublicGitVCSConfig
}
func SandboxInputFromConfig ¶
func SandboxInputFromConfig(sandbox *config.AppSandboxConfig, appID, appConfigID string) SandboxInput
type SecretInput ¶
type SecretInput struct {
Name string
DisplayName string
Description string
Required bool
AutoGenerate bool
Format string
Default string
KubernetesSync bool
KubernetesSecretNamespace string
KubernetesSecretName string
KubernetesSyncTargets []config.KubernetesSyncTarget
}
func SecretInputsFromConfig ¶
func SecretInputsFromConfig(secrets *config.SecretsConfig) []SecretInput
SecretInputsFromConfig enables sync from the legacy flag or any v2 target.
type VCS ¶
type VCS struct {
Github *app.ConnectedGithubVCSConfig
Public *app.PublicGitVCSConfig
}
VCS carries git sources the caller already resolved, which needs a database.