forked from github-aws-runners/terraform-aws-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add AMI house keeping lambda (github-aws-runners#3570)
## Description Quite common to build AMI's with packer. Cleaning up old images could be a challenge. This housekeeping lambda can remove old AMI based on a few criteria. The AMI housekeepr is implemented as an extra terraform module with a lambda that runs once a day. The housekeepr can be configured to exclude images based on reference in SSM, and tags. Images. The module is deisabled by default and can used as part of the main module, multi-runner or stand alone. This PR also updates outdated lambda dependencies. And updates terraform workflows to 1.5.6 as main version. ## Tested - [x] default example (with new housekeeper) - [x] multi runner example --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
76f45dc
commit 87104e8
Showing
39 changed files
with
2,599 additions
and
950 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Config } from 'jest'; | ||
|
||
import defaultConfig from '../../jest.base.config'; | ||
|
||
const config: Config = { | ||
...defaultConfig, | ||
coverageThreshold: { | ||
global: { | ||
statements: 100, | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
}, | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "@terraform-aws-github-runner/ami-housekeeper", | ||
"version": "1.0.0", | ||
"main": "lambda.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"start": "ts-node-dev src/local.ts", | ||
"test": "NODE_ENV=test jest", | ||
"test:watch": "NODE_ENV=test jest --watch", | ||
"lint": "yarn eslint src", | ||
"watch": "ts-node-dev --respawn --exit-child src/local.ts", | ||
"build": "ncc build src/lambda.ts -o dist", | ||
"dist": "yarn build && cd dist && zip ../ami-housekeeper.zip index.js", | ||
"format": "prettier --write \"**/*.ts\"", | ||
"format-check": "prettier --check \"**/*.ts\"", | ||
"all": "yarn build && yarn format && yarn lint && yarn test" | ||
}, | ||
"devDependencies": { | ||
"@trivago/prettier-plugin-sort-imports": "^4.2.1", | ||
"@types/aws-lambda": "^8.10.125", | ||
"@types/jest": "^29.5.6", | ||
"@types/node": "^20.8.9", | ||
"@typescript-eslint/eslint-plugin": "^6.9.0", | ||
"@typescript-eslint/parser": "^6.9.0", | ||
"@vercel/ncc": "^0.38.1", | ||
"aws-sdk-client-mock": "^3.0.0", | ||
"aws-sdk-client-mock-jest": "^3.0.0", | ||
"eslint": "^8.52.0", | ||
"eslint-plugin-prettier": "5.0.1", | ||
"jest": "^29.5", | ||
"jest-mock": "^29.5.0", | ||
"jest-mock-extended": "^3.0.4", | ||
"nock": "^13.3.6", | ||
"prettier": "3.0.3", | ||
"ts-jest": "^29.1.0", | ||
"ts-node": "^10.9.1", | ||
"ts-node-dev": "^2.0.0" | ||
}, | ||
"dependencies": { | ||
"@aws-sdk/client-ec2": "^3.436.0", | ||
"@aws-sdk/client-ssm": "^3.436.0", | ||
"@aws-sdk/types": "^3.433.0", | ||
"@terraform-aws-github-runner/aws-powertools-util": "*", | ||
"@terraform-aws-github-runner/aws-ssm-util": "*", | ||
"cron-parser": "^4.8.1", | ||
"typescript": "^5.0.4" | ||
} | ||
} |
Oops, something went wrong.