Documentation ¶
Index ¶
- func CodeBuildStep_Sequence(steps *[]Step) *[]Step
- func CodePipelineSource_Sequence(steps *[]Step) *[]Step
- func CodePipeline_IsConstruct(x interface{}) *bool
- func CodePipeline_IsPipeline(x interface{}) *bool
- func ConfirmPermissionsBroadening_Sequence(steps *[]Step) *[]Step
- func ManualApprovalStep_Sequence(steps *[]Step) *[]Step
- func NewArtifactMap_Override(a ArtifactMap)
- func NewCodeBuildStep_Override(c CodeBuildStep, id *string, props *CodeBuildStepProps)
- func NewCodePipelineSource_Override(c CodePipelineSource, id *string)
- func NewCodePipeline_Override(c CodePipeline, scope constructs.Construct, id *string, ...)
- func NewConfirmPermissionsBroadening_Override(c ConfirmPermissionsBroadening, id *string, ...)
- func NewDockerCredential_Override(d DockerCredential, usages *[]DockerCredentialUsage)
- func NewFileSet_Override(f FileSet, id *string, producer Step)
- func NewManualApprovalStep_Override(m ManualApprovalStep, id *string, props *ManualApprovalStepProps)
- func NewPipelineBase_Override(p PipelineBase, scope constructs.Construct, id *string, ...)
- func NewShellStep_Override(s ShellStep, id *string, props *ShellStepProps)
- func NewStackOutputsMap_Override(s StackOutputsMap, pipeline PipelineBase)
- func NewStep_Override(s Step, id *string)
- func NewWave_Override(w Wave, id *string, props *WaveProps)
- func PipelineBase_IsConstruct(x interface{}) *bool
- func PipelineBase_IsPipeline(x interface{}) *bool
- func ShellStep_Sequence(steps *[]Step) *[]Step
- func Step_Sequence(steps *[]Step) *[]Step
- type AddStageOpts
- type ArtifactMap
- type AssetType
- type CodeBuildOptions
- type CodeBuildStep
- type CodeBuildStepProps
- type CodeCommitSourceOptions
- type CodePipeline
- type CodePipelineActionFactoryResult
- type CodePipelineFileSet
- type CodePipelineProps
- type CodePipelineSource
- func CodePipelineSource_CodeCommit(repository awscodecommit.IRepository, branch *string, ...) CodePipelineSource
- func CodePipelineSource_Connection(repoString *string, branch *string, props *ConnectionSourceOptions) CodePipelineSource
- func CodePipelineSource_Ecr(repository awsecr.IRepository, props *ECRSourceOptions) CodePipelineSource
- func CodePipelineSource_GitHub(repoString *string, branch *string, props *GitHubSourceOptions) CodePipelineSource
- func CodePipelineSource_S3(bucket awss3.IBucket, objectKey *string, props *S3SourceOptions) CodePipelineSource
- type ConfirmPermissionsBroadening
- type ConnectionSourceOptions
- type DockerCredential
- func DockerCredential_CustomRegistry(registryDomain *string, secret awssecretsmanager.ISecret, ...) DockerCredential
- func DockerCredential_DockerHub(secret awssecretsmanager.ISecret, opts *ExternalDockerCredentialOptions) DockerCredential
- func DockerCredential_Ecr(repositories *[]awsecr.IRepository, opts *EcrDockerCredentialOptions) DockerCredential
- type DockerCredentialUsage
- type ECRSourceOptions
- type EcrDockerCredentialOptions
- type ExternalDockerCredentialOptions
- type FileSet
- type FileSetLocation
- type GitHubSourceOptions
- type ICodePipelineActionFactory
- type IFileSetProducer
- type ManualApprovalStep
- type ManualApprovalStepProps
- type PermissionsBroadeningCheckProps
- type PipelineBase
- type PipelineBaseProps
- type ProduceActionOptions
- type S3SourceOptions
- type ShellStep
- type ShellStepProps
- type StackAsset
- type StackDeployment
- type StackDeploymentProps
- type StackOutputReference
- type StackOutputsMap
- type StackSteps
- type StageDeployment
- type StageDeploymentProps
- type Step
- type Wave
- type WaveOptions
- type WaveProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CodeBuildStep_Sequence ¶ added in v2.4.0
Define a sequence of steps to be executed in order.
If you need more fine-grained step ordering, use the `addStepDependency()` API. For example, if you want `secondStep` to occur after `firstStep`, call `secondStep.addStepDependency(firstStep)`.
func CodePipelineSource_Sequence ¶ added in v2.4.0
Define a sequence of steps to be executed in order.
If you need more fine-grained step ordering, use the `addStepDependency()` API. For example, if you want `secondStep` to occur after `firstStep`, call `secondStep.addStepDependency(firstStep)`.
func CodePipeline_IsConstruct ¶
func CodePipeline_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CodePipeline_IsPipeline ¶ added in v2.38.0
func CodePipeline_IsPipeline(x interface{}) *bool
Return whether the given object extends `PipelineBase`.
We do attribute detection since we can't reliably use 'instanceof'.
func ConfirmPermissionsBroadening_Sequence ¶ added in v2.4.0
Define a sequence of steps to be executed in order.
If you need more fine-grained step ordering, use the `addStepDependency()` API. For example, if you want `secondStep` to occur after `firstStep`, call `secondStep.addStepDependency(firstStep)`.
func ManualApprovalStep_Sequence ¶ added in v2.4.0
Define a sequence of steps to be executed in order.
If you need more fine-grained step ordering, use the `addStepDependency()` API. For example, if you want `secondStep` to occur after `firstStep`, call `secondStep.addStepDependency(firstStep)`.
func NewArtifactMap_Override ¶
func NewArtifactMap_Override(a ArtifactMap)
func NewCodeBuildStep_Override ¶
func NewCodeBuildStep_Override(c CodeBuildStep, id *string, props *CodeBuildStepProps)
func NewCodePipelineSource_Override ¶
func NewCodePipelineSource_Override(c CodePipelineSource, id *string)
func NewCodePipeline_Override ¶
func NewCodePipeline_Override(c CodePipeline, scope constructs.Construct, id *string, props *CodePipelineProps)
func NewConfirmPermissionsBroadening_Override ¶
func NewConfirmPermissionsBroadening_Override(c ConfirmPermissionsBroadening, id *string, props *PermissionsBroadeningCheckProps)
func NewDockerCredential_Override ¶
func NewDockerCredential_Override(d DockerCredential, usages *[]DockerCredentialUsage)
func NewFileSet_Override ¶
func NewManualApprovalStep_Override ¶
func NewManualApprovalStep_Override(m ManualApprovalStep, id *string, props *ManualApprovalStepProps)
func NewPipelineBase_Override ¶
func NewPipelineBase_Override(p PipelineBase, scope constructs.Construct, id *string, props *PipelineBaseProps)
func NewShellStep_Override ¶
func NewShellStep_Override(s ShellStep, id *string, props *ShellStepProps)
func NewStackOutputsMap_Override ¶ added in v2.60.0
func NewStackOutputsMap_Override(s StackOutputsMap, pipeline PipelineBase)
func NewStep_Override ¶
func NewWave_Override ¶
func PipelineBase_IsConstruct ¶
func PipelineBase_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func PipelineBase_IsPipeline ¶ added in v2.38.0
func PipelineBase_IsPipeline(x interface{}) *bool
Return whether the given object extends `PipelineBase`.
We do attribute detection since we can't reliably use 'instanceof'.
func ShellStep_Sequence ¶ added in v2.4.0
Define a sequence of steps to be executed in order.
If you need more fine-grained step ordering, use the `addStepDependency()` API. For example, if you want `secondStep` to occur after `firstStep`, call `secondStep.addStepDependency(firstStep)`.
func Step_Sequence ¶ added in v2.4.0
Define a sequence of steps to be executed in order.
If you need more fine-grained step ordering, use the `addStepDependency()` API. For example, if you want `secondStep` to occur after `firstStep`, call `secondStep.addStepDependency(firstStep)`.
Types ¶
type AddStageOpts ¶
type AddStageOpts struct { // Additional steps to run after all of the stacks in the stage. // Default: - No additional steps. // Post *[]Step `field:"optional" json:"post" yaml:"post"` // Additional steps to run before any of the stacks in the stage. // Default: - No additional steps. // Pre *[]Step `field:"optional" json:"pre" yaml:"pre"` // Instructions for stack level steps. // Default: - No additional instructions. // StackSteps *[]*StackSteps `field:"optional" json:"stackSteps" yaml:"stackSteps"` }
Options to pass to `addStage`.
Example:
var pipeline codePipeline preprod := NewMyApplicationStage(this, jsii.String("PreProd")) prod := NewMyApplicationStage(this, jsii.String("Prod")) pipeline.AddStage(preprod, &AddStageOpts{ Post: []step{ pipelines.NewShellStep(jsii.String("Validate Endpoint"), &ShellStepProps{ Commands: []*string{ jsii.String("curl -Ssf https://my.webservice.com/"), }, }), }, }) pipeline.AddStage(prod, &AddStageOpts{ Pre: []*step{ pipelines.NewManualApprovalStep(jsii.String("PromoteToProd")), }, })
type ArtifactMap ¶
type ArtifactMap interface { // Return the matching CodePipeline artifact for a FileSet. ToCodePipeline(x FileSet) awscodepipeline.Artifact }
Translate FileSets to CodePipeline Artifacts.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" artifactMap := awscdk.Pipelines.NewArtifactMap()
func NewArtifactMap ¶
func NewArtifactMap() ArtifactMap
type CodeBuildOptions ¶
type CodeBuildOptions struct { // Partial build environment, will be combined with other build environments that apply. // Default: - Non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_7_0 // BuildEnvironment *awscodebuild.BuildEnvironment `field:"optional" json:"buildEnvironment" yaml:"buildEnvironment"` // Caching strategy to use. // Default: - No cache. // Cache awscodebuild.Cache `field:"optional" json:"cache" yaml:"cache"` // ProjectFileSystemLocation objects for CodeBuild build projects. // // A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, // and type of a file system created using Amazon Elastic File System. // Requires a vpc to be set and privileged to be set to true. // Default: - no file system locations. // FileSystemLocations *[]awscodebuild.IFileSystemLocation `field:"optional" json:"fileSystemLocations" yaml:"fileSystemLocations"` // Information about logs for CodeBuild projects. // // A CodeBuild project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both. // Default: - no log configuration is set. // Logging *awscodebuild.LoggingOptions `field:"optional" json:"logging" yaml:"logging"` // Partial buildspec, will be combined with other buildspecs that apply. // // The BuildSpec must be available inline--it cannot reference a file // on disk. // Default: - No initial BuildSpec. // PartialBuildSpec awscodebuild.BuildSpec `field:"optional" json:"partialBuildSpec" yaml:"partialBuildSpec"` // Policy statements to add to role. // Default: - No policy statements added to CodeBuild Project Role. // RolePolicy *[]awsiam.PolicyStatement `field:"optional" json:"rolePolicy" yaml:"rolePolicy"` // Which security group(s) to associate with the project network interfaces. // // Only used if 'vpc' is supplied. // Default: - Security group will be automatically created. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // Which subnets to use. // // Only used if 'vpc' is supplied. // Default: - All private subnets. // SubnetSelection *awsec2.SubnetSelection `field:"optional" json:"subnetSelection" yaml:"subnetSelection"` // The number of minutes after which AWS CodeBuild stops the build if it's not complete. // // For valid values, see the timeoutInMinutes field in the AWS // CodeBuild User Guide. // Default: Duration.hours(1) // Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"` // The VPC where to create the CodeBuild network interfaces in. // Default: - No VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
Options for customizing a single CodeBuild project.
Example:
var source iFileSetProducer // the repository source var synthCommands []*string // Commands to synthesize your app var installCommands []*string // Commands to install your toolchain pipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ // Standard CodePipeline properties... Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: source, Commands: synthCommands, }), // Configure CodeBuild to use a drop-in Docker replacement. CodeBuildDefaults: &CodeBuildOptions{ PartialBuildSpec: codebuild.BuildSpec_FromObject(map[string]interface{}{ "phases": map[string]map[string][]*string{ "install": map[string][]*string{ // Add the shell commands to install your drop-in Docker // replacement to the CodeBuild enviromment. "commands": installCommands, }, }, }), BuildEnvironment: &BuildEnvironment{ EnvironmentVariables: map[string]buildEnvironmentVariable{ // Instruct the AWS CDK to use `drop-in-replacement` instead of // `docker` when building / publishing docker images. // e.g., `drop-in-replacement build . -f path/to/Dockerfile` "CDK_DOCKER": &buildEnvironmentVariable{ "value": jsii.String("drop-in-replacement"), }, }, }, }, })
type CodeBuildStep ¶
type CodeBuildStep interface { ShellStep // Custom execution role to be used for the Code Build Action. // Default: - A role is automatically created. // ActionRole() awsiam.IRole // Build environment. // Default: - No value specified at construction time, use defaults. // BuildEnvironment() *awscodebuild.BuildEnvironment // Caching strategy to use. // Default: - No cache. // Cache() awscodebuild.Cache // Commands to run. Commands() *[]*string // StackOutputReferences this step consumes. ConsumedStackOutputs() *[]StackOutputReference // Return the steps this step depends on, based on the FileSets it requires. Dependencies() *[]Step // The list of FileSets consumed by this Step. DependencyFileSets() *[]FileSet // Environment variables to set. // Default: - No environment variables. // Env() *map[string]*string // Set environment variables based on Stack Outputs. // Default: - No environment variables created from stack outputs. // EnvFromCfnOutputs() *map[string]StackOutputReference // ProjectFileSystemLocation objects for CodeBuild build projects. // // A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, // and type of a file system created using Amazon Elastic File System. // Default: - no file system locations. // FileSystemLocations() *[]awscodebuild.IFileSystemLocation // The CodeBuild Project's principal. GrantPrincipal() awsiam.IPrincipal // Identifier for this step. Id() *string // Input FileSets. // // A list of `(FileSet, directory)` pairs, which are a copy of the // input properties. This list should not be modified directly. Inputs() *[]*FileSetLocation // Installation commands to run before the regular commands. // // For deployment engines that support it, install commands will be classified // differently in the job history from the regular `commands`. // Default: - No installation commands. // InstallCommands() *[]*string // Whether or not this is a Source step. // // What it means to be a Source step depends on the engine. IsSource() *bool // Information about logs for CodeBuild projects. // // A CodeBuilde project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both. // Default: - no log configuration is set. // Logging() *awscodebuild.LoggingOptions // Output FileSets. // // A list of `(FileSet, directory)` pairs, which are a copy of the // input properties. This list should not be modified directly. Outputs() *[]*FileSetLocation // Additional configuration that can only be configured via BuildSpec. // // Contains exported variables. // Default: - Contains the exported variables. // PartialBuildSpec() awscodebuild.BuildSpec // The primary FileSet produced by this Step. // // Not all steps produce an output FileSet--if they do // you can substitute the `Step` object for the `FileSet` object. PrimaryOutput() FileSet // CodeBuild Project generated for the pipeline. // // Will only be available after the pipeline has been built. Project() awscodebuild.IProject // Name for the generated CodeBuild project. // Default: - No value specified at construction time, use defaults. // ProjectName() *string // Custom execution role to be used for the CodeBuild project. // Default: - No value specified at construction time, use defaults. // Role() awsiam.IRole // Policy statements to add to role used during the synth. // Default: - No value specified at construction time, use defaults. // RolePolicyStatements() *[]awsiam.PolicyStatement // Which security group to associate with the script's project network interfaces. // Default: - No value specified at construction time, use defaults. // SecurityGroups() *[]awsec2.ISecurityGroup // Which subnets to use. // Default: - No value specified at construction time, use defaults. // SubnetSelection() *awsec2.SubnetSelection // The number of minutes after which AWS CodeBuild stops the build if it's not complete. // // For valid values, see the timeoutInMinutes field in the AWS // CodeBuild User Guide. // Default: Duration.hours(1) // Timeout() awscdk.Duration // The VPC where to execute the SimpleSynth. // Default: - No value specified at construction time, use defaults. // Vpc() awsec2.IVpc // Add an additional FileSet to the set of file sets required by this step. // // This will lead to a dependency on the producer of that file set. AddDependencyFileSet(fs FileSet) // Add an additional output FileSet based on a directory. // // After running the script, the contents of the given directory // will be exported as a `FileSet`. Use the `FileSet` as the // input to another step. // // Multiple calls with the exact same directory name string (not normalized) // will return the same FileSet. AddOutputDirectory(directory *string) FileSet // Add a dependency on another step. AddStepDependency(step Step) // Configure the given FileSet as the primary output of this step. ConfigurePrimaryOutput(fs FileSet) // Crawl the given structure for references to StepOutputs and add dependencies on all steps found. // // Should be called in the constructor of subclasses based on what the user // passes in as construction properties. The format of the structure passed in // here does not have to correspond exactly to what gets rendered into the // engine, it just needs to contain the same data. DiscoverReferencedOutputs(structure interface{}) // Reference a CodePipeline variable defined by the CodeBuildStep. // // The variable must be set in the shell of the CodeBuild step when // it finishes its `post_build` phase. // // Example: // // Access the output of one CodeBuildStep in another CodeBuildStep // var pipeline codePipeline // // // step1 := pipelines.NewCodeBuildStep(jsii.String("Step1"), &CodeBuildStepProps{ // Commands: []*string{ // jsii.String("export MY_VAR=hello"), // }, // }) // // step2 := pipelines.NewCodeBuildStep(jsii.String("Step2"), &CodeBuildStepProps{ // Env: map[string]*string{ // "IMPORTED_VAR": step1.exportedVariable(jsii.String("MY_VAR")), // }, // Commands: []*string{ // jsii.String("echo $IMPORTED_VAR"), // }, // }) // ExportedVariable(variableName *string) *string // Configure the given output directory as primary output. // // If no primary output has been configured yet, this directory // will become the primary output of this ShellStep, otherwise this // method will throw if the given directory is different than the // currently configured primary output directory. PrimaryOutputDirectory(directory *string) FileSet // Return a string representation of this Step. ToString() *string }
Run a script as a CodeBuild Project.
The BuildSpec must be available inline--it cannot reference a file on disk. If your current build instructions are in a file like `buildspec.yml` in your repository, extract them to a script (say, `build.sh`) and invoke that script as part of the build:
```ts
new pipelines.CodeBuildStep('Synth', { commands: ['./build.sh'], });
```.
Example:
pipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), // Turn this on because the pipeline uses Docker image assets DockerEnabledForSelfMutation: jsii.Boolean(true), }) pipeline.AddWave(jsii.String("MyWave"), &WaveOptions{ Post: []step{ pipelines.NewCodeBuildStep(jsii.String("RunApproval"), &CodeBuildStepProps{ Commands: []*string{ jsii.String("command-from-image"), }, BuildEnvironment: &BuildEnvironment{ // The user of a Docker image asset in the pipeline requires turning on // 'dockerEnabledForSelfMutation'. BuildImage: codebuild.LinuxBuildImage_FromAsset(this, jsii.String("Image"), &DockerImageAssetProps{ Directory: jsii.String("./docker-image"), }), }, }), }, })
func NewCodeBuildStep ¶
func NewCodeBuildStep(id *string, props *CodeBuildStepProps) CodeBuildStep
type CodeBuildStepProps ¶
type CodeBuildStepProps struct { // Commands to run. Commands *[]*string `field:"required" json:"commands" yaml:"commands"` // Additional FileSets to put in other directories. // // Specifies a mapping from directory name to FileSets. During the // script execution, the FileSets will be available in the directories // indicated. // // The directory names may be relative. For example, you can put // the main input and an additional input side-by-side with the // following configuration: // // “`ts // const script = new pipelines.ShellStep('MainScript', { // commands: ['npm ci','npm run build','npx cdk synth'], // input: pipelines.CodePipelineSource.gitHub('org/source1', 'main'), // additionalInputs: { // '../siblingdir': pipelines.CodePipelineSource.gitHub('org/source2', 'main'), // } // }); // “`. // Default: - No additional inputs. // AdditionalInputs *map[string]IFileSetProducer `field:"optional" json:"additionalInputs" yaml:"additionalInputs"` // Environment variables to set. // Default: - No environment variables. // Env *map[string]*string `field:"optional" json:"env" yaml:"env"` // Set environment variables based on Stack Outputs. // // `ShellStep`s following stack or stage deployments may // access the `CfnOutput`s of those stacks to get access to // --for example--automatically generated resource names or // endpoint URLs. // Default: - No environment variables created from stack outputs. // EnvFromCfnOutputs *map[string]awscdk.CfnOutput `field:"optional" json:"envFromCfnOutputs" yaml:"envFromCfnOutputs"` // FileSet to run these scripts on. // // The files in the FileSet will be placed in the working directory when // the script is executed. Use `additionalInputs` to download file sets // to other directories as well. // Default: - No input specified. // Input IFileSetProducer `field:"optional" json:"input" yaml:"input"` // Installation commands to run before the regular commands. // // For deployment engines that support it, install commands will be classified // differently in the job history from the regular `commands`. // Default: - No installation commands. // InstallCommands *[]*string `field:"optional" json:"installCommands" yaml:"installCommands"` // The directory that will contain the primary output fileset. // // After running the script, the contents of the given directory // will be treated as the primary output of this Step. // Default: - No primary output. // PrimaryOutputDirectory *string `field:"optional" json:"primaryOutputDirectory" yaml:"primaryOutputDirectory"` // Custom execution role to be used for the Code Build Action. // Default: - A role is automatically created. // ActionRole awsiam.IRole `field:"optional" json:"actionRole" yaml:"actionRole"` // Changes to environment. // // This environment will be combined with the pipeline's default // environment. // Default: - Use the pipeline's default build environment. // BuildEnvironment *awscodebuild.BuildEnvironment `field:"optional" json:"buildEnvironment" yaml:"buildEnvironment"` // Caching strategy to use. // Default: - No cache. // Cache awscodebuild.Cache `field:"optional" json:"cache" yaml:"cache"` // ProjectFileSystemLocation objects for CodeBuild build projects. // // A ProjectFileSystemLocation object specifies the identifier, location, mountOptions, mountPoint, // and type of a file system created using Amazon Elastic File System. // Default: - no file system locations. // FileSystemLocations *[]awscodebuild.IFileSystemLocation `field:"optional" json:"fileSystemLocations" yaml:"fileSystemLocations"` // Information about logs for CodeBuild projects. // // A CodeBuild project can create logs in Amazon CloudWatch Logs, an S3 bucket, or both. // Default: - no log configuration is set. // Logging *awscodebuild.LoggingOptions `field:"optional" json:"logging" yaml:"logging"` // Additional configuration that can only be configured via BuildSpec. // // You should not use this to specify output artifacts; those // should be supplied via the other properties of this class, otherwise // CDK Pipelines won't be able to inspect the artifacts. // // Set the `commands` to an empty array if you want to fully specify // the BuildSpec using this field. // // The BuildSpec must be available inline--it cannot reference a file // on disk. // Default: - BuildSpec completely derived from other properties. // PartialBuildSpec awscodebuild.BuildSpec `field:"optional" json:"partialBuildSpec" yaml:"partialBuildSpec"` // Name for the generated CodeBuild project. // Default: - Automatically generated. // ProjectName *string `field:"optional" json:"projectName" yaml:"projectName"` // Custom execution role to be used for the CodeBuild project. // Default: - A role is automatically created. // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` // Policy statements to add to role used during the synth. // // Can be used to add acces to a CodeArtifact repository etc. // Default: - No policy statements added to CodeBuild Project Role. // RolePolicyStatements *[]awsiam.PolicyStatement `field:"optional" json:"rolePolicyStatements" yaml:"rolePolicyStatements"` // Which security group to associate with the script's project network interfaces. // // If no security group is identified, one will be created automatically. // // Only used if 'vpc' is supplied. // Default: - Security group will be automatically created. // SecurityGroups *[]awsec2.ISecurityGroup `field:"optional" json:"securityGroups" yaml:"securityGroups"` // Which subnets to use. // // Only used if 'vpc' is supplied. // Default: - All private subnets. // SubnetSelection *awsec2.SubnetSelection `field:"optional" json:"subnetSelection" yaml:"subnetSelection"` // The number of minutes after which AWS CodeBuild stops the build if it's not complete. // // For valid values, see the timeoutInMinutes field in the AWS // CodeBuild User Guide. // Default: Duration.hours(1) // Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"` // The VPC where to execute the SimpleSynth. // Default: - No VPC. // Vpc awsec2.IVpc `field:"optional" json:"vpc" yaml:"vpc"` }
Construction props for a CodeBuildStep.
Example:
pipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), // Turn this on because the pipeline uses Docker image assets DockerEnabledForSelfMutation: jsii.Boolean(true), }) pipeline.AddWave(jsii.String("MyWave"), &WaveOptions{ Post: []step{ pipelines.NewCodeBuildStep(jsii.String("RunApproval"), &CodeBuildStepProps{ Commands: []*string{ jsii.String("command-from-image"), }, BuildEnvironment: &BuildEnvironment{ // The user of a Docker image asset in the pipeline requires turning on // 'dockerEnabledForSelfMutation'. BuildImage: codebuild.LinuxBuildImage_FromAsset(this, jsii.String("Image"), &DockerImageAssetProps{ Directory: jsii.String("./docker-image"), }), }, }), }, })
type CodeCommitSourceOptions ¶
type CodeCommitSourceOptions struct { // The action name used for this source in the CodePipeline. // Default: - The repository name. // ActionName *string `field:"optional" json:"actionName" yaml:"actionName"` // If this is set, the next CodeBuild job clones the repository (instead of CodePipeline downloading the files). // // This provides access to repository history, and retains symlinks (symlinks would otherwise be // removed by CodePipeline). // // **Note**: if this option is true, only CodeBuild jobs can use the output artifact. // See: https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodeCommit.html // // Default: false. // CodeBuildCloneOutput *bool `field:"optional" json:"codeBuildCloneOutput" yaml:"codeBuildCloneOutput"` // Role to be used by on commit event rule. // // Used only when trigger value is CodeCommitTrigger.EVENTS. // Default: a new role will be created. // EventRole awsiam.IRole `field:"optional" json:"eventRole" yaml:"eventRole"` // How should CodePipeline detect source changes for this Action. // Default: CodeCommitTrigger.EVENTS // Trigger awscodepipelineactions.CodeCommitTrigger `field:"optional" json:"trigger" yaml:"trigger"` }
Configuration options for a CodeCommit source.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var role role codeCommitSourceOptions := &CodeCommitSourceOptions{ ActionName: jsii.String("actionName"), CodeBuildCloneOutput: jsii.Boolean(false), EventRole: role, Trigger: awscdk.Aws_codepipeline_actions.CodeCommitTrigger_NONE, }
type CodePipeline ¶
type CodePipeline interface { PipelineBase // The FileSet tha contains the cloud assembly. // // This is the primary output of the synth step. CloudAssemblyFileSet() FileSet // The tree node. Node() constructs.Node // The CodePipeline pipeline that deploys the CDK app. // // Only available after the pipeline has been built. Pipeline() awscodepipeline.Pipeline // Whether SelfMutation is enabled for this CDK Pipeline. SelfMutationEnabled() *bool // The CodeBuild project that performs the SelfMutation. // // Will throw an error if this is accessed before `buildPipeline()` // is called, or if selfMutation has been disabled. SelfMutationProject() awscodebuild.IProject // The build step that produces the CDK Cloud Assembly. Synth() IFileSetProducer // The CodeBuild project that performs the Synth. // // Only available after the pipeline has been built. SynthProject() awscodebuild.IProject // The waves in this pipeline. Waves() *[]Wave // Deploy a single Stage by itself. // // Add a Stage to the pipeline, to be deployed in sequence with other // Stages added to the pipeline. All Stacks in the stage will be deployed // in an order automatically determined by their relative dependencies. AddStage(stage awscdk.Stage, options *AddStageOpts) StageDeployment // Add a Wave to the pipeline, for deploying multiple Stages in parallel. // // Use the return object of this method to deploy multiple stages in parallel. // // Example: // // “`ts // declare const pipeline: pipelines.CodePipeline; // // const wave = pipeline.addWave('MyWave'); // wave.addStage(new MyApplicationStage(this, 'Stage1')); // wave.addStage(new MyApplicationStage(this, 'Stage2')); // “`. AddWave(id *string, options *WaveOptions) Wave // Send the current pipeline definition to the engine, and construct the pipeline. // // It is not possible to modify the pipeline after calling this method. BuildPipeline() // Implemented by subclasses to do the actual pipeline construction. DoBuildPipeline() // Returns a string representation of this construct. ToString() *string }
A CDK Pipeline that uses CodePipeline to deploy CDK apps.
This is a `Pipeline` with its `engine` property set to `CodePipelineEngine`, and exists for nicer ergonomics for users that don't need to switch out engines.
Example:
// Modern API modernPipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ SelfMutation: jsii.Boolean(false), Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), }) // Original API cloudAssemblyArtifact := codepipeline.NewArtifact() originalPipeline := pipelines.NewCdkPipeline(this, jsii.String("Pipeline"), &cdkPipelineProps{ selfMutating: jsii.Boolean(false), cloudAssemblyArtifact: cloudAssemblyArtifact, })
func NewCodePipeline ¶
func NewCodePipeline(scope constructs.Construct, id *string, props *CodePipelineProps) CodePipeline
type CodePipelineActionFactoryResult ¶
type CodePipelineActionFactoryResult struct { // How many RunOrders were consumed. // // If you add 1 action, return the value 1 here. RunOrdersConsumed *float64 `field:"required" json:"runOrdersConsumed" yaml:"runOrdersConsumed"` // If a CodeBuild project got created, the project. // Default: - This factory did not create a CodeBuild project. // Project awscodebuild.IProject `field:"optional" json:"project" yaml:"project"` }
The result of adding actions to the pipeline.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var project project codePipelineActionFactoryResult := &CodePipelineActionFactoryResult{ RunOrdersConsumed: jsii.Number(123), // the properties below are optional Project: project, }
type CodePipelineFileSet ¶
type CodePipelineFileSet interface { FileSet // Human-readable descriptor for this file set (does not need to be unique). Id() *string // The primary output of a file set producer. // // The primary output of a FileSet is itself. PrimaryOutput() FileSet // The Step that produces this FileSet. Producer() Step // Mark the given Step as the producer for this FileSet. // // This method can only be called once. ProducedBy(producer Step) // Return a string representation of this FileSet. ToString() *string }
A FileSet created from a CodePipeline artifact.
You only need to use this if you want to add CDK Pipeline stages add the end of an existing CodePipeline, which should be very rare.
Example:
var codePipeline pipeline sourceArtifact := codepipeline.NewArtifact(jsii.String("MySourceArtifact")) pipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ CodePipeline: codePipeline, Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineFileSet_FromArtifact(sourceArtifact), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), })
func CodePipelineFileSet_FromArtifact ¶
func CodePipelineFileSet_FromArtifact(artifact awscodepipeline.Artifact) CodePipelineFileSet
Turn a CodePipeline Artifact into a FileSet.
type CodePipelineProps ¶
type CodePipelineProps struct { // The build step that produces the CDK Cloud Assembly. // // The primary output of this step needs to be the `cdk.out` directory // generated by the `cdk synth` command. // // If you use a `ShellStep` here and you don't configure an output directory, // the output directory will automatically be assumed to be `cdk.out`. Synth IFileSetProducer `field:"required" json:"synth" yaml:"synth"` // An existing S3 Bucket to use for storing the pipeline's artifact. // Default: - A new S3 bucket will be created. // ArtifactBucket awss3.IBucket `field:"optional" json:"artifactBucket" yaml:"artifactBucket"` // Additional customizations to apply to the asset publishing CodeBuild projects. // Default: - Only `codeBuildDefaults` are applied. // AssetPublishingCodeBuildDefaults *CodeBuildOptions `field:"optional" json:"assetPublishingCodeBuildDefaults" yaml:"assetPublishingCodeBuildDefaults"` // CDK CLI version to use in self-mutation and asset publishing steps. // // If you want to lock the CDK CLI version used in the pipeline, by steps // that are automatically generated for you, specify the version here. // // We recommend you do not specify this value, as not specifying it always // uses the latest CLI version which is backwards compatible with old versions. // // If you do specify it, be aware that this version should always be equal to or higher than the // version of the CDK framework used by the CDK app, when the CDK commands are // run during your pipeline execution. When you change this version, the *next // time* the `SelfMutate` step runs it will still be using the CLI of the the // *previous* version that was in this property: it will only start using the // new version after `SelfMutate` completes successfully. That means that if // you want to update both framework and CLI version, you should update the // CLI version first, commit, push and deploy, and only then update the // framework version. // Default: - Latest version. // CliVersion *string `field:"optional" json:"cliVersion" yaml:"cliVersion"` // Customize the CodeBuild projects created for this pipeline. // Default: - All projects run non-privileged build, SMALL instance, LinuxBuildImage.STANDARD_7_0 // CodeBuildDefaults *CodeBuildOptions `field:"optional" json:"codeBuildDefaults" yaml:"codeBuildDefaults"` // An existing Pipeline to be reused and built upon. // // [disable-awslint:ref-via-interface]. // Default: - a new underlying pipeline is created. // CodePipeline awscodepipeline.Pipeline `field:"optional" json:"codePipeline" yaml:"codePipeline"` // Create KMS keys for the artifact buckets, allowing cross-account deployments. // // The artifact buckets have to be encrypted to support deploying CDK apps to // another account, so if you want to do that or want to have your artifact // buckets encrypted, be sure to set this value to `true`. // // Be aware there is a cost associated with maintaining the KMS keys. // Default: false. // CrossAccountKeys *bool `field:"optional" json:"crossAccountKeys" yaml:"crossAccountKeys"` // A map of region to S3 bucket name used for cross-region CodePipeline. // // For every Action that you specify targeting a different region than the Pipeline itself, // if you don't provide an explicit Bucket for that region using this property, // the construct will automatically create a Stack containing an S3 Bucket in that region. // Passed directly through to the {@link cp.Pipeline}. // Default: - no cross region replication buckets. // CrossRegionReplicationBuckets *map[string]awss3.IBucket `field:"optional" json:"crossRegionReplicationBuckets" yaml:"crossRegionReplicationBuckets"` // A list of credentials used to authenticate to Docker registries. // // Specify any credentials necessary within the pipeline to build, synth, update, or publish assets. // Default: []. // DockerCredentials *[]DockerCredential `field:"optional" json:"dockerCredentials" yaml:"dockerCredentials"` // Enable Docker for the self-mutate step. // // Set this to true if the pipeline itself uses Docker container assets // (for example, if you use `LinuxBuildImage.fromAsset()` as the build // image of a CodeBuild step in the pipeline). // // You do not need to set it if you build Docker image assets in the // application Stages and Stacks that are *deployed* by this pipeline. // // Configures privileged mode for the self-mutation CodeBuild action. // // If you are about to turn this on in an already-deployed Pipeline, // set the value to `true` first, commit and allow the pipeline to // self-update, and only then use the Docker asset in the pipeline. // Default: false. // DockerEnabledForSelfMutation *bool `field:"optional" json:"dockerEnabledForSelfMutation" yaml:"dockerEnabledForSelfMutation"` // Enable Docker for the 'synth' step. // // Set this to true if you are using file assets that require // "bundling" anywhere in your application (meaning an asset // compilation step will be run with the tools provided by // a Docker image), both for the Pipeline stack as well as the // application stacks. // // A common way to use bundling assets in your application is by // using the `aws-cdk-lib/aws-lambda-nodejs` library. // // Configures privileged mode for the synth CodeBuild action. // // If you are about to turn this on in an already-deployed Pipeline, // set the value to `true` first, commit and allow the pipeline to // self-update, and only then use the bundled asset. // Default: false. // DockerEnabledForSynth *bool `field:"optional" json:"dockerEnabledForSynth" yaml:"dockerEnabledForSynth"` // Enable KMS key rotation for the generated KMS keys. // // By default KMS key rotation is disabled, but will add // additional costs when enabled. // Default: - false (key rotation is disabled). // EnableKeyRotation *bool `field:"optional" json:"enableKeyRotation" yaml:"enableKeyRotation"` // The name of the CodePipeline pipeline. // Default: - Automatically generated. // PipelineName *string `field:"optional" json:"pipelineName" yaml:"pipelineName"` // Publish assets in multiple CodeBuild projects. // // If set to false, use one Project per type to publish all assets. // // Publishing in parallel improves concurrency and may reduce publishing // latency, but may also increase overall provisioning time of the CodeBuild // projects. // // Experiment and see what value works best for you. // Default: true. // PublishAssetsInParallel *bool `field:"optional" json:"publishAssetsInParallel" yaml:"publishAssetsInParallel"` // Reuse the same cross region support stack for all pipelines in the App. // Default: - true (Use the same support stack for all pipelines in App). // ReuseCrossRegionSupportStacks *bool `field:"optional" json:"reuseCrossRegionSupportStacks" yaml:"reuseCrossRegionSupportStacks"` // The IAM role to be assumed by this Pipeline. // Default: - A new role is created. // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` // Whether the pipeline will update itself. // // This needs to be set to `true` to allow the pipeline to reconfigure // itself when assets or stages are being added to it, and `true` is the // recommended setting. // // You can temporarily set this to `false` while you are iterating // on the pipeline itself and prefer to deploy changes using `cdk deploy`. // Default: true. // SelfMutation *bool `field:"optional" json:"selfMutation" yaml:"selfMutation"` // Additional customizations to apply to the self mutation CodeBuild projects. // Default: - Only `codeBuildDefaults` are applied. // SelfMutationCodeBuildDefaults *CodeBuildOptions `field:"optional" json:"selfMutationCodeBuildDefaults" yaml:"selfMutationCodeBuildDefaults"` // Additional customizations to apply to the synthesize CodeBuild projects. // Default: - Only `codeBuildDefaults` are applied. // SynthCodeBuildDefaults *CodeBuildOptions `field:"optional" json:"synthCodeBuildDefaults" yaml:"synthCodeBuildDefaults"` // Deploy every stack by creating a change set and executing it. // // When enabled, creates a "Prepare" and "Execute" action for each stack. Disable // to deploy the stack in one pipeline action. // Default: true. // UseChangeSets *bool `field:"optional" json:"useChangeSets" yaml:"useChangeSets"` }
Properties for a `CodePipeline`.
Example:
// Modern API modernPipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ SelfMutation: jsii.Boolean(false), Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), }) // Original API cloudAssemblyArtifact := codepipeline.NewArtifact() originalPipeline := pipelines.NewCdkPipeline(this, jsii.String("Pipeline"), &cdkPipelineProps{ selfMutating: jsii.Boolean(false), cloudAssemblyArtifact: cloudAssemblyArtifact, })
type CodePipelineSource ¶
type CodePipelineSource interface { Step ICodePipelineActionFactory // StackOutputReferences this step consumes. ConsumedStackOutputs() *[]StackOutputReference // Return the steps this step depends on, based on the FileSets it requires. Dependencies() *[]Step // The list of FileSets consumed by this Step. DependencyFileSets() *[]FileSet // Identifier for this step. Id() *string // Whether or not this is a Source step. // // What it means to be a Source step depends on the engine. IsSource() *bool // The primary FileSet produced by this Step. // // Not all steps produce an output FileSet--if they do // you can substitute the `Step` object for the `FileSet` object. PrimaryOutput() FileSet // Add an additional FileSet to the set of file sets required by this step. // // This will lead to a dependency on the producer of that file set. AddDependencyFileSet(fs FileSet) // Add a dependency on another step. AddStepDependency(step Step) // Configure the given FileSet as the primary output of this step. ConfigurePrimaryOutput(fs FileSet) // Crawl the given structure for references to StepOutputs and add dependencies on all steps found. // // Should be called in the constructor of subclasses based on what the user // passes in as construction properties. The format of the structure passed in // here does not have to correspond exactly to what gets rendered into the // engine, it just needs to contain the same data. DiscoverReferencedOutputs(structure interface{}) GetAction(output awscodepipeline.Artifact, actionName *string, runOrder *float64, variablesNamespace *string) awscodepipelineactions.Action // Create the desired Action and add it to the pipeline. ProduceAction(stage awscodepipeline.IStage, options *ProduceActionOptions) *CodePipelineActionFactoryResult // Return an attribute of the current source revision. // // These values can be passed into the environment variables of pipeline steps, // so your steps can access information about the source revision. // // Pipeline synth step has some source attributes predefined in the environment. // If these suffice, you don't need to use this method for the synth step. // // Example: // // Access the CommitId of a GitHub source in the synth // source := pipelines.CodePipelineSource_GitHub(jsii.String("owner/repo"), jsii.String("main")) // // pipeline := pipelines.NewCodePipeline(*scope, jsii.String("MyPipeline"), &CodePipelineProps{ // Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ // Input: source, // Commands: []*string{ // }, // Env: map[string]*string{ // "COMMIT_ID": source.sourceAttribute(jsii.String("CommitId")), // }, // }), // }) // // See: https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html#reference-variables-list // SourceAttribute(name *string) *string // Return a string representation of this Step. ToString() *string }
Factory for CodePipeline source steps.
This class contains a number of factory methods for the different types of sources that CodePipeline supports.
Example:
// Access the CommitId of a GitHub source in the synth source := pipelines.CodePipelineSource_GitHub(jsii.String("owner/repo"), jsii.String("main")) pipeline := pipelines.NewCodePipeline(*scope, jsii.String("MyPipeline"), &CodePipelineProps{ Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: source, Commands: []*string{ }, Env: map[string]*string{ "COMMIT_ID": source.sourceAttribute(jsii.String("CommitId")), }, }), })
func CodePipelineSource_CodeCommit ¶
func CodePipelineSource_CodeCommit(repository awscodecommit.IRepository, branch *string, props *CodeCommitSourceOptions) CodePipelineSource
Returns a CodeCommit source.
If you need access to symlinks or the repository history, be sure to set `codeBuildCloneOutput`.
Example:
var repository iRepository pipelines.CodePipelineSource_CodeCommit(repository, jsii.String("main"))
func CodePipelineSource_Connection ¶
func CodePipelineSource_Connection(repoString *string, branch *string, props *ConnectionSourceOptions) CodePipelineSource
Returns a CodeStar connection source.
A CodeStar connection allows AWS CodePipeline to access external resources, such as repositories in GitHub, GitHub Enterprise or BitBucket.
To use this method, you first need to create a CodeStar connection using the AWS console. In the process, you may have to sign in to the external provider -- GitHub, for example -- to authorize AWS to read and modify your repository. Once you have done this, copy the connection ARN and use it to create the source.
Example:
```ts
pipelines.CodePipelineSource.connection('owner/repo', 'main', { connectionArn: 'arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41', // Created using the AWS console });
```
If you need access to symlinks or the repository history, be sure to set `codeBuildCloneOutput`. See: https://docs.aws.amazon.com/dtconsole/latest/userguide/welcome-connections.html
func CodePipelineSource_Ecr ¶ added in v2.14.0
func CodePipelineSource_Ecr(repository awsecr.IRepository, props *ECRSourceOptions) CodePipelineSource
Returns an ECR source.
Example:
var repository iRepository pipelines.CodePipelineSource_Ecr(repository, &ECRSourceOptions{ ImageTag: jsii.String("latest"), })
func CodePipelineSource_GitHub ¶
func CodePipelineSource_GitHub(repoString *string, branch *string, props *GitHubSourceOptions) CodePipelineSource
Returns a GitHub source, using OAuth tokens to authenticate with GitHub and a separate webhook to detect changes.
This is no longer the recommended method. Please consider using `connection()` instead.
Pass in the owner and repository in a single string, like this:
```ts pipelines.CodePipelineSource.gitHub('owner/repo', 'main'); ```
Authentication will be done by a secret called `github-token` in AWS Secrets Manager (unless specified otherwise).
If you rotate the value in the Secret, you must also change at least one property on the Pipeline, to force CloudFormation to re-read the secret.
The token should have these permissions:
* **repo** - to read the repository * **admin:repo_hook** - if you plan to use webhooks (true by default)
If you need access to symlinks or the repository history, use a source of type `connection` instead.
func CodePipelineSource_S3 ¶
func CodePipelineSource_S3(bucket awss3.IBucket, objectKey *string, props *S3SourceOptions) CodePipelineSource
Returns an S3 source.
Example:
var bucket bucket pipelines.CodePipelineSource_S3(bucket, jsii.String("path/to/file.zip"))
type ConfirmPermissionsBroadening ¶
type ConfirmPermissionsBroadening interface { Step ICodePipelineActionFactory // StackOutputReferences this step consumes. ConsumedStackOutputs() *[]StackOutputReference // Return the steps this step depends on, based on the FileSets it requires. Dependencies() *[]Step // The list of FileSets consumed by this Step. DependencyFileSets() *[]FileSet // Identifier for this step. Id() *string // Whether or not this is a Source step. // // What it means to be a Source step depends on the engine. IsSource() *bool // The primary FileSet produced by this Step. // // Not all steps produce an output FileSet--if they do // you can substitute the `Step` object for the `FileSet` object. PrimaryOutput() FileSet // Add an additional FileSet to the set of file sets required by this step. // // This will lead to a dependency on the producer of that file set. AddDependencyFileSet(fs FileSet) // Add a dependency on another step. AddStepDependency(step Step) // Configure the given FileSet as the primary output of this step. ConfigurePrimaryOutput(fs FileSet) // Crawl the given structure for references to StepOutputs and add dependencies on all steps found. // // Should be called in the constructor of subclasses based on what the user // passes in as construction properties. The format of the structure passed in // here does not have to correspond exactly to what gets rendered into the // engine, it just needs to contain the same data. DiscoverReferencedOutputs(structure interface{}) // Create the desired Action and add it to the pipeline. ProduceAction(stage awscodepipeline.IStage, options *ProduceActionOptions) *CodePipelineActionFactoryResult // Return a string representation of this Step. ToString() *string }
Pause the pipeline if a deployment would add IAM permissions or Security Group rules.
This step is only supported in CodePipeline pipelines.
Example:
var pipeline codePipeline stage := NewMyApplicationStage(this, jsii.String("MyApplication")) pipeline.AddStage(stage, &AddStageOpts{ Pre: []step{ pipelines.NewConfirmPermissionsBroadening(jsii.String("Check"), &PermissionsBroadeningCheckProps{ Stage: *Stage, }), }, })
func NewConfirmPermissionsBroadening ¶
func NewConfirmPermissionsBroadening(id *string, props *PermissionsBroadeningCheckProps) ConfirmPermissionsBroadening
type ConnectionSourceOptions ¶
type ConnectionSourceOptions struct { // The ARN of the CodeStar Connection created in the AWS console that has permissions to access this GitHub or BitBucket repository. // // Example: // "arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh" // // See: https://docs.aws.amazon.com/codepipeline/latest/userguide/connections-create.html // ConnectionArn *string `field:"required" json:"connectionArn" yaml:"connectionArn"` // The action name used for this source in the CodePipeline. // Default: - The repository string. // ActionName *string `field:"optional" json:"actionName" yaml:"actionName"` // If this is set, the next CodeBuild job clones the repository (instead of CodePipeline downloading the files). // // This provides access to repository history, and retains symlinks (symlinks would otherwise be // removed by CodePipeline). // // **Note**: if this option is true, only CodeBuild jobs can use the output artifact. // See: https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html#action-reference-CodestarConnectionSource-config // // Default: false. // CodeBuildCloneOutput *bool `field:"optional" json:"codeBuildCloneOutput" yaml:"codeBuildCloneOutput"` // Controls automatically starting your pipeline when a new commit is made on the configured repository and branch. // // If unspecified, // the default value is true, and the field does not display by default. // See: https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html // // Default: true. // TriggerOnPush *bool `field:"optional" json:"triggerOnPush" yaml:"triggerOnPush"` }
Configuration options for CodeStar source.
Example:
pipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), // Turn this on because the pipeline uses Docker image assets DockerEnabledForSelfMutation: jsii.Boolean(true), }) pipeline.AddWave(jsii.String("MyWave"), &WaveOptions{ Post: []step{ pipelines.NewCodeBuildStep(jsii.String("RunApproval"), &CodeBuildStepProps{ Commands: []*string{ jsii.String("command-from-image"), }, BuildEnvironment: &BuildEnvironment{ // The user of a Docker image asset in the pipeline requires turning on // 'dockerEnabledForSelfMutation'. BuildImage: codebuild.LinuxBuildImage_FromAsset(this, jsii.String("Image"), &DockerImageAssetProps{ Directory: jsii.String("./docker-image"), }), }, }), }, })
type DockerCredential ¶
type DockerCredential interface { Usages() *[]DockerCredentialUsage // Grant read-only access to the registry credentials. // // This grants read access to any secrets, and pull access to any repositories. GrantRead(grantee awsiam.IGrantable, usage DockerCredentialUsage) }
Represents credentials used to access a Docker registry.
Example:
dockerHubSecret := secretsmanager.Secret_FromSecretCompleteArn(this, jsii.String("DHSecret"), jsii.String("arn:aws:...")) customRegSecret := secretsmanager.Secret_FromSecretCompleteArn(this, jsii.String("CRSecret"), jsii.String("arn:aws:...")) repo1 := ecr.Repository_FromRepositoryArn(this, jsii.String("Repo"), jsii.String("arn:aws:ecr:eu-west-1:0123456789012:repository/Repo1")) repo2 := ecr.Repository_FromRepositoryArn(this, jsii.String("Repo"), jsii.String("arn:aws:ecr:eu-west-1:0123456789012:repository/Repo2")) pipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ DockerCredentials: []dockerCredential{ pipelines.*dockerCredential_DockerHub(dockerHubSecret), pipelines.*dockerCredential_CustomRegistry(jsii.String("dockerregistry.example.com"), customRegSecret), pipelines.*dockerCredential_Ecr([]iRepository{ repo1, repo2, }), }, Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), })
func DockerCredential_CustomRegistry ¶
func DockerCredential_CustomRegistry(registryDomain *string, secret awssecretsmanager.ISecret, opts *ExternalDockerCredentialOptions) DockerCredential
Creates a DockerCredential for a registry, based on its domain name (e.g., 'www.example.com').
func DockerCredential_DockerHub ¶
func DockerCredential_DockerHub(secret awssecretsmanager.ISecret, opts *ExternalDockerCredentialOptions) DockerCredential
Creates a DockerCredential for DockerHub.
Convenience method for `customRegistry('https://index.docker.io/v1/', opts)`.
func DockerCredential_Ecr ¶
func DockerCredential_Ecr(repositories *[]awsecr.IRepository, opts *EcrDockerCredentialOptions) DockerCredential
Creates a DockerCredential for one or more ECR repositories.
NOTE - All ECR repositories in the same account and region share a domain name (e.g., 0123456789012.dkr.ecr.eu-west-1.amazonaws.com), and can only have one associated set of credentials (and DockerCredential). Attempting to associate one set of credentials with one ECR repo and another with another ECR repo in the same account and region will result in failures when using these credentials in the pipeline.
type DockerCredentialUsage ¶
type DockerCredentialUsage string
Defines which stages of a pipeline require the specified credentials.
Example:
dockerHubSecret := secretsmanager.Secret_FromSecretCompleteArn(this, jsii.String("DHSecret"), jsii.String("arn:aws:...")) // Only the image asset publishing actions will be granted read access to the secret. creds := pipelines.DockerCredential_DockerHub(dockerHubSecret, &ExternalDockerCredentialOptions{ Usages: []dockerCredentialUsage{ pipelines.*dockerCredentialUsage_ASSET_PUBLISHING, }, })
const ( // Synth/Build. DockerCredentialUsage_SYNTH DockerCredentialUsage = "SYNTH" // Self-update. DockerCredentialUsage_SELF_UPDATE DockerCredentialUsage = "SELF_UPDATE" // Asset publishing. DockerCredentialUsage_ASSET_PUBLISHING DockerCredentialUsage = "ASSET_PUBLISHING" )
type ECRSourceOptions ¶ added in v2.14.0
type ECRSourceOptions struct { // The action name used for this source in the CodePipeline. // Default: - The repository name. // ActionName *string `field:"optional" json:"actionName" yaml:"actionName"` // The image tag that will be checked for changes. // Default: latest. // ImageTag *string `field:"optional" json:"imageTag" yaml:"imageTag"` }
Options for ECR sources.
Example:
var repository iRepository pipelines.CodePipelineSource_Ecr(repository, &ECRSourceOptions{ ImageTag: jsii.String("latest"), })
type EcrDockerCredentialOptions ¶
type EcrDockerCredentialOptions struct { // An IAM role to assume prior to accessing the secret. // Default: - none. The current execution role will be used. // AssumeRole awsiam.IRole `field:"optional" json:"assumeRole" yaml:"assumeRole"` // Defines which stages of the pipeline should be granted access to these credentials. // Default: - all relevant stages (synth, self-update, asset publishing) are granted access. // Usages *[]DockerCredentialUsage `field:"optional" json:"usages" yaml:"usages"` }
Options for defining access for a Docker Credential composed of ECR repos.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var role role ecrDockerCredentialOptions := &EcrDockerCredentialOptions{ AssumeRole: role, Usages: []dockerCredentialUsage{ awscdk.Pipelines.*dockerCredentialUsage_SYNTH, }, }
type ExternalDockerCredentialOptions ¶
type ExternalDockerCredentialOptions struct { // An IAM role to assume prior to accessing the secret. // Default: - none. The current execution role will be used. // AssumeRole awsiam.IRole `field:"optional" json:"assumeRole" yaml:"assumeRole"` // The name of the JSON field of the secret which contains the secret/password. // Default: 'secret'. // SecretPasswordField *string `field:"optional" json:"secretPasswordField" yaml:"secretPasswordField"` // The name of the JSON field of the secret which contains the user/login name. // Default: 'username'. // SecretUsernameField *string `field:"optional" json:"secretUsernameField" yaml:"secretUsernameField"` // Defines which stages of the pipeline should be granted access to these credentials. // Default: - all relevant stages (synth, self-update, asset publishing) are granted access. // Usages *[]DockerCredentialUsage `field:"optional" json:"usages" yaml:"usages"` }
Options for defining credentials for a Docker Credential.
Example:
dockerHubSecret := secretsmanager.Secret_FromSecretCompleteArn(this, jsii.String("DHSecret"), jsii.String("arn:aws:...")) // Only the image asset publishing actions will be granted read access to the secret. creds := pipelines.DockerCredential_DockerHub(dockerHubSecret, &ExternalDockerCredentialOptions{ Usages: []dockerCredentialUsage{ pipelines.*dockerCredentialUsage_ASSET_PUBLISHING, }, })
type FileSet ¶
type FileSet interface { IFileSetProducer // Human-readable descriptor for this file set (does not need to be unique). Id() *string // The primary output of a file set producer. // // The primary output of a FileSet is itself. PrimaryOutput() FileSet // The Step that produces this FileSet. Producer() Step // Mark the given Step as the producer for this FileSet. // // This method can only be called once. ProducedBy(producer Step) // Return a string representation of this FileSet. ToString() *string }
A set of files traveling through the deployment pipeline.
Individual steps in the pipeline produce or consume `FileSet`s.
Example:
type myJenkinsStep struct { step } func newMyJenkinsStep(provider jenkinsProvider, input fileSet) *myJenkinsStep { this := &myJenkinsStep{} pipelines.NewStep_Override(this, jsii.String("MyJenkinsStep")) // This is necessary if your step accepts parameters, like environment variables, // that may contain outputs from other steps. It doesn't matter what the // structure is, as long as it contains the values that may contain outputs. this.DiscoverReferencedOutputs(map[string]map[string]interface{}{ "env": map[string]interface{}{ }, }) return this } func (this *myJenkinsStep) produceAction(stage iStage, options produceActionOptions) codePipelineActionFactoryResult { // This is where you control what type of Action gets added to the // CodePipeline *stage.AddAction(cpactions.NewJenkinsAction(&JenkinsActionProps{ // Copy 'actionName' and 'runOrder' from the options ActionName: options.ActionName, RunOrder: options.RunOrder, // Jenkins-specific configuration Type: cpactions.JenkinsActionType_TEST, JenkinsProvider: this.provider, ProjectName: jsii.String("MyJenkinsProject"), // Translate the FileSet into a codepipeline.Artifact Inputs: []artifact{ options.Artifacts.ToCodePipeline(this.input), }, })) return &codePipelineActionFactoryResult{ RunOrdersConsumed: jsii.Number(1), } }
func NewFileSet ¶
type FileSetLocation ¶
type FileSetLocation struct { // The (relative) directory where the FileSet is found. Directory *string `field:"required" json:"directory" yaml:"directory"` // The FileSet object. FileSet FileSet `field:"required" json:"fileSet" yaml:"fileSet"` }
Location of a FileSet consumed or produced by a ShellStep.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var fileSet fileSet fileSetLocation := &FileSetLocation{ Directory: jsii.String("directory"), FileSet: fileSet, }
type GitHubSourceOptions ¶
type GitHubSourceOptions struct { // The action name used for this source in the CodePipeline. // Default: - The repository string. // ActionName *string `field:"optional" json:"actionName" yaml:"actionName"` // A GitHub OAuth token to use for authentication. // // It is recommended to use a Secrets Manager `Secret` to obtain the token: // // “`ts // const oauth = cdk.SecretValue.secretsManager('my-github-token'); // “` // // The GitHub Personal Access Token should have these scopes: // // * **repo** - to read the repository // * **admin:repo_hook** - if you plan to use webhooks (true by default). // See: https://docs.aws.amazon.com/codepipeline/latest/userguide/GitHub-create-personal-token-CLI.html // // Default: - SecretValue.secretsManager('github-token') // Authentication awscdk.SecretValue `field:"optional" json:"authentication" yaml:"authentication"` // How AWS CodePipeline should be triggered. // // With the default value "WEBHOOK", a webhook is created in GitHub that triggers the action. // With "POLL", CodePipeline periodically checks the source for changes. // With "None", the action is not triggered through changes in the source. // // To use `WEBHOOK`, your GitHub Personal Access Token should have // **admin:repo_hook** scope (in addition to the regular **repo** scope). // Default: GitHubTrigger.WEBHOOK // Trigger awscodepipelineactions.GitHubTrigger `field:"optional" json:"trigger" yaml:"trigger"` }
Options for GitHub sources.
Example:
pipelines.CodePipelineSource_GitHub(jsii.String("org/repo"), jsii.String("branch"), &GitHubSourceOptions{ // This is optional Authentication: cdk.SecretValue_SecretsManager(jsii.String("my-token")), })
type ICodePipelineActionFactory ¶
type ICodePipelineActionFactory interface { // Create the desired Action and add it to the pipeline. ProduceAction(stage awscodepipeline.IStage, options *ProduceActionOptions) *CodePipelineActionFactoryResult }
Factory for explicit CodePipeline Actions.
If you have specific types of Actions you want to add to a CodePipeline, write a subclass of `Step` that implements this interface, and add the action or actions you want in the `produce` method.
There needs to be a level of indirection here, because some aspects of the Action creation need to be controlled by the workflow engine (name and runOrder). All the rest of the properties are controlled by the factory.
type IFileSetProducer ¶
type IFileSetProducer interface { // The `FileSet` produced by this file set producer. // Default: - This producer doesn't produce any file set. // PrimaryOutput() FileSet }
Any class that produces, or is itself, a `FileSet`.
Steps implicitly produce a primary FileSet as an output.
type ManualApprovalStep ¶
type ManualApprovalStep interface { Step // The comment associated with this manual approval. // Default: - No comment. // Comment() *string // StackOutputReferences this step consumes. ConsumedStackOutputs() *[]StackOutputReference // Return the steps this step depends on, based on the FileSets it requires. Dependencies() *[]Step // The list of FileSets consumed by this Step. DependencyFileSets() *[]FileSet // Identifier for this step. Id() *string // Whether or not this is a Source step. // // What it means to be a Source step depends on the engine. IsSource() *bool // The primary FileSet produced by this Step. // // Not all steps produce an output FileSet--if they do // you can substitute the `Step` object for the `FileSet` object. PrimaryOutput() FileSet // Add an additional FileSet to the set of file sets required by this step. // // This will lead to a dependency on the producer of that file set. AddDependencyFileSet(fs FileSet) // Add a dependency on another step. AddStepDependency(step Step) // Configure the given FileSet as the primary output of this step. ConfigurePrimaryOutput(fs FileSet) // Crawl the given structure for references to StepOutputs and add dependencies on all steps found. // // Should be called in the constructor of subclasses based on what the user // passes in as construction properties. The format of the structure passed in // here does not have to correspond exactly to what gets rendered into the // engine, it just needs to contain the same data. DiscoverReferencedOutputs(structure interface{}) // Return a string representation of this Step. ToString() *string }
A manual approval step.
If this step is added to a Pipeline, the Pipeline will be paused waiting for a human to resume it
Only engines that support pausing the deployment will support this step type.
Example:
var pipeline codePipeline preprod := NewMyApplicationStage(this, jsii.String("PreProd")) prod := NewMyApplicationStage(this, jsii.String("Prod")) pipeline.AddStage(preprod, &AddStageOpts{ Post: []step{ pipelines.NewShellStep(jsii.String("Validate Endpoint"), &ShellStepProps{ Commands: []*string{ jsii.String("curl -Ssf https://my.webservice.com/"), }, }), }, }) pipeline.AddStage(prod, &AddStageOpts{ Pre: []*step{ pipelines.NewManualApprovalStep(jsii.String("PromoteToProd")), }, })
func NewManualApprovalStep ¶
func NewManualApprovalStep(id *string, props *ManualApprovalStepProps) ManualApprovalStep
type ManualApprovalStepProps ¶
type ManualApprovalStepProps struct { // The comment to display with this manual approval. // Default: - No comment. // Comment *string `field:"optional" json:"comment" yaml:"comment"` }
Construction properties for a `ManualApprovalStep`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" manualApprovalStepProps := &ManualApprovalStepProps{ Comment: jsii.String("comment"), }
type PermissionsBroadeningCheckProps ¶
type PermissionsBroadeningCheckProps struct { // The CDK Stage object to check the stacks of. // // This should be the same Stage object you are passing to `addStage()`. Stage awscdk.Stage `field:"required" json:"stage" yaml:"stage"` // Topic to send notifications when a human needs to give manual confirmation. // Default: - no notification. // NotificationTopic awssns.ITopic `field:"optional" json:"notificationTopic" yaml:"notificationTopic"` }
Properties for a `PermissionsBroadeningCheck`.
Example:
var pipeline codePipeline stage := NewMyApplicationStage(this, jsii.String("MyApplication")) pipeline.AddStage(stage, &AddStageOpts{ Pre: []step{ pipelines.NewConfirmPermissionsBroadening(jsii.String("Check"), &PermissionsBroadeningCheckProps{ Stage: *Stage, }), }, })
type PipelineBase ¶
type PipelineBase interface { constructs.Construct // The FileSet tha contains the cloud assembly. // // This is the primary output of the synth step. CloudAssemblyFileSet() FileSet // The tree node. Node() constructs.Node // The build step that produces the CDK Cloud Assembly. Synth() IFileSetProducer // The waves in this pipeline. Waves() *[]Wave // Deploy a single Stage by itself. // // Add a Stage to the pipeline, to be deployed in sequence with other // Stages added to the pipeline. All Stacks in the stage will be deployed // in an order automatically determined by their relative dependencies. AddStage(stage awscdk.Stage, options *AddStageOpts) StageDeployment // Add a Wave to the pipeline, for deploying multiple Stages in parallel. // // Use the return object of this method to deploy multiple stages in parallel. // // Example: // // “`ts // declare const pipeline: pipelines.CodePipeline; // // const wave = pipeline.addWave('MyWave'); // wave.addStage(new MyApplicationStage(this, 'Stage1')); // wave.addStage(new MyApplicationStage(this, 'Stage2')); // “`. AddWave(id *string, options *WaveOptions) Wave // Send the current pipeline definition to the engine, and construct the pipeline. // // It is not possible to modify the pipeline after calling this method. BuildPipeline() // Implemented by subclasses to do the actual pipeline construction. DoBuildPipeline() // Returns a string representation of this construct. ToString() *string }
A generic CDK Pipelines pipeline.
Different deployment systems will provide subclasses of `Pipeline` that generate the deployment infrastructure necessary to deploy CDK apps, specific to that system.
This library comes with the `CodePipeline` class, which uses AWS CodePipeline to deploy CDK apps.
The actual pipeline infrastructure is constructed (by invoking the engine) when `buildPipeline()` is called, or when `app.synth()` is called (whichever happens first).
type PipelineBaseProps ¶
type PipelineBaseProps struct { // The build step that produces the CDK Cloud Assembly. // // The primary output of this step needs to be the `cdk.out` directory // generated by the `cdk synth` command. // // If you use a `ShellStep` here and you don't configure an output directory, // the output directory will automatically be assumed to be `cdk.out`. Synth IFileSetProducer `field:"required" json:"synth" yaml:"synth"` }
Properties for a `Pipeline`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var fileSetProducer iFileSetProducer pipelineBaseProps := &PipelineBaseProps{ Synth: fileSetProducer, }
type ProduceActionOptions ¶
type ProduceActionOptions struct { // Name the action should get. ActionName *string `field:"required" json:"actionName" yaml:"actionName"` // Helper object to translate FileSets to CodePipeline Artifacts. Artifacts ArtifactMap `field:"required" json:"artifacts" yaml:"artifacts"` // The pipeline the action is being generated for. Pipeline CodePipeline `field:"required" json:"pipeline" yaml:"pipeline"` // RunOrder the action should get. RunOrder *float64 `field:"required" json:"runOrder" yaml:"runOrder"` // Scope in which to create constructs. Scope constructs.Construct `field:"required" json:"scope" yaml:"scope"` // Helper object to produce variables exported from stack deployments. // // If your step references outputs from a stack deployment, use // this to map the output references to Codepipeline variable names. // // Note - Codepipeline variables can only be referenced in action // configurations. StackOutputsMap StackOutputsMap `field:"required" json:"stackOutputsMap" yaml:"stackOutputsMap"` // Whether or not this action is inserted before self mutation. // // If it is, the action should take care to reflect some part of // its own definition in the pipeline action definition, to // trigger a restart after self-mutation (if necessary). // Default: false. // BeforeSelfMutation *bool `field:"optional" json:"beforeSelfMutation" yaml:"beforeSelfMutation"` // If this action factory creates a CodeBuild step, default options to inherit. // Default: - No CodeBuild project defaults. // CodeBuildDefaults *CodeBuildOptions `field:"optional" json:"codeBuildDefaults" yaml:"codeBuildDefaults"` // An input artifact that CodeBuild projects that don't actually need an input artifact can use. // // CodeBuild Projects MUST have an input artifact in order to be added to the Pipeline. If // the Project doesn't actually care about its input (it can be anything), it can use the // Artifact passed here. // Default: - A fallback artifact does not exist. // FallbackArtifact awscodepipeline.Artifact `field:"optional" json:"fallbackArtifact" yaml:"fallbackArtifact"` // If this step is producing outputs, the variables namespace assigned to it. // // Pass this on to the Action you are creating. // Default: - Step doesn't produce any outputs. // VariablesNamespace *string `field:"optional" json:"variablesNamespace" yaml:"variablesNamespace"` }
Options for the `CodePipelineActionFactory.produce()` method.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import constructs "github.com/aws/constructs-go/constructs" var artifact artifact var artifactMap artifactMap var bucket bucket var buildImage iBuildImage var buildSpec buildSpec var cache cache var codePipeline codePipeline var construct construct var fileSystemLocation iFileSystemLocation var fleet fleet var logGroup logGroup var policyStatement policyStatement var securityGroup securityGroup var stackOutputsMap stackOutputsMap var subnet subnet var subnetFilter subnetFilter var value interface{} var vpc vpc produceActionOptions := &ProduceActionOptions{ ActionName: jsii.String("actionName"), Artifacts: artifactMap, Pipeline: codePipeline, RunOrder: jsii.Number(123), Scope: construct, StackOutputsMap: stackOutputsMap, // the properties below are optional BeforeSelfMutation: jsii.Boolean(false), CodeBuildDefaults: &CodeBuildOptions{ BuildEnvironment: &BuildEnvironment{ BuildImage: buildImage, Certificate: &BuildEnvironmentCertificate{ Bucket: bucket, ObjectKey: jsii.String("objectKey"), }, ComputeType: awscdk.Aws_codebuild.ComputeType_SMALL, EnvironmentVariables: map[string]buildEnvironmentVariable{ "environmentVariablesKey": &buildEnvironmentVariable{ "value": value, // the properties below are optional "type": awscdk.*Aws_codebuild.BuildEnvironmentVariableType_PLAINTEXT, }, }, Fleet: fleet, Privileged: jsii.Boolean(false), }, Cache: cache, FileSystemLocations: []*iFileSystemLocation{ fileSystemLocation, }, Logging: &LoggingOptions{ CloudWatch: &CloudWatchLoggingOptions{ Enabled: jsii.Boolean(false), LogGroup: logGroup, Prefix: jsii.String("prefix"), }, S3: &S3LoggingOptions{ Bucket: bucket, // the properties below are optional Enabled: jsii.Boolean(false), Encrypted: jsii.Boolean(false), Prefix: jsii.String("prefix"), }, }, PartialBuildSpec: buildSpec, RolePolicy: []*policyStatement{ policyStatement, }, SecurityGroups: []iSecurityGroup{ securityGroup, }, SubnetSelection: &SubnetSelection{ AvailabilityZones: []*string{ jsii.String("availabilityZones"), }, OnePerAz: jsii.Boolean(false), SubnetFilters: []*subnetFilter{ subnetFilter, }, SubnetGroupName: jsii.String("subnetGroupName"), Subnets: []iSubnet{ subnet, }, SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED, }, Timeout: cdk.Duration_Minutes(jsii.Number(30)), Vpc: vpc, }, FallbackArtifact: artifact, VariablesNamespace: jsii.String("variablesNamespace"), }
type S3SourceOptions ¶
type S3SourceOptions struct { // The action name used for this source in the CodePipeline. // Default: - The bucket name. // ActionName *string `field:"optional" json:"actionName" yaml:"actionName"` // The role that will be assumed by the pipeline prior to executing the `S3Source` action. // Default: - a new role will be generated. // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` // How should CodePipeline detect source changes for this Action. // // Note that if this is S3Trigger.EVENTS, you need to make sure to include the source Bucket in a CloudTrail Trail, // as otherwise the CloudWatch Events will not be emitted. // See: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/log-s3-data-events.html // // Default: S3Trigger.POLL // Trigger awscodepipelineactions.S3Trigger `field:"optional" json:"trigger" yaml:"trigger"` }
Options for S3 sources.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var role role s3SourceOptions := &S3SourceOptions{ ActionName: jsii.String("actionName"), Role: role, Trigger: awscdk.Aws_codepipeline_actions.S3Trigger_NONE, }
type ShellStep ¶
type ShellStep interface { Step // Commands to run. Commands() *[]*string // StackOutputReferences this step consumes. ConsumedStackOutputs() *[]StackOutputReference // Return the steps this step depends on, based on the FileSets it requires. Dependencies() *[]Step // The list of FileSets consumed by this Step. DependencyFileSets() *[]FileSet // Environment variables to set. // Default: - No environment variables. // Env() *map[string]*string // Set environment variables based on Stack Outputs. // Default: - No environment variables created from stack outputs. // EnvFromCfnOutputs() *map[string]StackOutputReference // Identifier for this step. Id() *string // Input FileSets. // // A list of `(FileSet, directory)` pairs, which are a copy of the // input properties. This list should not be modified directly. Inputs() *[]*FileSetLocation // Installation commands to run before the regular commands. // // For deployment engines that support it, install commands will be classified // differently in the job history from the regular `commands`. // Default: - No installation commands. // InstallCommands() *[]*string // Whether or not this is a Source step. // // What it means to be a Source step depends on the engine. IsSource() *bool // Output FileSets. // // A list of `(FileSet, directory)` pairs, which are a copy of the // input properties. This list should not be modified directly. Outputs() *[]*FileSetLocation // The primary FileSet produced by this Step. // // Not all steps produce an output FileSet--if they do // you can substitute the `Step` object for the `FileSet` object. PrimaryOutput() FileSet // Add an additional FileSet to the set of file sets required by this step. // // This will lead to a dependency on the producer of that file set. AddDependencyFileSet(fs FileSet) // Add an additional output FileSet based on a directory. // // After running the script, the contents of the given directory // will be exported as a `FileSet`. Use the `FileSet` as the // input to another step. // // Multiple calls with the exact same directory name string (not normalized) // will return the same FileSet. AddOutputDirectory(directory *string) FileSet // Add a dependency on another step. AddStepDependency(step Step) // Configure the given FileSet as the primary output of this step. ConfigurePrimaryOutput(fs FileSet) // Crawl the given structure for references to StepOutputs and add dependencies on all steps found. // // Should be called in the constructor of subclasses based on what the user // passes in as construction properties. The format of the structure passed in // here does not have to correspond exactly to what gets rendered into the // engine, it just needs to contain the same data. DiscoverReferencedOutputs(structure interface{}) // Configure the given output directory as primary output. // // If no primary output has been configured yet, this directory // will become the primary output of this ShellStep, otherwise this // method will throw if the given directory is different than the // currently configured primary output directory. PrimaryOutputDirectory(directory *string) FileSet // Return a string representation of this Step. ToString() *string }
Run shell script commands in the pipeline.
This is a generic step designed to be deployment engine agnostic.
Example:
// Modern API modernPipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ SelfMutation: jsii.Boolean(false), Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), }) // Original API cloudAssemblyArtifact := codepipeline.NewArtifact() originalPipeline := pipelines.NewCdkPipeline(this, jsii.String("Pipeline"), &cdkPipelineProps{ selfMutating: jsii.Boolean(false), cloudAssemblyArtifact: cloudAssemblyArtifact, })
func NewShellStep ¶
func NewShellStep(id *string, props *ShellStepProps) ShellStep
type ShellStepProps ¶
type ShellStepProps struct { // Commands to run. Commands *[]*string `field:"required" json:"commands" yaml:"commands"` // Additional FileSets to put in other directories. // // Specifies a mapping from directory name to FileSets. During the // script execution, the FileSets will be available in the directories // indicated. // // The directory names may be relative. For example, you can put // the main input and an additional input side-by-side with the // following configuration: // // “`ts // const script = new pipelines.ShellStep('MainScript', { // commands: ['npm ci','npm run build','npx cdk synth'], // input: pipelines.CodePipelineSource.gitHub('org/source1', 'main'), // additionalInputs: { // '../siblingdir': pipelines.CodePipelineSource.gitHub('org/source2', 'main'), // } // }); // “`. // Default: - No additional inputs. // AdditionalInputs *map[string]IFileSetProducer `field:"optional" json:"additionalInputs" yaml:"additionalInputs"` // Environment variables to set. // Default: - No environment variables. // Env *map[string]*string `field:"optional" json:"env" yaml:"env"` // Set environment variables based on Stack Outputs. // // `ShellStep`s following stack or stage deployments may // access the `CfnOutput`s of those stacks to get access to // --for example--automatically generated resource names or // endpoint URLs. // Default: - No environment variables created from stack outputs. // EnvFromCfnOutputs *map[string]awscdk.CfnOutput `field:"optional" json:"envFromCfnOutputs" yaml:"envFromCfnOutputs"` // FileSet to run these scripts on. // // The files in the FileSet will be placed in the working directory when // the script is executed. Use `additionalInputs` to download file sets // to other directories as well. // Default: - No input specified. // Input IFileSetProducer `field:"optional" json:"input" yaml:"input"` // Installation commands to run before the regular commands. // // For deployment engines that support it, install commands will be classified // differently in the job history from the regular `commands`. // Default: - No installation commands. // InstallCommands *[]*string `field:"optional" json:"installCommands" yaml:"installCommands"` // The directory that will contain the primary output fileset. // // After running the script, the contents of the given directory // will be treated as the primary output of this Step. // Default: - No primary output. // PrimaryOutputDirectory *string `field:"optional" json:"primaryOutputDirectory" yaml:"primaryOutputDirectory"` }
Construction properties for a `ShellStep`.
Example:
// Modern API modernPipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ SelfMutation: jsii.Boolean(false), Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), }) // Original API cloudAssemblyArtifact := codepipeline.NewArtifact() originalPipeline := pipelines.NewCdkPipeline(this, jsii.String("Pipeline"), &cdkPipelineProps{ selfMutating: jsii.Boolean(false), cloudAssemblyArtifact: cloudAssemblyArtifact, })
type StackAsset ¶
type StackAsset struct { // Asset identifier. AssetId *string `field:"required" json:"assetId" yaml:"assetId"` // Absolute asset manifest path. // // This needs to be made relative at a later point in time, but when this // information is parsed we don't know about the root cloud assembly yet. AssetManifestPath *string `field:"required" json:"assetManifestPath" yaml:"assetManifestPath"` // Asset selector to pass to `cdk-assets`. AssetSelector *string `field:"required" json:"assetSelector" yaml:"assetSelector"` // Type of asset to publish. AssetType AssetType `field:"required" json:"assetType" yaml:"assetType"` // Does this asset represent the CloudFormation template for the stack. // Default: false. // IsTemplate *bool `field:"required" json:"isTemplate" yaml:"isTemplate"` // Role ARN to assume to publish. // Default: - No need to assume any role. // AssetPublishingRoleArn *string `field:"optional" json:"assetPublishingRoleArn" yaml:"assetPublishingRoleArn"` }
An asset used by a Stack.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" stackAsset := &StackAsset{ AssetId: jsii.String("assetId"), AssetManifestPath: jsii.String("assetManifestPath"), AssetSelector: jsii.String("assetSelector"), AssetType: awscdk.Pipelines.AssetType_FILE, IsTemplate: jsii.Boolean(false), // the properties below are optional AssetPublishingRoleArn: jsii.String("assetPublishingRoleArn"), }
type StackDeployment ¶
type StackDeployment interface { // Template path on disk to CloudAssembly. AbsoluteTemplatePath() *string // Account where the stack should be deployed. // Default: - Pipeline account. // Account() *string // Assets referenced by this stack. Assets() *[]*StackAsset // Role to assume before deploying this stack. // Default: - Don't assume any role. // AssumeRoleArn() *string // Steps that take place after stack is prepared but before stack deploys. // // Your pipeline engine may not disable `prepareStep`. ChangeSet() *[]Step // Construct path for this stack. ConstructPath() *string // Execution role to pass to CloudFormation. // Default: - No execution role. // ExecutionRoleArn() *string // Steps to execute after stack deploys. Post() *[]Step // Steps that take place before stack is prepared. // // If your pipeline engine disables 'prepareStep', then this will happen before stack deploys. Pre() *[]Step // Region where the stack should be deployed. // Default: - Pipeline region. // Region() *string // Artifact ID for this stack. StackArtifactId() *string // Other stacks this stack depends on. StackDependencies() *[]StackDeployment // Name for this stack. StackName() *string // Tags to apply to the stack. Tags() *map[string]*string // The asset that represents the CloudFormation template for this stack. TemplateAsset() *StackAsset // The S3 URL which points to the template asset location in the publishing bucket. // // This is `undefined` if the stack template is not published. Use the // `DefaultStackSynthesizer` to ensure it is. // // Example value: `https://bucket.s3.amazonaws.com/object/key` TemplateUrl() *string // Add a dependency on another stack. AddStackDependency(stackDeployment StackDeployment) // Adds steps to each phase of the stack. AddStackSteps(pre *[]Step, changeSet *[]Step, post *[]Step) }
Deployment of a single Stack.
You don't need to instantiate this class -- it will be automatically instantiated as necessary when you add a `Stage` to a pipeline.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var cloudFormationStackArtifact cloudFormationStackArtifact stackDeployment := awscdk.Pipelines.StackDeployment_FromArtifact(cloudFormationStackArtifact)
func StackDeployment_FromArtifact ¶
func StackDeployment_FromArtifact(stackArtifact cxapi.CloudFormationStackArtifact) StackDeployment
Build a `StackDeployment` from a Stack Artifact in a Cloud Assembly.
type StackDeploymentProps ¶
type StackDeploymentProps struct { // Template path on disk to cloud assembly (cdk.out). AbsoluteTemplatePath *string `field:"required" json:"absoluteTemplatePath" yaml:"absoluteTemplatePath"` // Construct path for this stack. ConstructPath *string `field:"required" json:"constructPath" yaml:"constructPath"` // Artifact ID for this stack. StackArtifactId *string `field:"required" json:"stackArtifactId" yaml:"stackArtifactId"` // Name for this stack. StackName *string `field:"required" json:"stackName" yaml:"stackName"` // Account where the stack should be deployed. // Default: - Pipeline account. // Account *string `field:"optional" json:"account" yaml:"account"` // Assets referenced by this stack. // Default: - No assets. // Assets *[]*StackAsset `field:"optional" json:"assets" yaml:"assets"` // Role to assume before deploying this stack. // Default: - Don't assume any role. // AssumeRoleArn *string `field:"optional" json:"assumeRoleArn" yaml:"assumeRoleArn"` // Execution role to pass to CloudFormation. // Default: - No execution role. // ExecutionRoleArn *string `field:"optional" json:"executionRoleArn" yaml:"executionRoleArn"` // Region where the stack should be deployed. // Default: - Pipeline region. // Region *string `field:"optional" json:"region" yaml:"region"` // Tags to apply to the stack. // Default: - No tags. // Tags *map[string]*string `field:"optional" json:"tags" yaml:"tags"` // The S3 URL which points to the template asset location in the publishing bucket. // Default: - Stack template is not published. // TemplateS3Uri *string `field:"optional" json:"templateS3Uri" yaml:"templateS3Uri"` }
Properties for a `StackDeployment`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" stackDeploymentProps := &StackDeploymentProps{ AbsoluteTemplatePath: jsii.String("absoluteTemplatePath"), ConstructPath: jsii.String("constructPath"), StackArtifactId: jsii.String("stackArtifactId"), StackName: jsii.String("stackName"), // the properties below are optional Account: jsii.String("account"), Assets: []stackAsset{ &stackAsset{ AssetId: jsii.String("assetId"), AssetManifestPath: jsii.String("assetManifestPath"), AssetSelector: jsii.String("assetSelector"), AssetType: awscdk.Pipelines.AssetType_FILE, IsTemplate: jsii.Boolean(false), // the properties below are optional AssetPublishingRoleArn: jsii.String("assetPublishingRoleArn"), }, }, AssumeRoleArn: jsii.String("assumeRoleArn"), ExecutionRoleArn: jsii.String("executionRoleArn"), Region: jsii.String("region"), Tags: map[string]*string{ "tagsKey": jsii.String("tags"), }, TemplateS3Uri: jsii.String("templateS3Uri"), }
type StackOutputReference ¶
type StackOutputReference interface { // Output name of the producing stack. OutputName() *string // A human-readable description of the producing stack. StackDescription() *string // Whether or not this stack output is being produced by the given Stack deployment. IsProducedBy(stack StackDeployment) *bool }
A Reference to a Stack Output.
Example:
type myLambdaStep struct { step stackOutputReference stackOutputReference } func newMyLambdaStep(fn function, stackOutput cfnOutput) *myLambdaStep { this := &myLambdaStep{} pipelines.NewStep_Override(this, jsii.String("MyLambdaStep")) this.stackOutputReference = pipelines.stackOutputReference_FromCfnOutput(stackOutput) return this } func (this *myLambdaStep) produceAction(stage iStage, options produceActionOptions) codePipelineActionFactoryResult { *stage.AddAction(cpactions.NewLambdaInvokeAction(&LambdaInvokeActionProps{ ActionName: options.ActionName, RunOrder: options.RunOrder, // Map the reference to the variable name the CDK has generated for you. UserParameters: map[string]interface{}{ "stackOutput": options.stackOutputsMap.toCodePipeline(this.stackOutputReference), }, Lambda: this.fn, })) return &codePipelineActionFactoryResult{ RunOrdersConsumed: jsii.Number(1), } }public get consumedStackOutputs(): pipelines.StackOutputReference[] { return [this.stackOutputReference]; }
func StackOutputReference_FromCfnOutput ¶
func StackOutputReference_FromCfnOutput(output awscdk.CfnOutput) StackOutputReference
Create a StackOutputReference that references the given CfnOutput.
type StackOutputsMap ¶ added in v2.60.0
type StackOutputsMap interface { // Return the matching variable reference string for a StackOutputReference. ToCodePipeline(x StackOutputReference) *string }
Translate stack outputs to CodePipeline variable references.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var pipelineBase pipelineBase stackOutputsMap := awscdk.Pipelines.NewStackOutputsMap(pipelineBase)
func NewStackOutputsMap ¶ added in v2.60.0
func NewStackOutputsMap(pipeline PipelineBase) StackOutputsMap
type StackSteps ¶
type StackSteps struct { // The stack you want the steps to run in. Stack awscdk.Stack `field:"required" json:"stack" yaml:"stack"` // Steps that execute after stack is prepared but before stack is deployed. // Default: - no additional steps. // ChangeSet *[]Step `field:"optional" json:"changeSet" yaml:"changeSet"` // Steps that execute after stack is deployed. // Default: - no additional steps. // Post *[]Step `field:"optional" json:"post" yaml:"post"` // Steps that execute before stack is prepared. // Default: - no additional steps. // Pre *[]Step `field:"optional" json:"pre" yaml:"pre"` }
Instructions for additional steps that are run at stack level.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var stack stack var step step stackSteps := &StackSteps{ Stack: stack, // the properties below are optional ChangeSet: []*step{ step, }, Post: []*step{ step, }, Pre: []*step{ step, }, }
type StageDeployment ¶
type StageDeployment interface { // Additional steps that are run after all of the stacks in the stage. Post() *[]Step // Additional steps that are run before any of the stacks in the stage. Pre() *[]Step // Determine if all stacks in stage should be deployed with prepare step or not. PrepareStep() *bool // The stacks deployed in this stage. Stacks() *[]StackDeployment // Instructions for additional steps that are run at stack level. StackSteps() *[]*StackSteps // The display name of this stage. StageName() *string // Add an additional step to run after all of the stacks in this stage. AddPost(steps ...Step) // Add an additional step to run before any of the stacks in this stage. AddPre(steps ...Step) }
Deployment of a single `Stage`.
A `Stage` consists of one or more `Stacks`, which will be deployed in dependency order.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var stack stack var stage stage var step step stageDeployment := awscdk.Pipelines.StageDeployment_FromStage(stage, &StageDeploymentProps{ Post: []*step{ step, }, Pre: []*step{ step, }, StackSteps: []stackSteps{ &stackSteps{ Stack: stack, // the properties below are optional ChangeSet: []*step{ step, }, Post: []*step{ step, }, Pre: []*step{ step, }, }, }, StageName: jsii.String("stageName"), })
func StageDeployment_FromStage ¶
func StageDeployment_FromStage(stage awscdk.Stage, props *StageDeploymentProps) StageDeployment
Create a new `StageDeployment` from a `Stage`.
Synthesizes the target stage, and deployes the stacks found inside in dependency order.
type StageDeploymentProps ¶
type StageDeploymentProps struct { // Additional steps to run after all of the stacks in the stage. // Default: - No additional steps. // Post *[]Step `field:"optional" json:"post" yaml:"post"` // Additional steps to run before any of the stacks in the stage. // Default: - No additional steps. // Pre *[]Step `field:"optional" json:"pre" yaml:"pre"` // Instructions for additional steps that are run at the stack level. // Default: - No additional instructions. // StackSteps *[]*StackSteps `field:"optional" json:"stackSteps" yaml:"stackSteps"` // Stage name to use in the pipeline. // Default: - Use Stage's construct ID. // StageName *string `field:"optional" json:"stageName" yaml:"stageName"` }
Properties for a `StageDeployment`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var stack stack var step step stageDeploymentProps := &StageDeploymentProps{ Post: []*step{ step, }, Pre: []*step{ step, }, StackSteps: []stackSteps{ &stackSteps{ Stack: stack, // the properties below are optional ChangeSet: []*step{ step, }, Post: []*step{ step, }, Pre: []*step{ step, }, }, }, StageName: jsii.String("stageName"), }
type Step ¶
type Step interface { IFileSetProducer // StackOutputReferences this step consumes. ConsumedStackOutputs() *[]StackOutputReference // Return the steps this step depends on, based on the FileSets it requires. Dependencies() *[]Step // The list of FileSets consumed by this Step. DependencyFileSets() *[]FileSet // Identifier for this step. Id() *string // Whether or not this is a Source step. // // What it means to be a Source step depends on the engine. IsSource() *bool // The primary FileSet produced by this Step. // // Not all steps produce an output FileSet--if they do // you can substitute the `Step` object for the `FileSet` object. PrimaryOutput() FileSet // Add an additional FileSet to the set of file sets required by this step. // // This will lead to a dependency on the producer of that file set. AddDependencyFileSet(fs FileSet) // Add a dependency on another step. AddStepDependency(step Step) // Configure the given FileSet as the primary output of this step. ConfigurePrimaryOutput(fs FileSet) // Crawl the given structure for references to StepOutputs and add dependencies on all steps found. // // Should be called in the constructor of subclasses based on what the user // passes in as construction properties. The format of the structure passed in // here does not have to correspond exactly to what gets rendered into the // engine, it just needs to contain the same data. DiscoverReferencedOutputs(structure interface{}) // Return a string representation of this Step. ToString() *string }
A generic Step which can be added to a Pipeline.
Steps can be used to add Sources, Build Actions and Validations to your pipeline.
This class is abstract. See specific subclasses of Step for useful steps to add to your Pipeline.
Example:
type myJenkinsStep struct { step } func newMyJenkinsStep(provider jenkinsProvider, input fileSet) *myJenkinsStep { this := &myJenkinsStep{} pipelines.NewStep_Override(this, jsii.String("MyJenkinsStep")) // This is necessary if your step accepts parameters, like environment variables, // that may contain outputs from other steps. It doesn't matter what the // structure is, as long as it contains the values that may contain outputs. this.DiscoverReferencedOutputs(map[string]map[string]interface{}{ "env": map[string]interface{}{ }, }) return this } func (this *myJenkinsStep) produceAction(stage iStage, options produceActionOptions) codePipelineActionFactoryResult { // This is where you control what type of Action gets added to the // CodePipeline *stage.AddAction(cpactions.NewJenkinsAction(&JenkinsActionProps{ // Copy 'actionName' and 'runOrder' from the options ActionName: options.ActionName, RunOrder: options.RunOrder, // Jenkins-specific configuration Type: cpactions.JenkinsActionType_TEST, JenkinsProvider: this.provider, ProjectName: jsii.String("MyJenkinsProject"), // Translate the FileSet into a codepipeline.Artifact Inputs: []artifact{ options.Artifacts.ToCodePipeline(this.input), }, })) return &codePipelineActionFactoryResult{ RunOrdersConsumed: jsii.Number(1), } }
type Wave ¶
type Wave interface { // Identifier for this Wave. Id() *string // Additional steps that are run after all of the stages in the wave. Post() *[]Step // Additional steps that are run before any of the stages in the wave. Pre() *[]Step // The stages that are deployed in this wave. Stages() *[]StageDeployment // Add an additional step to run after all of the stages in this wave. AddPost(steps ...Step) // Add an additional step to run before any of the stages in this wave. AddPre(steps ...Step) // Add a Stage to this wave. // // It will be deployed in parallel with all other stages in this // wave. AddStage(stage awscdk.Stage, options *AddStageOpts) StageDeployment }
Multiple stages that are deployed in parallel.
Example:
var pipeline codePipeline europeWave := pipeline.AddWave(jsii.String("Europe")) europeWave.AddStage(NewMyApplicationStage(this, jsii.String("Ireland"), &stageProps{ Env: &Environment{ Region: jsii.String("eu-west-1"), }, })) europeWave.AddStage(NewMyApplicationStage(this, jsii.String("Germany"), &stageProps{ Env: &Environment{ Region: jsii.String("eu-central-1"), }, }))
type WaveOptions ¶
type WaveOptions struct { // Additional steps to run after all of the stages in the wave. // Default: - No additional steps. // Post *[]Step `field:"optional" json:"post" yaml:"post"` // Additional steps to run before any of the stages in the wave. // Default: - No additional steps. // Pre *[]Step `field:"optional" json:"pre" yaml:"pre"` }
Options to pass to `addWave`.
Example:
pipeline := pipelines.NewCodePipeline(this, jsii.String("Pipeline"), &CodePipelineProps{ Synth: pipelines.NewShellStep(jsii.String("Synth"), &ShellStepProps{ Input: pipelines.CodePipelineSource_Connection(jsii.String("my-org/my-app"), jsii.String("main"), &ConnectionSourceOptions{ ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:222222222222:connection/7d2469ff-514a-4e4f-9003-5ca4a43cdc41"), }), Commands: []*string{ jsii.String("npm ci"), jsii.String("npm run build"), jsii.String("npx cdk synth"), }, }), // Turn this on because the pipeline uses Docker image assets DockerEnabledForSelfMutation: jsii.Boolean(true), }) pipeline.AddWave(jsii.String("MyWave"), &WaveOptions{ Post: []step{ pipelines.NewCodeBuildStep(jsii.String("RunApproval"), &CodeBuildStepProps{ Commands: []*string{ jsii.String("command-from-image"), }, BuildEnvironment: &BuildEnvironment{ // The user of a Docker image asset in the pipeline requires turning on // 'dockerEnabledForSelfMutation'. BuildImage: codebuild.LinuxBuildImage_FromAsset(this, jsii.String("Image"), &DockerImageAssetProps{ Directory: jsii.String("./docker-image"), }), }, }), }, })
type WaveProps ¶
type WaveProps struct { // Additional steps to run after all of the stages in the wave. // Default: - No additional steps. // Post *[]Step `field:"optional" json:"post" yaml:"post"` // Additional steps to run before any of the stages in the wave. // Default: - No additional steps. // Pre *[]Step `field:"optional" json:"pre" yaml:"pre"` }
Construction properties for a `Wave`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var step step waveProps := &WaveProps{ Post: []*step{ step, }, Pre: []*step{ step, }, }
Source Files ¶
- AddStageOpts.go
- ArtifactMap.go
- ArtifactMap__checks.go
- AssetType.go
- CodeBuildOptions.go
- CodeBuildStep.go
- CodeBuildStepProps.go
- CodeBuildStep__checks.go
- CodeCommitSourceOptions.go
- CodePipeline.go
- CodePipelineActionFactoryResult.go
- CodePipelineFileSet.go
- CodePipelineFileSet__checks.go
- CodePipelineProps.go
- CodePipelineSource.go
- CodePipelineSource__checks.go
- CodePipeline__checks.go
- ConfirmPermissionsBroadening.go
- ConfirmPermissionsBroadening__checks.go
- ConnectionSourceOptions.go
- DockerCredential.go
- DockerCredentialUsage.go
- DockerCredential__checks.go
- ECRSourceOptions.go
- EcrDockerCredentialOptions.go
- ExternalDockerCredentialOptions.go
- FileSet.go
- FileSetLocation.go
- FileSet__checks.go
- GitHubSourceOptions.go
- ICodePipelineActionFactory.go
- ICodePipelineActionFactory__checks.go
- IFileSetProducer.go
- ManualApprovalStep.go
- ManualApprovalStepProps.go
- ManualApprovalStep__checks.go
- PermissionsBroadeningCheckProps.go
- PipelineBase.go
- PipelineBaseProps.go
- PipelineBase__checks.go
- ProduceActionOptions.go
- S3SourceOptions.go
- ShellStep.go
- ShellStepProps.go
- ShellStep__checks.go
- StackAsset.go
- StackDeployment.go
- StackDeploymentProps.go
- StackDeployment__checks.go
- StackOutputReference.go
- StackOutputReference__checks.go
- StackOutputsMap.go
- StackOutputsMap__checks.go
- StackSteps.go
- StageDeployment.go
- StageDeploymentProps.go
- StageDeployment__checks.go
- Step.go
- Step__checks.go
- Wave.go
- WaveOptions.go
- WaveProps.go
- Wave__checks.go
- main.go