Documentation
¶
Overview ¶
Package deploycontext holds the pure rules for deploy contexts: which context a deploy runs in and how env and build settings resolve across the branch override, context and app default layers.
Index ¶
- Constants
- func BranchContext(pattern string) string
- func BranchPattern(name string) (string, bool)
- func For(prNumber int, branch, productionBranch string) string
- func Match(branch, pattern string) bool
- func Validate(name string) error
- type BranchOverride
- type Config
- type Effective
- type Entry
- type EnvValue
- type Inputs
- type Layer
- type Setting
Constants ¶
const ( Production = spec.ContextProduction DeployPreview = spec.ContextDeployPreview BranchDeploy = spec.ContextBranchDeploy )
Context names. Production is the app's own settings and has no stored row.
const ( SourceApp = "app" SourceLegacyPreview = "preview-env" SourceContext = "context" SourceBranchContext = "branch-context" SourceBranchOverride = "branch-env" )
Sources reported for each resolved value, lowest to highest precedence.
const MaskedValue = "********"
MaskedValue replaces a secret's value in every effective view.
Variables ¶
This section is empty.
Functions ¶
func BranchContext ¶
BranchContext names the per-branch context for a branch pattern.
func BranchPattern ¶
BranchPattern returns the pattern of a "branch:<pattern>" context.
func For ¶
For picks the context a deploy runs in: a pull request preview is deploy-preview, any other non-production deploy is branch-deploy.
Types ¶
type BranchOverride ¶
BranchOverride is one branch-scoped env override (secrets carry no value).
type Config ¶
type Config = spec.ContextOverrides
Config is the settings one context can override. Empty fields inherit.
type Effective ¶
type Effective struct {
Context string `json:"context"`
Env []Entry `json:"env"`
BuildCommand Setting `json:"build_command"`
Publish Setting `json:"publish_dir"`
BuildArgs map[string]Setting `json:"build_args,omitempty"`
}
Effective is the resolved config for one deploy. Secret values are masked.
type Entry ¶
type Entry struct {
Key string `json:"key"`
Value string `json:"value"`
Secret bool `json:"secret"`
Source string `json:"source"`
}
Entry is one resolved env var with where it came from.
type Inputs ¶
type Inputs struct {
Context string
Branch string
AppEnv map[string]EnvValue
LegacyPreview map[string]string
Contexts map[string]Config
BranchEnv []BranchOverride
AppBuild Config
}
Inputs are every layer the resolver reads for one deploy.