@Stability(value=Stable)
See: Description
| Interface | Description |
|---|---|
| ActionArtifactBounds |
Specifies the constraints on the number of input and output artifacts an action can have.
|
| ActionBindOptions | |
| ActionConfig | |
| ActionProperties | |
| CfnCustomActionType.ArtifactDetailsProperty | |
| CfnCustomActionType.ConfigurationPropertiesProperty | |
| CfnCustomActionType.SettingsProperty | |
| CfnCustomActionTypeProps |
Properties for defining a `AWS::CodePipeline::CustomActionType`.
|
| CfnPipeline.ActionDeclarationProperty | |
| CfnPipeline.ActionTypeIdProperty | |
| CfnPipeline.ArtifactStoreMapProperty | |
| CfnPipeline.ArtifactStoreProperty | |
| CfnPipeline.BlockerDeclarationProperty | |
| CfnPipeline.EncryptionKeyProperty | |
| CfnPipeline.InputArtifactProperty | |
| CfnPipeline.OutputArtifactProperty | |
| CfnPipeline.StageDeclarationProperty | |
| CfnPipeline.StageTransitionProperty | |
| CfnPipelineProps |
Properties for defining a `AWS::CodePipeline::Pipeline`.
|
| CfnWebhook.WebhookAuthConfigurationProperty | |
| CfnWebhook.WebhookFilterRuleProperty | |
| CfnWebhookProps |
Properties for defining a `AWS::CodePipeline::Webhook`.
|
| CommonActionProps |
Common properties shared by all Actions.
|
| CommonAwsActionProps |
Common properties shared by all Actions whose
ActionProperties.owner field is 'AWS' (or unset, as 'AWS' is the default). |
| CrossRegionSupport |
An interface representing resources generated in order to support the cross-region capabilities of CodePipeline.
|
| IAction | |
| IPipeline |
The abstract view of an AWS CodePipeline as required and used by Actions.
|
| IStage |
The abstract interface of a Pipeline Stage that is used by Actions.
|
| PipelineProps | |
| StageOptions | |
| StagePlacement |
Allows you to control where to place a new Stage when it's added to the Pipeline.
|
| StageProps |
Construction properties of a Pipeline Stage.
|
| Enum | Description |
|---|---|
| ActionCategory |
---
To construct an empty Pipeline:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 import software.amazon.awscdk.services.codepipeline.*; Pipeline pipeline = new Pipeline(this, "MyFirstPipeline");
To give the Pipeline a nice, human-readable name:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
.pipelineName("MyPipeline")
.build();
You can provide Stages when creating the Pipeline:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
.stages(asList(Map.of(
"stageName", "Source",
"actions", asList())))
.build();
Or append a Stage to an existing Pipeline:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var sourceStage = pipeline.addStage(Map.of(
"stageName", "Source",
"actions", asList()));
You can insert the new Stage at an arbitrary point in the Pipeline:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var someStage = pipeline.addStage(Map.of(
"stageName", "SomeStage",
"placement", Map.of(
// note: you can only specify one of the below properties
"rightBefore", anotherStage,
"justAfter", anotherStage)));
Actions live in a separate package, @aws-cdk/aws-codepipeline-actions.
To add an Action to a Stage, you can provide it when creating the Stage,
in the actions property,
or you can use the IStage.addAction() method to mutate an existing Stage:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826 sourceStage.addAction(someAction);
You can also use the cross-region feature to deploy resources into a different region than your Pipeline is in.
It works like this:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var pipeline = Pipeline.Builder.create(this, "MyFirstPipeline")
// ...
.crossRegionReplicationBuckets(Map.of(
// note that a physical name of the replication Bucket must be known at synthesis time
"us-west-1", s3.Bucket.fromBucketAttributes(this, "UsWest1ReplicationBucket", Map.of(
"bucketName", "my-us-west-1-replication-bucket",
// optional KMS key
"encryptionKey", kms.Key.fromKeyArn(this, "UsWest1ReplicationKey", "arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012")))))
.build();
// later in the code...
// later in the code...
CloudFormationCreateUpdateStackAction.Builder.create()
.actionName("CFN_US_West_1")
// ...
.region("us-west-1")
.build();
This way, the CFN_US_West_1 Action will operate in the us-west-1 region,
regardless of which region your Pipeline is in.
If you don't provide a bucket for a region (other than the Pipeline's region)
that you're using for an Action,
there will be a new Stack, called <nameOfYourPipelineStack>-support-<region>,
defined for you, containing a replication Bucket.
This new Stack will depend on your Pipeline Stack,
so deploying the Pipeline Stack will deploy the support Stack(s) first.
Example:
$ cdk ls MyMainStack MyMainStack-support-us-west-1 $ cdk deploy MyMainStack # output of cdk deploy here...
See the AWS docs here for more information on cross-region CodePipelines.
If you're passing a replication bucket created in a different stack, like this:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var replicationStack = Stack.Builder.create(app, "ReplicationStack")
.env(Map.of(
"region", "us-west-1"))
.build();
var key = new Key(replicationStack, "ReplicationKey");
var replicationBucket = Bucket.Builder.create(replicationStack, "ReplicationBucket")
// like was said above - replication buckets need a set physical name
.bucketName(PhysicalName.getGENERATE_IF_NEEDED())
.encryptionKey(key)
.build();
// later...
// later...
Pipeline.Builder.create(pipelineStack, "Pipeline")
.crossRegionReplicationBuckets(Map.of(
"us-west-1", replicationBucket))
.build();
When trying to encrypt it (and note that if any of the cross-region actions happen to be cross-account as well, the bucket has to be encrypted - otherwise the pipeline will fail at runtime), you cannot use a key directly - KMS keys don't have physical names, and so you can't reference them across environments.
In this case, you need to use an alias in place of the key when creating the bucket:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var key = new Key(replicationStack, "ReplicationKey");
var alias = Alias.Builder.create(replicationStack, "ReplicationAlias")
// aliasName is required
.aliasName(PhysicalName.getGENERATE_IF_NEEDED())
.targetKey(key)
.build();
var replicationBucket = Bucket.Builder.create(replicationStack, "ReplicationBucket")
.bucketName(PhysicalName.getGENERATE_IF_NEEDED())
.encryptionKey(alias)
.build();
The library supports the CodePipeline Variables feature.
Each action class that emits variables has a separate variables interface,
accessed as a property of the action instance called variables.
You instantiate the action class and assign it to a local variable;
when you want to use a variable in the configuration of a different action,
you access the appropriate property of the interface returned from variables,
which represents a single variable.
Example:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
// MyAction is some action type that produces variables
var myAction = MyAction.Builder.create().build();
OtherAction.Builder.create()
// ...
.config(myAction.variables.getMyVariable())
.build();
The namespace name that will be used will be automatically generated by the pipeline construct, based on the stage and action name; you can pass a custom name when creating the action instance:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
var myAction = MyAction.Builder.create()
// ...
.variablesNamespace("MyNamespace")
.build();
There are also global variables available,
not tied to any action;
these are accessed through static properties of the GlobalVariables class:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
OtherAction.Builder.create()
// ...
.config(codepipeline.GlobalVariables.getExecutionId())
.build();
Check the documentation of the @aws-cdk/aws-codepipeline-actions
for details on how to use the variables for each action class.
See the CodePipeline documentation for more details on how to use the variables feature.
A pipeline can be used as a target for a CloudWatch event rule:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import software.amazon.awscdk.services.events.targets.*;
import software.amazon.awscdk.services.events.*;
// kick off the pipeline every day
Rule rule = new Rule(this, "Daily", new RuleProps()
.schedule(events.Schedule.rate(Duration.days(1))));
rule.addTarget(new CodePipeline(pipeline));
When a pipeline is used as an event target, the "codepipeline:StartPipelineExecution" permission is granted to the AWS CloudWatch Events service.
Pipelines emit CloudWatch events. To define event rules for events emitted by
the pipeline, stages or action, use the onXxx methods on the respective
construct:
// Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
myPipeline.onStateChange("MyPipelineStateChange", target);
myStage.onStateChange("MyStageStateChange", target);
myAction.onStateChange("MyActionStateChange", target);
Copyright © 2020. All rights reserved.