Show / Hide Table of Contents

Class PipelineDeployStackAction

(deprecated) A class to deploy a stack that is part of a CDK App, using CodePipeline.

Inheritance
System.Object
PipelineDeployStackAction
Implements
IAction
Namespace: Amazon.CDK.AppDelivery
Assembly: Amazon.CDK.AppDelivery.dll
Syntax (csharp)
public class PipelineDeployStackAction : DeputyBase, IAction
Syntax (vb)
Public Class PipelineDeployStackAction
    Inherits DeputyBase
    Implements IAction
Remarks

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.

Stability: Deprecated

ExampleMetadata: infused

Examples
using Amazon.CDK.AWS.CodeBuild;
using Amazon.CDK.AWS.CodePipeline;
using Amazon.CDK.AWS.CodePipeline.Actions;
using Amazon.CDK;
using Amazon.CDK.AppDelivery;
using Amazon.CDK.AWS.IAM;

class MyServiceStackA : Stack
{
}
class MyServiceStackB : Stack
{
}

var app = new App();

// We define a stack that contains the CodePipeline
var pipelineStack = new Stack(app, "PipelineStack");
var pipeline = new Pipeline(pipelineStack, "CodePipeline", new PipelineProps {
    // 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
});

// Configure the CodePipeline source - where your CDK App's source code is hosted
var sourceOutput = new Artifact();
var source = new GitHubSourceAction(new GitHubSourceActionProps {
    ActionName = "GitHub",
    Output = sourceOutput,
    Owner = "myName",
    Repo = "myRepo",
    OauthToken = SecretValue.UnsafePlainText("secret")
});
pipeline.AddStage(new StageOptions {
    StageName = "source",
    Actions = new [] { source }
});

var project = new PipelineProject(pipelineStack, "CodeBuild", new PipelineProjectProps { });
var synthesizedApp = new Artifact();
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
    ActionName = "CodeBuild",
    Project = project,
    Input = sourceOutput,
    Outputs = new [] { synthesizedApp }
});
pipeline.AddStage(new StageOptions {
    StageName = "build",
    Actions = new [] { buildAction }
});

// Optionally, self-update the pipeline stack
var selfUpdateStage = pipeline.AddStage(new StageOptions { StageName = "SelfUpdate" });
selfUpdateStage.AddAction(new PipelineDeployStackAction(new PipelineDeployStackActionProps {
    Stack = pipelineStack,
    Input = synthesizedApp,
    AdminPermissions = true
}));

// Now add our service stacks
var deployStage = pipeline.AddStage(new StageOptions { StageName = "Deploy" });
var serviceStackA = new MyServiceStackA(app, "ServiceStackA", new StackProps { });
// Add actions to deploy the stacks in the deploy stage:
var deployServiceAAction = new PipelineDeployStackAction(new PipelineDeployStackActionProps {
    Stack = serviceStackA,
    Input = synthesizedApp,
    // See the note below for details about this option.
    AdminPermissions = false
});
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.
var myResourceArn = "arn:partition:service:region:account-id:resource-id";
deployServiceAAction.AddToDeploymentRolePolicy(new PolicyStatement(new PolicyStatementProps {
    Actions = new [] { "service:SomeAction" },
    Resources = new [] { myResourceArn }
}));

var serviceStackB = new MyServiceStackB(app, "ServiceStackB", new StackProps { });
deployStage.AddAction(new PipelineDeployStackAction(new PipelineDeployStackActionProps {
    Stack = serviceStackB,
    Input = synthesizedApp,
    CreateChangeSetRunOrder = 998,
    AdminPermissions = true
}));

Synopsis

Constructors

PipelineDeployStackAction(IPipelineDeployStackActionProps)
PipelineDeployStackAction(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

PipelineDeployStackAction(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

Properties

ActionProperties

(deprecated) The simple properties of the Action, like its Owner, name, etc.

DeploymentRole

Methods

AddToDeploymentRolePolicy(PolicyStatement)

(deprecated) Add policy statements to the role deploying the stack.

Bind(Construct, IStage, IActionBindOptions)

(deprecated) The callback invoked when this Action is added to a Pipeline.

OnStateChange(String, IRuleTarget, IRuleProps)

(deprecated) Creates an Event that will be triggered whenever the state of this Action changes.

Constructors

PipelineDeployStackAction(IPipelineDeployStackActionProps)

public PipelineDeployStackAction(IPipelineDeployStackActionProps props)
Parameters
props IPipelineDeployStackActionProps
Remarks

Stability: Deprecated

PipelineDeployStackAction(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

protected PipelineDeployStackAction(ByRefValue reference)
Parameters
reference Amazon.JSII.Runtime.Deputy.ByRefValue

The Javascript-owned object reference

PipelineDeployStackAction(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

protected PipelineDeployStackAction(DeputyBase.DeputyProps props)
Parameters
props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps

The deputy props

Properties

ActionProperties

(deprecated) The simple properties of the Action, like its Owner, name, etc.

public virtual IActionProperties ActionProperties { get; }
Property Value

IActionProperties

Remarks

Note that this accessor will be called before the {@link bind} callback.

Stability: Deprecated

DeploymentRole

public virtual IRole DeploymentRole { get; }
Property Value

IRole

Remarks

Stability: Deprecated

Methods

AddToDeploymentRolePolicy(PolicyStatement)

(deprecated) Add policy statements to the role deploying the stack.

public virtual void AddToDeploymentRolePolicy(PolicyStatement statement)
Parameters
statement PolicyStatement
Remarks

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.

Stability: Deprecated

Bind(Construct, IStage, IActionBindOptions)

(deprecated) The callback invoked when this Action is added to a Pipeline.

public virtual IActionConfig Bind(Construct scope, IStage stage, IActionBindOptions options)
Parameters
scope Construct
stage IStage
options IActionBindOptions
Returns

IActionConfig

Remarks

Stability: Deprecated

OnStateChange(String, IRuleTarget, IRuleProps)

(deprecated) Creates an Event that will be triggered whenever the state of this Action changes.

public virtual Rule OnStateChange(string name, IRuleTarget target = null, IRuleProps options = null)
Parameters
name System.String
target IRuleTarget
options IRuleProps
Returns

Rule

Remarks

Stability: Deprecated

Implements

IAction
Back to top Generated by DocFX