Skip to content

Commit ed73d68

Browse files
author
Tarun Belani
committed
Addressed review comments
1 parent b30cf07 commit ed73d68

16 files changed

+55
-37
lines changed

packages/@aws-cdk/aws-imagebuilder-alpha/lib/base-image.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class ContainerInstanceImage {
7676
* @param parameter The SSM parameter to use as the container instance image
7777
*/
7878
public static fromSsmParameter(parameter: ssm.IStringParameter): ContainerInstanceImage {
79-
return this.fromSsmParameterName(parameter.parameterArn);
79+
return new ContainerInstanceImage(`ssm:${parameter.parameterArn}`);
8080
}
8181

8282
/**
@@ -89,8 +89,9 @@ export class ContainerInstanceImage {
8989
}
9090

9191
/**
92-
* The string value of the container instance image to use in a container recipe. This can either be an SSM parameter,
93-
* or an AMI ID.
92+
* The string value of the container instance image to use in a container recipe. This can either be:
93+
* - an SSM parameter reference, prefixed with `ssm:` and followed by the parameter name or ARN
94+
* - an AMI ID
9495
*
9596
* @param containerInstanceImageString The container instance image as a direct string value
9697
*/

packages/@aws-cdk/aws-imagebuilder-alpha/lib/container-recipe.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import { ComponentConfiguration, IRecipeBase } from './recipe-base';
1414

1515
const CONTAINER_RECIPE_SYMBOL = Symbol.for('@aws-cdk/aws-imagebuilder-alpha.ContainerRecipe');
1616

17+
/**
18+
* Represents the latest version of a container recipe. When using the recipe in a pipeline, the pipeline will use the
19+
* latest recipe at the time of execution.
20+
*
21+
* @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/ibhow-semantic-versioning.html
22+
*/
1723
const LATEST_VERSION = 'x.x.x';
1824

1925
/**
@@ -66,7 +72,7 @@ export interface ContainerRecipeProps {
6672
/**
6773
* The version of the container recipe.
6874
*
69-
* @default 1.0.0
75+
* @default 1.0.x
7076
*/
7177
readonly containerRecipeVersion?: string;
7278

@@ -81,7 +87,7 @@ export interface ContainerRecipeProps {
8187
* The dockerfile template used to build the container image.
8288
*
8389
* @default - a standard dockerfile template will be generated to pull the base image, perform environment setup, and
84-
* run all components in the recipe
90+
* run all components in the recipe
8591
*/
8692
readonly dockerfile?: DockerfileData;
8793

@@ -103,15 +109,15 @@ export interface ContainerRecipeProps {
103109
* The working directory for use during build and test workflows.
104110
*
105111
* @default - the Image Builder default working directory is used. For Linux and macOS builds, this would be /tmp. For
106-
* Windows builds, this would be C:/
112+
* Windows builds, this would be C:/
107113
*/
108114
readonly workingDirectory?: string;
109115

110116
/**
111117
* The operating system (OS) version of the base image.
112118
*
113119
* @default - Image Builder will determine the OS version of the base image, if sourced from a third-party container
114-
* registry. Otherwise, the OS version of the base image is required.
120+
* registry. Otherwise, the OS version of the base image is required.
115121
*/
116122
readonly osVersion?: OSVersion;
117123

@@ -185,6 +191,8 @@ export abstract class DockerfileData {
185191

186192
/**
187193
* The resulting inline string or S3 URL which references the dockerfile data
194+
* - For inline dockerfiles, this is the Dockerfile template text
195+
* - For S3-backed dockerfiles, this is the S3 URL
188196
*/
189197
public readonly value: string;
190198

@@ -256,23 +264,23 @@ export interface ContainerRecipeAttributes {
256264
* The ARN of the container recipe
257265
*
258266
* @default - the ARN is automatically constructed if a containerRecipeName is provided, otherwise a
259-
* containerRecipeArn is required
267+
* containerRecipeArn is required
260268
*/
261269
readonly containerRecipeArn?: string;
262270

263271
/**
264272
* The name of the container recipe
265273
*
266274
* @default - the name is automatically constructed if a containerRecipeArn is provided, otherwise a
267-
* containerRecipeName is required
275+
* containerRecipeName is required
268276
*/
269277
readonly containerRecipeName?: string;
270278

271279
/**
272280
* The version of the container recipe
273281
*
274282
* @default - the version is automatically constructed if a containerRecipeArn is provided, otherwise the latest
275-
* version is used.
283+
* version is used.
276284
*/
277285
readonly containerRecipeVersion?: string;
278286
}
@@ -468,7 +476,7 @@ export class ContainerRecipe extends ContainerRecipeBase {
468476
'FROM {{{ imagebuilder:parentImage }}}\n{{{ imagebuilder:environments }}}\n{{{ imagebuilder:components }}}',
469477
);
470478

471-
const containerRecipeVersion = props.containerRecipeVersion ?? '1.0.0';
479+
const containerRecipeVersion = props.containerRecipeVersion ?? '1.0.x';
472480
const containerRecipe = new CfnContainerRecipe(this, 'Resource', {
473481
name: this.physicalName,
474482
version: containerRecipeVersion,

packages/@aws-cdk/aws-imagebuilder-alpha/test/container-recipe.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ CMD ["echo", "Hello, world!"]
345345
Type: 'AWS::ImageBuilder::ContainerRecipe',
346346
Properties: {
347347
Name: 'stack-containerrecipe-fcc21fd4',
348-
Version: '1.0.0',
348+
Version: '1.0.x',
349349
ContainerType: 'DOCKER',
350350
ParentImage: 'amazonlinux:latest',
351351
DockerfileTemplateData:
@@ -373,7 +373,7 @@ CMD ["echo", "Hello, world!"]
373373
Type: 'AWS::ImageBuilder::ContainerRecipe',
374374
Properties: {
375375
Name: 'stack-containerrecipe-fcc21fd4',
376-
Version: '1.0.0',
376+
Version: '1.0.x',
377377
ContainerType: 'DOCKER',
378378
ParentImage: 'amazonlinux:latest',
379379
DockerfileTemplateUri:
@@ -402,7 +402,7 @@ CMD ["echo", "Hello, world!"]
402402
Type: 'AWS::ImageBuilder::ContainerRecipe',
403403
Properties: {
404404
Name: 'stack-containerrecipe-fcc21fd4',
405-
Version: '1.0.0',
405+
Version: '1.0.x',
406406
ContainerType: 'DOCKER',
407407
ParentImage: 'amazonlinux:latest',
408408
DockerfileTemplateUri: 's3://dockerfile-bucket-123456789012-us-east-1/dockerfile/Dockerfile',

packages/@aws-cdk/aws-imagebuilder-alpha/test/integ.all-parameters.container-recipe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ const parameterizedComponent = new imagebuilder.Component(stack, 'ParameterizedC
3232
{
3333
name: 'step1',
3434
action: imagebuilder.ComponentAction.EXECUTE_BASH,
35-
inputs: {
35+
inputs: imagebuilder.ComponentStepInputs.fromObject({
3636
commands: ['echo ${{ parameter1 }}', 'echo ${{ parameter2 }}'],
37-
},
37+
}),
3838
},
3939
],
4040
},

packages/@aws-cdk/aws-imagebuilder-alpha/test/integ.asset.container-recipe.js.snapshot/aws-cdk-imagebuilder-container-recipe-asset.assets.json

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

packages/@aws-cdk/aws-imagebuilder-alpha/test/integ.asset.container-recipe.js.snapshot/aws-cdk-imagebuilder-container-recipe-asset.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"Service": "ECR"
3131
},
32-
"Version": "1.0.0"
32+
"Version": "1.0.x"
3333
}
3434
}
3535
},

packages/@aws-cdk/aws-imagebuilder-alpha/test/integ.asset.container-recipe.js.snapshot/manifest.json

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

packages/@aws-cdk/aws-imagebuilder-alpha/test/integ.asset.container-recipe.js.snapshot/tree.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk/aws-imagebuilder-alpha/test/integ.default-parameters.container-recipe.js.snapshot/aws-cdk-imagebuilder-container-recipe-default-parameters.assets.json

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

packages/@aws-cdk/aws-imagebuilder-alpha/test/integ.default-parameters.container-recipe.js.snapshot/aws-cdk-imagebuilder-container-recipe-default-parameters.template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"Service": "ECR"
2020
},
21-
"Version": "1.0.0"
21+
"Version": "1.0.x"
2222
}
2323
}
2424
},

0 commit comments

Comments
 (0)