Skip to content
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
7 changes: 4 additions & 3 deletions lib/aws-semaphore-agent-stack.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
const packageInfo = require("../package.json");
const { hash } = require("./ami-hash");
const { DynamicSSHKeysUpdater } = require("./dynamic-ssh-keys-updater");
const { nodeJs22Runtime } = require("./nodejs-runtime");
const { DependencyGroup } = require("constructs");
const { Stack, Duration, Fn, CustomResource } = require("aws-cdk-lib");
const { Provider } = require("aws-cdk-lib/custom-resources");
const { Rule, Schedule } = require("aws-cdk-lib/aws-events");
const { LambdaFunction } = require("aws-cdk-lib/aws-events-targets");
const { RetentionDays } = require("aws-cdk-lib/aws-logs");
const { StringParameter, ParameterTier } = require("aws-cdk-lib/aws-ssm");
const { Function, Runtime, AssetCode } = require("aws-cdk-lib/aws-lambda");
const { Function, AssetCode } = require("aws-cdk-lib/aws-lambda");
const { Policy, PolicyStatement, Role, ServicePrincipal, ManagedPolicy, Effect } = require("aws-cdk-lib/aws-iam");
const { CfnAutoScalingGroup } = require("aws-cdk-lib/aws-autoscaling");
const { Alias } = require("aws-cdk-lib/aws-kms");
Expand Down Expand Up @@ -261,7 +262,7 @@ class AwsSemaphoreAgentStack extends Stack {

let opts = {
description: `Dynamically scale Semaphore agents based on jobs demand`,
runtime: Runtime.NODEJS_18_X,
runtime: nodeJs22Runtime,
timeout: Duration.seconds(60),
code: new AssetCode('lambdas/agent-scaler'),
handler: 'app.handler',
Expand Down Expand Up @@ -547,7 +548,7 @@ class AwsSemaphoreAgentStack extends Stack {

let suspenderFunction = new Function(this, 'azRebalanceSuspenderLambda', {
description: "Suspend AZRebalance process for auto scaling group",
runtime: Runtime.NODEJS_18_X,
runtime: nodeJs22Runtime,
code: new AssetCode("lambdas/az-rebalance-suspender"),
handler: "app.handler",
role: suspenderRole,
Expand Down
5 changes: 3 additions & 2 deletions lib/dynamic-ssh-keys-updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const { Rule, Schedule } = require("aws-cdk-lib/aws-events");
const { LambdaFunction } = require("aws-cdk-lib/aws-events-targets");
const { RetentionDays } = require("aws-cdk-lib/aws-logs");
const { StringParameter, ParameterTier } = require("aws-cdk-lib/aws-ssm");
const { Function, Runtime, AssetCode } = require("aws-cdk-lib/aws-lambda");
const { Function, AssetCode } = require("aws-cdk-lib/aws-lambda");
const { Policy, PolicyStatement, Role, ServicePrincipal, ManagedPolicy, Effect } = require("aws-cdk-lib/aws-iam");
const { nodeJs22Runtime } = require("./nodejs-runtime");

class DynamicSSHKeysUpdater extends Construct {
constructor(scope, id, props) {
Expand Down Expand Up @@ -61,7 +62,7 @@ class DynamicSSHKeysUpdater extends Construct {

let lambdaFunction = new Function(this, 'Lambda', {
description: `Check if GitHub SSH public keys have changed.`,
runtime: Runtime.NODEJS_18_X,
runtime: nodeJs22Runtime,
timeout: Duration.seconds(10),
code: new AssetCode('lambdas/ssh-keys-updater'),
handler: 'app.handler',
Expand Down
10 changes: 10 additions & 0 deletions lib/nodejs-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { Runtime, RuntimeFamily } = require('aws-cdk-lib/aws-lambda');

// CDK v2.164 does not expose NODEJS_22_X yet, so create a compatible Runtime when needed.
const nodeJs22Runtime = Runtime.NODEJS_22_X || new Runtime('nodejs22.x', RuntimeFamily.NODEJS, {
supportsInlineCode: true
});

module.exports = {
nodeJs22Runtime
};
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-semaphore-agent",
"version": "0.9.1",
"version": "0.9.2",
"bin": {
"aws-semaphore-agent": "bin/aws-semaphore-agent.js"
},
Expand Down
10 changes: 5 additions & 5 deletions test/aws-semaphore-agent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ describe("auto scaling group", () => {

template.hasResourceProperties("AWS::Lambda::Function", {
Description: "Suspend AZRebalance process for auto scaling group",
Runtime: "nodejs18.x",
Runtime: "nodejs22.x",
Code: Match.anyValue(),
Handler: "app.handler",
Role: Match.anyValue()
Expand All @@ -650,7 +650,7 @@ describe("scaler lambda", () => {
const template = createTemplate(basicArgumentStore());
template.hasResourceProperties("AWS::Lambda::Function", {
Description: "Dynamically scale Semaphore agents based on jobs demand",
Runtime: "nodejs18.x",
Runtime: "nodejs22.x",
Timeout: 60,
Code: Match.anyValue(),
Handler: "app.handler",
Expand Down Expand Up @@ -704,7 +704,7 @@ describe("scaler lambda", () => {
const template = createTemplate(argumentStore);
template.hasResourceProperties("AWS::Lambda::Function", {
Description: "Dynamically scale Semaphore agents based on jobs demand",
Runtime: "nodejs18.x",
Runtime: "nodejs22.x",
Timeout: 60,
Code: Match.anyValue(),
Handler: "app.handler",
Expand All @@ -729,7 +729,7 @@ describe("scaler lambda", () => {
const template = createTemplate(argumentStore);
template.hasResourceProperties("AWS::Lambda::Function", {
Description: "Dynamically scale Semaphore agents based on jobs demand",
Runtime: "nodejs18.x",
Runtime: "nodejs22.x",
Timeout: 60,
Code: Match.anyValue(),
Handler: "app.handler",
Expand Down Expand Up @@ -843,7 +843,7 @@ describe("SSH keys updater lambda", () => {
const template = createTemplate(basicArgumentStore());
template.hasResourceProperties("AWS::Lambda::Function", {
Description: "Check if GitHub SSH public keys have changed.",
Runtime: "nodejs18.x",
Runtime: "nodejs22.x",
Timeout: 10,
Code: Match.anyValue(),
Handler: "app.handler",
Expand Down