Class PipelineProject
A convenience class for CodeBuild Projects that are used in CodePipeline.
Implements
Constructs.IConstruct
Constructs.IDependable
Inherited Members
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class PipelineProject : Project, IProject, IResource, IGrantable, IConnectable, INotificationRuleSource
Syntax (vb)
Public Class PipelineProject
Inherits Project
Implements IProject, IResource, IGrantable, IConnectable, INotificationRuleSource
Remarks
ExampleMetadata: infused
Examples
// Create a Cloudfront Web Distribution
using Amazon.CDK.AWS.CloudFront;
Distribution distribution;
// Create the build project that will invalidate the cache
var invalidateBuildProject = new PipelineProject(this, "InvalidateProject", new PipelineProjectProps {
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, string[]>> {
{ "build", new Struct {
Commands = new [] { "aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths \"/*\"" }
} }
} }
}),
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "CLOUDFRONT_ID", new BuildEnvironmentVariable { Value = distribution.DistributionId } }
}
});
// Add Cloudfront invalidation permissions to the project
var distributionArn = $"arn:aws:cloudfront::{this.account}:distribution/{distribution.distributionId}";
invalidateBuildProject.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps {
Resources = new [] { distributionArn },
Actions = new [] { "cloudfront:CreateInvalidation" }
}));
// Create the pipeline (here only the S3 deploy and Invalidate cache build)
var deployBucket = new Bucket(this, "DeployBucket");
var deployInput = new Artifact();
new Pipeline(this, "Pipeline", new PipelineProps {
Stages = new [] { new StageProps {
StageName = "Deploy",
Actions = new [] {
new S3DeployAction(new S3DeployActionProps {
ActionName = "S3Deploy",
Bucket = deployBucket,
Input = deployInput,
RunOrder = 1
}),
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "InvalidateCache",
Project = invalidateBuildProject,
Input = deployInput,
RunOrder = 2
}) }
} }
});
Synopsis
Constructors
PipelineProject(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
PipelineProject(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
PipelineProject(Construct, String, IPipelineProjectProps) |
Constructors
PipelineProject(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected PipelineProject(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
PipelineProject(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected PipelineProject(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
PipelineProject(Construct, String, IPipelineProjectProps)
public PipelineProject(Construct scope, string id, IPipelineProjectProps props = null)
Parameters
- scope Constructs.Construct
- id System.String
- props IPipelineProjectProps
Implements
Constructs.IConstruct
Constructs.IDependable