Documentation
¶
Overview ¶
A projen construct that generates GitHub Actions workflows for CDK deployments with GitHub Environments, parallel stages, versioned assemblies, and manual rollback.
Index ¶
- func NewCdkDeployDispatchWorkflow_Override(c CdkDeployDispatchWorkflow, project interface{}, ...)
- func NewCdkDeployPipeline_Override(c CdkDeployPipeline, project interface{}, options *CdkDeployPipelineOptions)
- type AwsEnvironment
- type CdkDeployDispatchWorkflow
- type CdkDeployPipeline
- type CdkDeployPipelineOptions
- type DeployDispatchInternalOptions
- type DeployStageOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCdkDeployDispatchWorkflow_Override ¶
func NewCdkDeployDispatchWorkflow_Override(c CdkDeployDispatchWorkflow, project interface{}, options *DeployDispatchInternalOptions)
func NewCdkDeployPipeline_Override ¶
func NewCdkDeployPipeline_Override(c CdkDeployPipeline, project interface{}, options *CdkDeployPipelineOptions)
Types ¶
type AwsEnvironment ¶
type AwsEnvironment struct {
// AWS account ID.
Account *string `field:"required" json:"account" yaml:"account"`
// AWS region.
Region *string `field:"required" json:"region" yaml:"region"`
}
AWS environment target for a deployment stage.
type CdkDeployDispatchWorkflow ¶
type CdkDeployDispatchWorkflow interface {
}
Generates a workflow_dispatch workflow for manual CDK deployments and rollbacks.
Allows deploying any previously published version of the cloud assembly to any configured environment. This enables: - Manual promotion between environments - Rollback to any previous version - Ad-hoc deployments outside the normal CI/CD flow.
func NewCdkDeployDispatchWorkflow ¶
func NewCdkDeployDispatchWorkflow(project interface{}, options *DeployDispatchInternalOptions) CdkDeployDispatchWorkflow
type CdkDeployPipeline ¶
type CdkDeployPipeline interface {
}
Generates GitHub Actions workflows for CDK deployments.
Creates a `deploy.yml` workflow with: - Synth job to compile and synthesize the CDK app - Asset publish job to upload Lambda/container assets to AWS - Per-stage deploy jobs with GitHub Environments, parallel execution, and concurrency groups
Optionally creates a `deploy-dispatch.yml` workflow for manual deployments and rollbacks.
func NewCdkDeployPipeline ¶
func NewCdkDeployPipeline(project interface{}, options *CdkDeployPipelineOptions) CdkDeployPipeline
type CdkDeployPipelineOptions ¶
type CdkDeployPipelineOptions struct {
// Default OIDC role ARN for AWS credential assumption.
IamRoleArn *string `field:"required" json:"iamRoleArn" yaml:"iamRoleArn"`
// npm scope for versioned cloud assembly packages (e.g., '@defiance-digital').
PkgNamespace *string `field:"required" json:"pkgNamespace" yaml:"pkgNamespace"`
// Stack name prefix.
//
// Stage names are appended with a dash (e.g., 'MyApp' -> 'MyApp-Production')
StackPrefix *string `field:"required" json:"stackPrefix" yaml:"stackPrefix"`
// Deployment stages in declaration order.
Stages *[]*DeployStageOptions `field:"required" json:"stages" yaml:"stages"`
// Branch that triggers deployments on push.
// Default: 'main'.
//
BranchName *string `field:"optional" json:"branchName" yaml:"branchName"`
// CDK CLI command prefix.
// Default: 'npx cdk'.
//
CdkCommand *string `field:"optional" json:"cdkCommand" yaml:"cdkCommand"`
// Default AWS region for OIDC credential assumption.
// Default: 'us-east-1'.
//
IamRoleRegion *string `field:"optional" json:"iamRoleRegion" yaml:"iamRoleRegion"`
// Package install command.
// Default: 'yarn install --check-files --frozen-lockfile'.
//
InstallCommand *string `field:"optional" json:"installCommand" yaml:"installCommand"`
// Generate a workflow_dispatch workflow for manual deployments and rollbacks.
// Default: true.
//
ManualDeployment *bool `field:"optional" json:"manualDeployment" yaml:"manualDeployment"`
// Node.js version for workflow runners.
// Default: '24.x'
//
NodeVersion *string `field:"optional" json:"nodeVersion" yaml:"nodeVersion"`
// Version and publish cloud assembly to GitHub Packages for rollback support.
// Default: true.
//
UseGithubPackagesForAssembly *bool `field:"optional" json:"useGithubPackagesForAssembly" yaml:"useGithubPackagesForAssembly"`
// Working directory for the CDK app, relative to the repository root.
//
// Useful for monorepos where infrastructure lives in a subdirectory (e.g., 'infra').
//
// When set, all workflow run steps will use `defaults.run.working-directory`
// and artifact paths will be adjusted accordingly.
// Default: - repository root.
//
WorkingDirectory *string `field:"optional" json:"workingDirectory" yaml:"workingDirectory"`
}
Configuration for the CDK deploy pipeline.
type DeployDispatchInternalOptions ¶
type DeployDispatchInternalOptions struct {
AppName *string `field:"required" json:"appName" yaml:"appName"`
CdkCommand *string `field:"required" json:"cdkCommand" yaml:"cdkCommand"`
IamRoleArn *string `field:"required" json:"iamRoleArn" yaml:"iamRoleArn"`
IamRoleRegion *string `field:"required" json:"iamRoleRegion" yaml:"iamRoleRegion"`
InstallCommand *string `field:"required" json:"installCommand" yaml:"installCommand"`
NodeVersion *string `field:"required" json:"nodeVersion" yaml:"nodeVersion"`
PkgNamespace *string `field:"required" json:"pkgNamespace" yaml:"pkgNamespace"`
StackPrefix *string `field:"required" json:"stackPrefix" yaml:"stackPrefix"`
Stages *[]*DeployStageOptions `field:"required" json:"stages" yaml:"stages"`
WorkingDirectory *string `field:"optional" json:"workingDirectory" yaml:"workingDirectory"`
}
Internal helper to build deploy dispatch workflow options from pipeline options.
Exported for use by CdkDeployDispatchWorkflow.
type DeployStageOptions ¶
type DeployStageOptions struct {
// AWS target environment (account + region).
Env *AwsEnvironment `field:"required" json:"env" yaml:"env"`
// Stage name (used as suffix in job IDs and stack names, e.g., 'Sandbox', 'Production').
Name *string `field:"required" json:"name" yaml:"name"`
// Stage names that must complete successfully before this stage runs.
//
// Stages with no dependsOn run in parallel after the publish-assets job.
//
// Example:
// ['Sandbox', 'Dev'] // waits for both before deploying
//
// Default: - depends only on publish-assets (runs as soon as assets are ready).
//
DependsOn *[]*string `field:"optional" json:"dependsOn" yaml:"dependsOn"`
// GitHub Environment name for protection rules, secrets scoping, and deployment approvals.
// Default: - uses the stage name.
//
Environment *string `field:"optional" json:"environment" yaml:"environment"`
// Override the default OIDC role ARN for this stage.
//
// Useful for cross-account deployments where each account has its own role.
IamRoleArn *string `field:"optional" json:"iamRoleArn" yaml:"iamRoleArn"`
// Override the default AWS region for OIDC credential assumption.
// Default: - uses the pipeline-level iamRoleRegion or the stage env.region
//
IamRoleRegion *string `field:"optional" json:"iamRoleRegion" yaml:"iamRoleRegion"`
// When true, this stage is excluded from the automatic deploy.yml pipeline and can only be deployed via the deploy-dispatch.yml workflow.
//
// Auto-deploy stages cannot depend on manual-approval stages.
// Default: false.
//
ManualApproval *bool `field:"optional" json:"manualApproval" yaml:"manualApproval"`
// Specific CDK stack names to deploy in this stage.
// Default: - ['{stackPrefix}-{stageName}'].
//
Stacks *[]*string `field:"optional" json:"stacks" yaml:"stacks"`
}
Configuration for a single deployment stage.