Class PipelineDeployStackAction
- All Implemented Interfaces:
IAction
,software.amazon.jsii.JsiiSerializable
This composite Action takes care of preparing and executing a CloudFormation ChangeSet.
It currently does not support stacks that make use of Asset
s, and
requires the deployed stack is in the same account and region where the
CodePipeline is hosted.
Example:
import software.amazon.awscdk.services.codebuild.*; import software.amazon.awscdk.services.codepipeline.*; import software.amazon.awscdk.services.codepipeline.actions.*; import software.amazon.awscdk.core.*; import software.amazon.awscdk.appdelivery.*; import software.amazon.awscdk.services.iam.*; public class MyServiceStackA extends Stack { } public class MyServiceStackB extends Stack { } App app = new App(); // We define a stack that contains the CodePipeline Stack pipelineStack = new Stack(app, "PipelineStack"); Pipeline pipeline = Pipeline.Builder.create(pipelineStack, "CodePipeline") // Mutating a CodePipeline can cause the currently propagating state to be // "lost". Ensure we re-run the latest change through the pipeline after it's // been mutated so we're sure the latest state is fully deployed through. .restartExecutionOnUpdate(true) .build(); // Configure the CodePipeline source - where your CDK App's source code is hosted Artifact sourceOutput = new Artifact(); GitHubSourceAction source = GitHubSourceAction.Builder.create() .actionName("GitHub") .output(sourceOutput) .owner("myName") .repo("myRepo") .oauthToken(SecretValue.unsafePlainText("secret")) .build(); pipeline.addStage(StageOptions.builder() .stageName("source") .actions(List.of(source)) .build()); PipelineProject project = PipelineProject.Builder.create(pipelineStack, "CodeBuild").build(); Artifact synthesizedApp = new Artifact(); CodeBuildAction buildAction = CodeBuildAction.Builder.create() .actionName("CodeBuild") .project(project) .input(sourceOutput) .outputs(List.of(synthesizedApp)) .build(); pipeline.addStage(StageOptions.builder() .stageName("build") .actions(List.of(buildAction)) .build()); // Optionally, self-update the pipeline stack IStage selfUpdateStage = pipeline.addStage(StageOptions.builder().stageName("SelfUpdate").build()); selfUpdateStage.addAction(PipelineDeployStackAction.Builder.create() .stack(pipelineStack) .input(synthesizedApp) .adminPermissions(true) .build()); // Now add our service stacks IStage deployStage = pipeline.addStage(StageOptions.builder().stageName("Deploy").build()); MyServiceStackA serviceStackA = MyServiceStackA.Builder.create(app, "ServiceStackA").build(); // Add actions to deploy the stacks in the deploy stage: PipelineDeployStackAction deployServiceAAction = PipelineDeployStackAction.Builder.create() .stack(serviceStackA) .input(synthesizedApp) // See the note below for details about this option. .adminPermissions(false) .build(); deployStage.addAction(deployServiceAAction); // Add the necessary permissions for you service deploy action. This role is // is passed to CloudFormation and needs the permissions necessary to deploy // stack. Alternatively you can enable [Administrator](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html#jf_administrator) permissions above, // users should understand the privileged nature of this role. String myResourceArn = "arn:partition:service:region:account-id:resource-id"; deployServiceAAction.addToDeploymentRolePolicy(PolicyStatement.Builder.create() .actions(List.of("service:SomeAction")) .resources(List.of(myResourceArn)) .build()); MyServiceStackB serviceStackB = MyServiceStackB.Builder.create(app, "ServiceStackB").build(); deployStage.addAction(PipelineDeployStackAction.Builder.create() .stack(serviceStackB) .input(synthesizedApp) .createChangeSetRunOrder(998) .adminPermissions(true) .build());
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Deprecated.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.codepipeline.IAction
IAction.Jsii$Default, IAction.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionDeprecated.protected
PipelineDeployStackAction
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) Deprecated.protected
PipelineDeployStackAction
(software.amazon.jsii.JsiiObjectRef objRef) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToDeploymentRolePolicy
(PolicyStatement statement) Deprecated.bind
(Construct scope, IStage stage, ActionBindOptions options) Deprecated.Deprecated.Deprecated.onStateChange
(String name) Deprecated.onStateChange
(String name, IRuleTarget target) Deprecated.onStateChange
(String name, IRuleTarget target, RuleProps options) Deprecated.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
PipelineDeployStackAction
protected PipelineDeployStackAction(software.amazon.jsii.JsiiObjectRef objRef) Deprecated. -
PipelineDeployStackAction
protected PipelineDeployStackAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) Deprecated. -
PipelineDeployStackAction
@Stability(Deprecated) @Deprecated public PipelineDeployStackAction(@NotNull PipelineDeployStackActionProps props) Deprecated.- Parameters:
props
- This parameter is required.
-
-
Method Details
-
addToDeploymentRolePolicy
@Stability(Deprecated) @Deprecated public void addToDeploymentRolePolicy(@NotNull PolicyStatement statement) Deprecated.(deprecated) Add policy statements to the role deploying the stack.This role is passed to CloudFormation and must have the IAM permissions necessary to deploy the stack or you can grant this role
adminPermissions
by using that option during creation. If you do not grantadminPermissions
you need to identify the proper statements to add to this role based on the CloudFormation Resources in your stack.- Parameters:
statement
- This parameter is required.
-
bind
@Stability(Deprecated) @Deprecated @NotNull public ActionConfig bind(@NotNull Construct scope, @NotNull IStage stage, @NotNull ActionBindOptions options) Deprecated.(deprecated) The callback invoked when this Action is added to a Pipeline. -
onStateChange
@Stability(Deprecated) @Deprecated @NotNull public Rule onStateChange(@NotNull String name, @Nullable IRuleTarget target, @Nullable RuleProps options) Deprecated.(deprecated) Creates an Event that will be triggered whenever the state of this Action changes.- Specified by:
onStateChange
in interfaceIAction
- Parameters:
name
- This parameter is required.target
-options
-
-
onStateChange
@Stability(Deprecated) @Deprecated @NotNull public Rule onStateChange(@NotNull String name, @Nullable IRuleTarget target) Deprecated.(deprecated) Creates an Event that will be triggered whenever the state of this Action changes.- Specified by:
onStateChange
in interfaceIAction
- Parameters:
name
- This parameter is required.target
-
-
onStateChange
Deprecated.(deprecated) Creates an Event that will be triggered whenever the state of this Action changes.- Specified by:
onStateChange
in interfaceIAction
- Parameters:
name
- This parameter is required.
-
getActionProperties
Deprecated.(deprecated) The simple properties of the Action, like its Owner, name, etc.Note that this accessor will be called before the
bind(software.amazon.awscdk.core.Construct,software.amazon.awscdk.services.codepipeline.IStage,software.amazon.awscdk.services.codepipeline.ActionBindOptions)
callback.- Specified by:
getActionProperties
in interfaceIAction
-
getDeploymentRole
Deprecated.
-