Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 8e8c644

Browse files
authored
Merge pull request #2567 from philips-labs/next
chore: Add support multi-runners #2517
2 parents 0d2b294 + 5919612 commit 8e8c644

File tree

140 files changed

+3885
-3478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+3885
-3478
lines changed

.ci/build-yarn.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e
22

33
# Build all the lambda's, output on the default place (inside the lambda module)
44

@@ -7,5 +7,5 @@ repoRoot=$(dirname $(dirname $(realpath ${BASH_SOURCE[0]})))
77

88
for lambdaDir in ${lambdaSrcDirs[@]}; do
99
cd "$repoRoot/${lambdaDir}"
10-
yarn && yarn run dist
10+
yarn && yarn run all && yarn run dist
1111
done

.github/lint/tflint.tfvars

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
aws_region = null
2+
github_app = {
3+
id = "0"
4+
key_base64 = "0"
5+
webhook_secret = "0"
6+
}
7+
subnet_ids = []
8+
vpc_id = null

.github/workflows/lambda-runner-binaries-syncer.yml

+3-22
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,6 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
node: [16]
17-
container:
18-
image: node:${{ matrix.node }}
19-
defaults:
20-
run:
21-
working-directory: modules/runner-binaries-syncer/lambdas/runner-binaries-syncer
22-
23-
steps:
24-
- uses: actions/checkout@v3
25-
- name: Install dependencies
26-
run: yarn install
27-
- name: Run prettier
28-
run: yarn format-check
29-
- name: Run linter
30-
run: yarn lint
31-
- name: Run tests
32-
run: yarn test
33-
- name: Build distribution
34-
run: yarn build
13+
uses: ./.github/workflows/lambda-template.yml
14+
with:
15+
working-directory: modules/runner-binaries-syncer/lambdas/runner-binaries-syncer

.github/workflows/lambda-runners.yml

+3-26
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,6 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
node: [16]
17-
container:
18-
image: node:${{ matrix.node }}
19-
defaults:
20-
run:
21-
working-directory: modules/runners/lambdas/runners
22-
23-
steps:
24-
- uses: actions/checkout@v3
25-
- name: Install dependencies
26-
run: yarn install
27-
- name: Run prettier
28-
run: yarn format-check
29-
- name: Run linter
30-
run: yarn lint
31-
- name: Run tests
32-
run: yarn test
33-
- name: Run two tests in isolation
34-
run: |
35-
yarn run test src/scale-runners/scale-up.test.ts -t 'scaleUp with GHES on org level creates a runner with labels in s specific group' --coverage=false
36-
yarn run test src/scale-runners/scale-up.test.ts -t 'scaleUp with public GH on org level creates a runner with labels in s specific group' --coverage=false
37-
- name: Build distribution
38-
run: yarn build
13+
uses: ./.github/workflows/lambda-template.yml
14+
with:
15+
working-directory: modules/runners/lambdas/runners

.github/workflows/lambda-template.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Lambda Syncer
2+
on:
3+
workflow_call:
4+
inputs:
5+
working-directory:
6+
required: true
7+
type: string
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node: [18]
15+
container:
16+
image: node:${{ matrix.node }}
17+
defaults:
18+
run:
19+
working-directory: ${{ inputs.working-directory }}/${{ inputs.image }}
20+
21+
steps:
22+
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
23+
- name: Install dependencies
24+
run: yarn install
25+
- name: Run prettier
26+
run: yarn format-check
27+
- name: Run linter
28+
run: yarn lint
29+
- name: Run tests
30+
run: yarn test
31+
- name: Build distribution
32+
run: yarn build

.github/workflows/lambda-webhook.yml

+3-22
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,6 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
node: [16]
17-
container:
18-
image: node:${{ matrix.node }}
19-
defaults:
20-
run:
21-
working-directory: modules/webhook/lambdas/webhook
22-
23-
steps:
24-
- uses: actions/checkout@v3
25-
- name: Install dependencies
26-
run: yarn install
27-
- name: Run prettier
28-
run: yarn format-check
29-
- name: Run linter
30-
run: yarn lint
31-
- name: Run tests
32-
run: yarn test
33-
- name: Build distribution
34-
run: yarn build
13+
uses: ./.github/workflows/lambda-template.yml
14+
with:
15+
working-directory: modules/webhook/lambdas/webhook

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
prepare:
1111
name: Create dist
1212
runs-on: ubuntu-latest
13-
container: node:16
13+
container: node:18
1414
strategy:
1515
matrix:
1616
lambda: ["modules/webhook/lambdas/webhook", "modules/runner-binaries-syncer/lambdas/runner-binaries-syncer", "modules/runners/lambdas/runners"]

.github/workflows/terraform.yml

+44-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ on:
77
paths-ignore:
88
- "modules/*/lambdas/**"
99

10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
1014
env:
1115
AWS_REGION: eu-west-1
1216
jobs:
1317
verify_module:
1418
name: Verify module
1519
strategy:
1620
matrix:
17-
terraform: [1.1.3, "latest"]
21+
terraform: [1.3.2, "latest"]
1822
runs-on: ubuntu-latest
1923
container:
2024
image: hashicorp/terraform:${{ matrix.terraform }}
@@ -28,7 +32,7 @@ jobs:
2832
touch modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/runner-binaries-syncer.zip
2933
- name: terraform init
3034
run: terraform init -get -backend=false -input=false
31-
- if: contains(matrix.terraform, '1.1.')
35+
- if: contains(matrix.terraform, '1.3.')
3236
name: check terraform formatting
3337
run: terraform fmt -recursive -check=true -write=false
3438
- if: contains(matrix.terraform, 'latest') # check formatting for the latest release but avoid failing the build
@@ -37,13 +41,21 @@ jobs:
3741
continue-on-error: true
3842
- name: validate terraform
3943
run: terraform validate
44+
- if: contains(matrix.terraform, '1.3.')
45+
name: Setup TFLint
46+
uses: terraform-linters/setup-tflint@v2
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
- if: contains(matrix.terraform, '1.3.')
50+
name: Run TFLint
51+
run: tflint -f compact
4052

4153
verify_examples:
4254
name: Verify examples
4355
strategy:
4456
fail-fast: false
4557
matrix:
46-
terraform: [1.0.11, 1.1.3, "latest"]
58+
terraform: [1.3.0, "latest"]
4759
example:
4860
["default", "ubuntu", "prebuilt", "arm64", "ephemeral", "windows"]
4961
defaults:
@@ -56,7 +68,7 @@ jobs:
5668
- uses: actions/checkout@v3
5769
- name: terraform init
5870
run: terraform init -get -backend=false -input=false
59-
- if: contains(matrix.terraform, '1.1.')
71+
- if: contains(matrix.terraform, '1.3.')
6072
name: check terraform formatting
6173
run: terraform fmt -recursive -check=true -write=false
6274
- if: contains(matrix.terraform, 'latest') # check formatting for the latest release but avoid failing the build
@@ -65,3 +77,31 @@ jobs:
6577
continue-on-error: true
6678
- name: validate terraform011
6779
run: terraform validate
80+
81+
82+
verify_multi_runner_example:
83+
name: Verify Multi-Runner examples
84+
strategy:
85+
fail-fast: false
86+
matrix:
87+
terraform: [1.3.2, "latest"]
88+
defaults:
89+
run:
90+
working-directory: examples/multi-runner
91+
runs-on: ubuntu-latest
92+
container:
93+
image: hashicorp/terraform:${{ matrix.terraform }}
94+
steps:
95+
- uses: actions/checkout@v3
96+
- name: terraform init
97+
run: terraform init -get -backend=false -input=false
98+
- if: contains(matrix.terraform, '1.3.')
99+
name: check terraform formatting
100+
run: terraform fmt -recursive -check=true -write=false
101+
- if: contains(matrix.terraform, 'latest') # check formatting for the latest release but avoid failing the build
102+
name: check terraform formatting
103+
run: terraform fmt -recursive -check=true -write=false
104+
continue-on-error: true
105+
- name: validate terraform
106+
run: terraform validate
107+

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.52.0
3+
rev: v1.76.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_tflint
77
- id: terraform_docs
88
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.0.1
9+
rev: v4.3.0
1010
hooks:
1111
- id: check-merge-conflict

.tflint.hcl

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
config {
2+
format = "compact"
3+
module = true
4+
5+
varfile = [".github/lint/tflint.tfvars"]
6+
7+
}

0 commit comments

Comments
 (0)