Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .projen/tasks.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
author: 'Amir Szekely',
authorAddress: 'amir@cloudsnorkel.com',
stability: Stability.EXPERIMENTAL,
cdkVersion: '2.155.0', // 2.21.1 for lambda url, 2.29.0 for Names.uniqueResourceName(), 2.50.0 for JsonPath.base64Encode, 2.77.0 for node 16, 2.110.0 for ib lifecycle, 2.123.0 for lambda logs, 2.155.0 for launch template throughput
cdkVersion: '2.231.0', // 2.21.1 for lambda url, 2.29.0 for Names.uniqueResourceName(), 2.50.0 for JsonPath.base64Encode, 2.77.0 for node 16, 2.110.0 for ib lifecycle, 2.123.0 for lambda logs, 2.155.0 for launch template throughput, 2.231.0 for imagebuilder
defaultReleaseBranch: 'main',
name: '@cloudsnorkel/cdk-github-runners',
repositoryUrl: 'https://github.com/CloudSnorkel/cdk-github-runners.git',
Expand Down Expand Up @@ -44,6 +44,9 @@ const project = new awscdk.AwsCdkConstructLibrary({
],
deps: [
],
peerDeps: [
'@aws-cdk/aws-imagebuilder-alpha',
],
jsiiVersion: '5.8.x',
typescriptVersion: '5.6.x',
lambdaOptions: { runtime: awscdk.LambdaRuntime.NODEJS_22_X },
Expand Down
45 changes: 24 additions & 21 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions src/image-builders/aws-image-builder/ami.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as imagebuilder2 from '@aws-cdk/aws-imagebuilder-alpha';
import * as cdk from 'aws-cdk-lib';
import { aws_imagebuilder as imagebuilder } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { ImageBuilderComponent } from './builder';
import { amiRootDevice, Architecture, Os } from '../../providers';
import { uniqueImageBuilderName } from '../common';

/**
* Properties for AmiRecipe construct.
Expand Down Expand Up @@ -48,6 +47,7 @@ interface AmiRecipeProperties {
* @internal
*/
export class AmiRecipe extends cdk.Resource {
public readonly recipe: imagebuilder2.ImageRecipe;
public readonly arn: string;
public readonly name: string;
public readonly version: string;
Expand All @@ -57,22 +57,22 @@ export class AmiRecipe extends cdk.Resource {

let components = props.components.map(component => {
return {
componentArn: component.arn,
component: component.component,
};
});

const blockDeviceMappings = props.storageSize ? [
{
deviceName: amiRootDevice(this, props.baseAmi).ref,
ebs: {
volumeSize: props.storageSize.toGibibytes(),
deleteOnTermination: true,
volume: {
ebsDevice: {
volumeSize: props.storageSize.toGibibytes(),
deleteOnTermination: true,
},
},
},
] : undefined;

this.name = uniqueImageBuilderName(this);

let workingDirectory;
if (props.platform == 'Linux') {
workingDirectory = '/home/runner';
Expand All @@ -82,18 +82,18 @@ export class AmiRecipe extends cdk.Resource {
throw new Error(`Unsupported AMI recipe platform: ${props.platform}`);
}

const recipe = new imagebuilder.CfnImageRecipe(this, 'Recipe', {
name: this.name,
version: '1.0.x',
parentImage: props.baseAmi,
const recipe = new imagebuilder2.ImageRecipe(this, 'Recipe', {
baseImage: imagebuilder2.BaseImage.fromAmiId(props.baseAmi),
components,
workingDirectory,
tags: props.tags,
blockDeviceMappings,
blockDevices: blockDeviceMappings,
});

this.arn = recipe.attrArn;
this.version = recipe.getAtt('Version', cdk.ResolutionTypeHint.STRING).toString();
this.recipe = recipe;
this.arn = recipe.imageRecipeArn;
this.name = recipe.imageRecipeName;
this.version = recipe.imageRecipeVersion;
}
}

Expand Down
Loading
Loading