Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Let AWS Image Builder and ECR deal with deleting old images for us #476

Merged
merged 5 commits into from
Nov 30, 2023
Merged
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
3 changes: 1 addition & 2 deletions .eslintrc.json

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

3 changes: 1 addition & 2 deletions .gitattributes

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

3 changes: 1 addition & 2 deletions .gitignore

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

2 changes: 1 addition & 1 deletion .projen/deps.json

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

3 changes: 1 addition & 2 deletions .projen/files.json

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

57 changes: 18 additions & 39 deletions .projen/tasks.json

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

2 changes: 1 addition & 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: '[email protected]',
stability: Stability.EXPERIMENTAL,
cdkVersion: '2.77.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
cdkVersion: '2.110.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
defaultReleaseBranch: 'main',
name: '@cloudsnorkel/cdk-github-runners',
repositoryUrl: 'https://github.com/CloudSnorkel/cdk-github-runners.git',
Expand Down
10 changes: 4 additions & 6 deletions package.json

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

19 changes: 10 additions & 9 deletions src/image-builders/aws-image-builder/ami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,24 @@ interface AmiRecipeProperties {
export class AmiRecipe extends ImageBuilderObjectBase {
public readonly arn: string;
public readonly name: string;
public readonly version: string;

constructor(scope: Construct, id: string, props: AmiRecipeProperties) {
super(scope, id);

const name = uniqueImageBuilderName(this);

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

this.name = uniqueImageBuilderName(this);
this.version = this.generateVersion('ImageRecipe', this.name, {
platform: props.platform,
components,
parentAmi: props.baseAmi,
});

let workingDirectory;
if (props.platform == 'Linux') {
workingDirectory = '/home/runner';
Expand All @@ -61,19 +67,14 @@ export class AmiRecipe extends ImageBuilderObjectBase {
}

const recipe = new imagebuilder.CfnImageRecipe(this, 'Recipe', {
name: name,
version: this.version('ImageRecipe', name, {
platform: props.platform,
components,
parentAmi: props.baseAmi,
}),
name: this.name,
version: this.version,
parentImage: props.baseAmi,
components,
workingDirectory,
});

this.arn = recipe.attrArn;
this.name = name;
}
}

Expand Down
Loading
Loading