@Generated(value="jsii-pacmak/1.70.0 (build 03c2f6f)", date="2022-11-01T13:16:40.664Z") @Stability(value=Experimental) public class PipelineDeployStackAction extends software.amazon.jsii.JsiiObject implements IAction
This composite Action takes care of preparing and executing a CloudFormation ChangeSet.
It currently does not support stacks that make use of Assets, and
requires the deployed stack is in the same account and region where the
CodePipeline is hosted.
Example:
// Example automatically generated from non-compiling source. May contain errors.
import software.amazon.awscdk.core.*;
import software.amazon.awscdk.core.*;
import software.amazon.awscdk.core.*;
import software.amazon.awscdk.core.*;
import software.amazon.awscdk.core.*;
import software.amazon.awscdk.core.*;
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());
| Modifier and Type | Class and Description |
|---|---|
static class |
PipelineDeployStackAction.Builder
(experimental) A fluent builder for
PipelineDeployStackAction. |
software.amazon.jsii.JsiiObject.InitializationModeIAction.Jsii$Default, IAction.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
protected |
PipelineDeployStackAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
PipelineDeployStackAction(software.amazon.jsii.JsiiObjectRef objRef) |
|
PipelineDeployStackAction(PipelineDeployStackActionProps props) |
| Modifier and Type | Method and Description |
|---|---|
void |
addToDeploymentRolePolicy(PolicyStatement statement)
(experimental) Add policy statements to the role deploying the stack.
|
ActionConfig |
bind(Construct scope,
IStage stage,
ActionBindOptions options)
(experimental) The callback invoked when this Action is added to a Pipeline.
|
ActionProperties |
getActionProperties()
(experimental) The simple properties of the Action, like its Owner, name, etc.
|
IRole |
getDeploymentRole() |
Rule |
onStateChange(String name)
(experimental) Creates an Event that will be triggered whenever the state of this Action changes.
|
Rule |
onStateChange(String name,
IRuleTarget target)
(experimental) Creates an Event that will be triggered whenever the state of this Action changes.
|
Rule |
onStateChange(String name,
IRuleTarget target,
RuleProps options)
(experimental) Creates an Event that will be triggered whenever the state of this Action changes.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected PipelineDeployStackAction(software.amazon.jsii.JsiiObjectRef objRef)
protected PipelineDeployStackAction(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Experimental)
public PipelineDeployStackAction(@NotNull
PipelineDeployStackActionProps props)
props - This parameter is required.@Stability(value=Experimental)
public void addToDeploymentRolePolicy(@NotNull
PolicyStatement statement)
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 grant
adminPermissions you need to identify the proper statements to add to
this role based on the CloudFormation Resources in your stack.
statement - This parameter is required.@Stability(value=Experimental) @NotNull public ActionConfig bind(@NotNull Construct scope, @NotNull IStage stage, @NotNull ActionBindOptions options)
@Stability(value=Experimental) @NotNull public Rule onStateChange(@NotNull String name, @Nullable IRuleTarget target, @Nullable RuleProps options)
onStateChange in interface IActionname - This parameter is required.target - options - @Stability(value=Experimental) @NotNull public Rule onStateChange(@NotNull String name, @Nullable IRuleTarget target)
onStateChange in interface IActionname - This parameter is required.target - @Stability(value=Experimental) @NotNull public Rule onStateChange(@NotNull String name)
onStateChange in interface IActionname - This parameter is required.@Stability(value=Experimental) @NotNull public ActionProperties getActionProperties()
Note that this accessor will be called before the {@link bind} callback.
getActionProperties in interface IAction@Stability(value=Experimental) @NotNull public IRole getDeploymentRole()
Copyright © 2022. All rights reserved.