Documentation
¶
Index ¶
- func BuildAndPush(ctx context.Context, cfg *config.DeployConfig, opts *DeployOptions) (string, error)
- func Deploy(ctx context.Context, opts *DeployOptions) error
- func EnvDiff(existing, merged map[string]string) []string
- func FormatLastDeploy(st *project.State) string
- func LastLocalDeploy(configPath, env string) string
- func MergedEnv(existing, declared map[string]string, secrets []string, ssmPrefix string) (map[string]string, bool)
- type DeployOptions
- type Deployer
- type Step
- type StepContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildAndPush ¶
func BuildAndPush(ctx context.Context, cfg *config.DeployConfig, opts *DeployOptions) (string, error)
BuildAndPush is the exported entry point for the standalone build command
func Deploy ¶
func Deploy(ctx context.Context, opts *DeployOptions) error
Deploy executes the deployment pipeline: citadel.yml's pipeline: block, or the default sequence (ssm-sync → build → cdk (--deploy-infra) → deploy → config-sync (lambda) → wait) when it has none. Every step is a named step of a project.Run (see openRun).
func EnvDiff ¶ added in v0.2.0
EnvDiff renders the added/changed keys between existing and merged as sorted, human-readable lines. Values under secret-looking keys are redacted; the CITADEL_* manifest vars are exempt (they hold names, not values). Keys only ever get added or changed — MergedEnv starts from existing, so nothing is removed.
func FormatLastDeploy ¶ added in v0.3.0
FormatLastDeploy renders a State as the two-line `citadel status` summary.
func LastLocalDeploy ¶ added in v0.3.0
LastLocalDeploy summarises .citadel/state/<env>.json next to configPath for `citadel status`. It returns "" when this checkout has no .citadel/ or has never deployed env. It never creates anything.
func MergedEnv ¶ added in v0.2.0
func MergedEnv(existing, declared map[string]string, secrets []string, ssmPrefix string) (map[string]string, bool)
MergedEnv builds the environment map to write to the function: the function's existing env (CDK-set keys survive), overlaid with the declared env: block (citadel keys win collisions), plus the secret manifest when any secrets are declared. changed reports whether merged differs from existing — callers skip the UpdateFunctionConfiguration call when it is false.
Types ¶
type DeployOptions ¶
type DeployOptions struct {
ConfigPath string
Environment string
EnvFile string
DeployInfra bool
SkipSSM bool
SkipConfig bool
DryRun bool
StreamLogs bool
Wait bool
TailLines int
Message string
Out io.Writer // where progress is written; nil means os.Stdout
Version string // citadel version, recorded in .citadel/project.yml
}
DeployOptions configures a deployment pipeline run
type Deployer ¶
type Deployer interface {
Update(ctx context.Context, w io.Writer, cfg *config.DeployConfig, env, imageURI string) error
WaitStable(ctx context.Context, w io.Writer, cfg *config.DeployConfig, env string) error
}
Deployer performs the runtime-specific "update to new image" step and an optional wait for the deployment to stabilize, writing progress to w.
type Step ¶ added in v0.4.0
type Step interface {
Name() string
// Plan runs right before the step and decides whether it runs. It may
// print to out and perform read-only checks (e.g. deploy's CDK-rollout
// check). true means skip: the step is recorded as skipped.
Plan(ctx context.Context, sc *StepContext, out io.Writer) (bool, error)
// Run performs the step, writing to w (terminal + the step's log file).
Run(ctx context.Context, sc *StepContext, w io.Writer) error
}
Step is one entry of a deploy pipeline.
type StepContext ¶ added in v0.4.0
type StepContext struct {
Cfg *config.DeployConfig
Opts *DeployOptions
Env string
Vars map[string]string
ImageURI string
SecretsUpdated int
Target string
// Before is the rollback snapshot: the ECS task-definition ARN or the
// Lambda image URI running before this deploy ("" when none was taken).
Before string
// Record closes the ~/.citadel/deployments.db row; set by the deploy step.
Record func(error)
// contains filtered or unexported fields
}
StepContext is the state shared by the steps of one deploy.