-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontainer-services.yml
More file actions
108 lines (94 loc) · 3.38 KB
/
Copy pathcontainer-services.yml
File metadata and controls
108 lines (94 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Lambda MicroVM container and services
on:
workflow_dispatch:
permissions:
contents: read
jobs:
start-runner:
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start.outputs.label }}
microvm-id: ${{ steps.start.outputs.microvm-id }}
region: ${{ steps.start.outputs.region }}
steps:
- uses: aws-actions/configure-aws-credentials@v6
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.MICROVM_AWS_REGION }}
- uses: neebs12/lambda-microvm-github-runner@v1
id: start
with:
mode: start
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
image-id: ${{ vars.MICROVM_RUNNER_IMAGE_ARN }}
image-version: ${{ vars.MICROVM_RUNNER_IMAGE_VERSION }}
execution-role-arn: ${{ vars.MICROVM_EXECUTION_ROLE_ARN }}
cloudwatch-log-group: ${{ vars.MICROVM_RUNTIME_LOG_GROUP }}
max-lifetime-seconds: "900"
container-job:
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
timeout-minutes: 10
container:
image: public.ecr.aws/docker/library/node:24-bookworm
services:
redis:
image: public.ecr.aws/docker/library/redis:7.4.2-alpine
options: >-
--health-cmd "redis-cli ping" --health-interval 2s --health-timeout 2s
--health-retries 20
defaults:
run:
shell: bash
steps:
- name: Verify Node 24 container
run: |
set -euo pipefail
node --version
test "$(node -p 'process.versions.node.split(".")[0]')" = "24"
test "$(uname -m)" = "aarch64"
echo "Node 24 job container is running on $(uname -m)."
- name: Verify Redis service from the job container
run: |
set -euo pipefail
node <<'NODE'
const net = require("node:net");
const socket = net.createConnection(6379, "redis");
socket.setEncoding("utf8");
socket.setTimeout(10_000);
socket.on("connect", () => {
socket.write("*1\r\n$4\r\nPING\r\n");
});
socket.on("data", (data) => {
if (!data.includes("PONG")) {
throw new Error(`Unexpected Redis response: ${data}`);
}
console.log("Redis service responded with PONG from the job container.");
socket.end();
});
socket.on("timeout", () => {
socket.destroy(new Error("Timed out waiting for Redis"));
});
socket.on("error", (error) => {
console.error(error);
process.exit(1);
});
socket.on("close", (hadError) => {
process.exit(hadError ? 1 : 0);
});
NODE
stop-runner:
if: ${{ always() && needs.start-runner.outputs.microvm-id != '' }}
needs: [start-runner, container-job]
runs-on: ubuntu-latest
steps:
- uses: aws-actions/configure-aws-credentials@v6
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ needs.start-runner.outputs.region }}
- uses: neebs12/lambda-microvm-github-runner@v1
with:
mode: stop
microvm-id: ${{ needs.start-runner.outputs.microvm-id }}