Skip to content

Commit 1d171a6

Browse files
committed
feat: add possibility to add name and schedule
1 parent 5a19b82 commit 1d171a6

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

API.md

Lines changed: 69 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,24 @@ export interface VolumeProps {
3838
readonly ebs: imagebuilder.CfnImageRecipe.EbsInstanceBlockDeviceSpecificationProperty;
3939
}
4040

41+
export interface ImagePipelineSchedule {
42+
/**
43+
* The cron expression for the schedule.
44+
*/
45+
readonly scheduleExpression: string;
46+
47+
/**
48+
* Optional pipeline execution start condition.
49+
*/
50+
readonly pipelineExecutionStartCondition?: 'EXPRESSION_MATCH_ONLY' | 'EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE';
51+
}
52+
53+
4154
export interface ImagePipelineProps {
55+
/**
56+
* Name of the Image Pipeline
57+
*/
58+
readonly name?: string;
4259
/**
4360
* List of component props
4461
*/
@@ -129,6 +146,10 @@ export interface ImagePipelineProps {
129146
* The tags attached to the resource created by Image Builder
130147
*/
131148
readonly resourceTags?: {[key: string]: string};
149+
/**
150+
* Schedule configuration for the image pipeline.
151+
*/
152+
readonly schedule?: ImagePipelineSchedule;
132153
}
133154

134155
export class ImagePipeline extends Construct {
@@ -254,10 +275,21 @@ export class ImagePipeline extends Construct {
254275
let imagePipelineProps: imagebuilder.CfnImagePipelineProps;
255276
imagePipelineProps = {
256277
infrastructureConfigurationArn: infrastructureConfig.attrArn,
257-
name: `${uid}ImagePipeline`,
278+
name: props.name ? props.name : `${uid}ImagePipeline`,
258279
description: 'A sample image pipeline',
259280
imageRecipeArn: imageRecipe.attrArn,
260281
};
282+
283+
if (props.schedule) {
284+
imagePipelineProps = {
285+
...imagePipelineProps,
286+
schedule: {
287+
scheduleExpression: props.schedule.scheduleExpression,
288+
pipelineExecutionStartCondition: props.schedule.pipelineExecutionStartCondition || 'EXPRESSION_MATCH_ONLY',
289+
},
290+
};
291+
}
292+
261293
if (props.enableVulnScans) {
262294
imagePipelineProps = {
263295
...imagePipelineProps,

0 commit comments

Comments
 (0)