Skip to content

Commit 1f105a9

Browse files
authored
feat(ghes): Support for GitHub Enterprise Server (#412)
* feat(ghes): Support for GitHub Enterprise Server - Updates lambdas to support GHES URL - Updates TF to support GHES and deploying lambda in VPC * addressing feedback * Remove extra comma * additional fixes * correcting merge * Require semi-colon Consisent format requirements
1 parent 602efc9 commit 1f105a9

30 files changed

+5500
-259
lines changed

.ci/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.ci/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -e
23

34
lambdaSrcDirs=("modules/runner-binaries-syncer/lambdas/runner-binaries-syncer" "modules/runners/lambdas/runners" "modules/webhook/lambdas/webhook")
45
repoRoot=$(dirname $(dirname $(realpath ${BASH_SOURCE[0]})))

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ example/*.secrets*.tfvars
1717
*.gz
1818
*.tgz
1919
*.env
20+
.vscode
21+
22+
**/coverage/*

README.md

Lines changed: 76 additions & 63 deletions
Large diffs are not rendered by default.

main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ module "runners" {
9292
lambda_zip = var.runners_lambda_zip
9393
lambda_timeout_scale_up = var.runners_scale_up_lambda_timeout
9494
lambda_timeout_scale_down = var.runners_scale_down_lambda_timeout
95+
lambda_subnet_ids = var.lambda_subnet_ids
96+
lambda_security_group_ids = var.lambda_security_group_ids
9597
logging_retention_in_days = var.logging_retention_in_days
9698
enable_cloudwatch_agent = var.enable_cloudwatch_agent
9799
cloudwatch_config = var.cloudwatch_config
@@ -104,10 +106,13 @@ module "runners" {
104106
userdata_template = var.userdata_template
105107
userdata_pre_install = var.userdata_pre_install
106108
userdata_post_install = var.userdata_post_install
109+
key_name = var.key_name
107110

108111
create_service_linked_role_spot = var.create_service_linked_role_spot
109112

110113
runner_iam_role_managed_policy_arns = var.runner_iam_role_managed_policy_arns
114+
115+
ghes_url = var.ghes_url
111116
}
112117

113118
module "runner_binaries" {

modules/download-lambda/.terraform.lock.hcl

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/runner-binaries-syncer/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ No requirements.
5353
| environment | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
5454
| lambda\_s3\_bucket | S3 bucket from which to specify lambda functions. This is an alternative to providing local files directly. | `any` | `null` | no |
5555
| lambda\_schedule\_expression | Scheduler expression for action runner binary syncer. | `string` | `"cron(27 * * * ? *)"` | no |
56+
| lambda\_security\_group\_ids | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | `[]` | no |
57+
| lambda\_subnet\_ids | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | `[]` | no |
5658
| lambda\_timeout | Time out of the lambda in seconds. | `number` | `300` | no |
5759
| lambda\_zip | File location of the lambda zip file. | `string` | `null` | no |
5860
| logging\_retention\_in\_days | Specifies the number of days you want to retain log events for the lambda log group. Possible values are: 0, 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653. | `number` | `7` | no |
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"printWidth": 120,
33
"singleQuote": true,
4-
"trailingComma": "all"
4+
"trailingComma": "all",
5+
"semi": true,
56
}
7+

modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"lint": "yarn eslint --ext ts,tsx src",
1111
"watch": "ts-node-dev --respawn --exit-child src/local.ts",
1212
"build": "ncc build src/lambda.ts -o dist",
13-
"dist": "yarn build && cd dist && zip ../runner-binaries-syncer.zip index.js"
13+
"dist": "yarn build && cd dist && zip ../runner-binaries-syncer.zip index.js",
14+
"format": "prettier --write \"**/*.ts\"",
15+
"format-check": "prettier --check \"**/*.ts\""
1416
},
1517
"devDependencies": {
1618
"@octokit/rest": "^18.0.12",

modules/runner-binaries-syncer/runner-binaries-syncer.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ resource "aws_lambda_function" "syncer" {
2323
GITHUB_RUNNER_ALLOW_PRERELEASE_BINARIES = var.runner_allow_prerelease_binaries
2424
}
2525
}
26+
dynamic "vpc_config" {
27+
for_each = var.lambda_subnet_ids != null && var.lambda_security_group_ids != null ? [true] : []
28+
content {
29+
security_group_ids = var.lambda_security_group_ids
30+
subnet_ids = var.lambda_subnet_ids
31+
}
32+
}
2633

2734
tags = var.tags
2835
}

0 commit comments

Comments
 (0)