Skip to content
Open
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
2 changes: 2 additions & 0 deletions lib/argument-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class ArgumentStore {
"SEMAPHORE_AGENT_LICENSE_CONFIGURATION_ARN": "",
"SEMAPHORE_AGENT_MAC_FAMILY": "mac2",
"SEMAPHORE_AGENT_MAC_DEDICATED_HOSTS": "",
"SEMAPHORE_AGENT_AUTO_ALLOCATE_HOST": "true",
"SEMAPHORE_AGENT_AUTO_RELEASE_HOST": "true",
"SEMAPHORE_AGENT_AZS": "",
"SEMAPHORE_AGENT_USE_PRE_SIGNED_URL": "false",
"SEMAPHORE_AGENT_OVERPROVISION_STRATEGY": "none",
Expand Down
4 changes: 2 additions & 2 deletions lib/aws-semaphore-agent-stack.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ class AwsSemaphoreAgentStack extends Stack {
},
{
name: "auto-allocate-host",
values: ["true"]
values: [this.argumentStore.get("SEMAPHORE_AGENT_AUTO_ALLOCATE_HOST")]
},
{
name: "auto-release-host",
values: ["true"]
values: [this.argumentStore.get("SEMAPHORE_AGENT_AUTO_RELEASE_HOST")]
},
{
name: "auto-host-recovery",
Expand Down
29 changes: 29 additions & 0 deletions test/aws-semaphore-agent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ describe("host resource group", () => {
{
Name: "auto-release-host",
Values: ["true"]
},
{
Name: "auto-host-recovery",
Values: ["true"]
}
],
},
Expand Down Expand Up @@ -1003,6 +1007,10 @@ describe("host resource group", () => {
{
Name: "auto-release-host",
Values: ["true"]
},
{
Name: "auto-host-recovery",
Values: ["true"]
}
],
},
Expand All @@ -1022,6 +1030,27 @@ describe("host resource group", () => {
]
});
})

test("auto-allocate-host and auto-release-host can be configured", () => {
const argumentStore = basicArgumentStore();
argumentStore.set("SEMAPHORE_AGENT_OS", "macos");
argumentStore.set("SEMAPHORE_AGENT_LICENSE_CONFIGURATION_ARN", "arn:aws:license-manager:us-east-1:dummyaccount:license-configuration:lic-08ha0s8hd");
argumentStore.set("SEMAPHORE_AGENT_AUTO_ALLOCATE_HOST", "false");
argumentStore.set("SEMAPHORE_AGENT_AUTO_RELEASE_HOST", "false");

const template = createTemplate(argumentStore);
template.hasResourceProperties("AWS::ResourceGroups::Group", {
Configuration: Match.arrayWith([
Match.objectLike({
Type: "AWS::EC2::HostManagement",
Parameters: Match.arrayWith([
{ Name: "auto-allocate-host", Values: ["false"] },
{ Name: "auto-release-host", Values: ["false"] }
])
})
])
});
})
})

function createTemplate(argumentStore) {
Expand Down