Skip to content

Commit 08812d4

Browse files
Merge branch 'main' into feat-macos-support
2 parents 9509230 + 6685cb6 commit 08812d4

File tree

19 files changed

+803
-685
lines changed

19 files changed

+803
-685
lines changed

.github/workflows/mkdocs/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ six==1.17.0 \
330330
--hash=sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 \
331331
--hash=sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81
332332
# via python-dateutil
333-
urllib3==2.6.0 \
334-
--hash=sha256:c90f7a39f716c572c4e3e58509581ebd83f9b59cced005b7db7ad2d22b0db99f \
335-
--hash=sha256:cb9bcef5a4b345d5da5d145dc3e30834f58e8018828cbc724d30b4cb7d4d49f1
333+
urllib3==2.6.3 \
334+
--hash=sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed \
335+
--hash=sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4
336336
# via requests
337337
watchdog==6.0.0 \
338338
--hash=sha256:07df1fdd701c5d4c8e55ef6cf55b8f0120fe1aef7ef39a1c6fc6bc2e606d517a \

MAINTAINERS.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ Roles and responsibilities of the maintainers of the project.
44

55
## Maintainers
66

7-
| Name | GitHub | Affiliation |
8-
| ----------------- | ------------- | ---------------- |
9-
| Niek Palm | [@npalm] | Philips |
10-
| Koen de Laat | [@koendelaat] | Philips |
11-
| Guilherme Caulada | [@guicaulada] | Grafana Labs |
7+
| Name | GitHub | Affiliation |
8+
| ----------------- | ------------------- | ---------------- |
9+
| Niek Palm | [@npalm] | Philips |
10+
| Koen de Laat | [@koendelaat] | Philips |
11+
| Guilherme Caulada | [@guicaulada] | Grafana Labs |
12+
| Ederson Brilhante | [@edersonbrilhante] | Cisco |
13+
| Brend Smits | [@Brend-Smits] | Philips |
14+
| Stuart Pearson | [@stuartp44] | Philips |
1215

1316
## Responsibilities
1417

docs/additional_notes.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,31 @@ If default labels are removed:
3232
| 'custom5' | Linux | no match |
3333
| 'custom5' | [ self-hosted, Linux ] | no match |
3434
| 'custom5' | [ custom5, self-hosted, Linux ] | no match |
35+
36+
# Preventing Runner Scale-Down for Debugging
37+
38+
The module supports a bypass mechanism that allows you to prevent specific runners from being scaled down during debugging or investigation. This is useful when you need to access a runner instance directly to troubleshoot issues.
39+
40+
## Usage
41+
42+
To prevent a runner from being terminated during scale-down operations, add the `ghr:bypass-removal` tag to the EC2 instance with a value of `true`:
43+
44+
```bash
45+
aws ec2 create-tags --resources <instance-id> --tags Key=ghr:bypass-removal,Value=true
46+
```
47+
48+
When this tag is set, the scale-down process will skip the runner and log a message indicating that the runner is protected:
49+
50+
```
51+
Runner 'i-xxxxxxxxxxxx' has bypass-removal tag set, skipping removal. Remove the tag to allow scale-down.
52+
```
53+
54+
## Removing the Protection
55+
56+
Once you've finished debugging and want to allow the runner to be scaled down normally, remove the tag or set it to any other value:
57+
58+
```bash
59+
aws ec2 delete-tags --resources <instance-id> --tags Key=ghr:bypass-removal
60+
```
61+
62+
**Note:** The bypass-removal tag only prevents automatic scale-down. The runner will still continue to process job(s) as normal. Make sure to remove the tag after debugging to ensure proper resource management. It will also still terminate itself if the instance is empheral and the job is complete.

examples/termination-watcher/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This module shows how to use the termination watcher stand-alone.
44

55
## Usages
66

7-
Ensure your have the lambda for the termination locally build. By default the one in the lambdas folder will be used.
7+
Ensure you have the lambda for the termination built locally. By default the one in the lambdas folder will be used.
88

99
Build lambda's (requires node and yarn).
1010

lambdas/functions/ami-housekeeper/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
"all": "yarn build && yarn format && yarn lint && yarn test"
1818
},
1919
"devDependencies": {
20-
"@aws-sdk/types": "^3.953.0",
21-
"@types/aws-lambda": "^8.10.155",
20+
"@aws-sdk/types": "^3.957.0",
21+
"@types/aws-lambda": "^8.10.159",
2222
"@vercel/ncc": "^0.38.4",
2323
"aws-sdk-client-mock": "^4.1.0",
2424
"aws-sdk-client-mock-jest": "^4.1.0"
2525
},
2626
"dependencies": {
2727
"@aws-github-runner/aws-powertools-util": "*",
2828
"@aws-github-runner/aws-ssm-util": "*",
29-
"@aws-sdk/client-ec2": "^3.953.0",
30-
"@aws-sdk/client-ssm": "^3.953.0",
29+
"@aws-sdk/client-ec2": "^3.958.0",
30+
"@aws-sdk/client-ssm": "^3.958.0",
3131
"cron-parser": "^5.4.0"
3232
},
3333
"nx": {

lambdas/functions/control-plane/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"all": "yarn build && yarn format && yarn lint && yarn test"
1818
},
1919
"devDependencies": {
20-
"@aws-sdk/types": "^3.953.0",
20+
"@aws-sdk/types": "^3.957.0",
2121
"@octokit/types": "^16.0.0",
22-
"@types/aws-lambda": "^8.10.155",
23-
"@types/node": "^22.19.0",
22+
"@types/aws-lambda": "^8.10.159",
23+
"@types/node": "^22.19.3",
2424
"@vercel/ncc": "^0.38.4",
2525
"aws-sdk-client-mock": "^4.1.0",
2626
"aws-sdk-client-mock-jest": "^4.1.0",
@@ -33,8 +33,8 @@
3333
"@aws-github-runner/aws-powertools-util": "*",
3434
"@aws-github-runner/aws-ssm-util": "*",
3535
"@aws-lambda-powertools/parameters": "^2.30.0",
36-
"@aws-sdk/client-ec2": "^3.953.0",
37-
"@aws-sdk/client-sqs": "^3.953.0",
36+
"@aws-sdk/client-ec2": "^3.958.0",
37+
"@aws-sdk/client-sqs": "^3.960.0",
3838
"@middy/core": "^6.4.5",
3939
"@octokit/auth-app": "8.1.2",
4040
"@octokit/core": "7.0.6",

lambdas/functions/control-plane/src/aws/runners.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export interface RunnerList {
1111
org?: string;
1212
orphan?: boolean;
1313
runnerId?: string;
14+
bypassRemoval?: boolean;
1415
}
1516

1617
export interface RunnerInfo {

lambdas/functions/control-plane/src/aws/runners.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ describe('list instances', () => {
9191
type: 'Org',
9292
owner: 'CoderToCat',
9393
orphan: false,
94+
bypassRemoval: false,
9495
});
9596
});
9697

@@ -105,6 +106,7 @@ describe('list instances', () => {
105106
owner: 'CoderToCat',
106107
orphan: false,
107108
runnerId: '9876543210',
109+
bypassRemoval: false,
108110
});
109111
});
110112

@@ -124,6 +126,7 @@ describe('list instances', () => {
124126
type: 'Org',
125127
owner: 'CoderToCat',
126128
orphan: true,
129+
bypassRemoval: false,
127130
});
128131
});
129132

lambdas/functions/control-plane/src/aws/runners.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ function getRunnerInfo(runningInstances: DescribeInstancesResult) {
9393
org: i.Tags?.find((e) => e.Key === 'ghr:Org')?.Value as string,
9494
orphan: i.Tags?.find((e) => e.Key === 'ghr:orphan')?.Value === 'true',
9595
runnerId: i.Tags?.find((e) => e.Key === 'ghr:github_runner_id')?.Value as string,
96+
bypassRemoval: i.Tags?.find((e) => e.Key === 'ghr:bypass-removal')?.Value === 'true',
9697
});
9798
}
9899
}

lambdas/functions/control-plane/src/scale-runners/scale-down.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,25 @@ describe('Scale down runners', () => {
286286
checkNonTerminated(runners);
287287
});
288288

289+
it(`Should not terminate runner with bypass-removal tag set.`, async () => {
290+
// setup
291+
const runners = [
292+
createRunnerTestData('idle-with-bypass', type, MINIMUM_TIME_RUNNING_IN_MINUTES + 10, true, false, false),
293+
];
294+
// Set bypass-removal tag
295+
runners[0].bypassRemoval = true;
296+
297+
mockGitHubRunners(runners);
298+
mockAwsRunners(runners);
299+
300+
// act
301+
await scaleDown();
302+
303+
// assert
304+
expect(terminateRunner).not.toHaveBeenCalled();
305+
checkNonTerminated(runners);
306+
});
307+
289308
it(`Should not terminate a runner that became busy just before deregister runner.`, async () => {
290309
// setup
291310
const runners = [
@@ -813,5 +832,6 @@ function createRunnerTestData(
813832
orphan,
814833
shouldBeTerminated,
815834
runnerId: runnerId !== undefined ? String(runnerId) : undefined,
835+
bypassRemoval: false,
816836
};
817837
}

0 commit comments

Comments
 (0)