forked from omsf/start-aws-gha-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (145 loc) · 5.45 KB
/
demo-dbg-minimal.yml
File metadata and controls
151 lines (145 loc) · 5.45 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Demo – configurable instance for debugging
on:
workflow_dispatch:
inputs:
type:
description: "EC2 instance type (e.g., t3.medium, t3.large)"
required: false
type: string
default: "t3.large"
ami:
description: "AMI ID to use"
required: false
type: string
default: "ami-0e86e20dae9224db8" # Ubuntu 24.04 LTS x86_64 (us-east-1)
registration_timeout:
description: "Max seconds to wait for runner registration (default: 360)"
required: false
type: string
default: "360"
initial_grace_period:
description: "Grace period if no job starts (default: 180)"
required: false
type: string
default: "180"
grace_period:
description: "Grace period before termination after job (default: 60)"
required: false
type: string
default: "60"
max_instance_lifetime:
description: "Max instance lifetime in minutes (default: 360)"
required: false
type: string
default: "360"
sleep:
description: "Sleep duration in seconds"
required: false
type: string
default: "600"
debug:
description: "Enable debug mode (extends termination delay to 600s)"
required: false
type: boolean
default: true
instance_name:
description: "Instance name"
required: false
type: string
workflow_call: # Called by demo-cpu-sweep, more for the "minimal", less for the "dbg"
inputs:
type:
description: "EC2 instance type"
required: false
type: string
default: "t3.large"
ami:
description: "AMI ID to use"
required: false
type: string
default: "ami-0e86e20dae9224db8" # Ubuntu 24.04 LTS x86_64 (us-east-1)
sleep:
description: "Sleep duration in seconds"
required: false
type: string
default: "10"
debug:
description: "Enable debug mode"
required: false
type: boolean
default: false
instance_name:
description: "Instance name"
required: false
type: string
permissions:
id-token: write # Required for AWS OIDC authentication
contents: read # Required for actions/checkout; normally set by default, but must explicitly specify when defining a custom `permissions` block.
jobs:
launch:
name: Launch ${{ inputs.type }}
uses: ./.github/workflows/runner.yml
with:
name: 🚀
ec2_instance_type: ${{ inputs.type }}
ec2_image_id: ${{ inputs.ami }}
debug: ${{ inputs.debug }}
instance_name: ${{ inputs.instance_name || 'debug/$name#$run' }}
# `workflow_dispatch has higher defaults for these; revert to original defaults for `workflow_call`
runner_registration_timeout: ${{ inputs.registration_timeout || '300' }}
runner_grace_period: ${{ inputs.grace_period || '60' }}
runner_initial_grace_period: ${{ inputs.initial_grace_period || '120' }}
max_instance_lifetime: ${{ inputs.max_instance_lifetime || '60' }}
secrets: inherit
test:
needs: launch
name: 🔬
runs-on: ${{ needs.launch.outputs.id }}
steps:
- name: Instance Info
run: |
echo "=== Instance Information ==="
echo "Hostname: $(hostname)"
echo "Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
echo "Instance type: $(curl -s http://169.254.169.254/latest/meta-data/instance-type)"
echo "Public IP: $(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)"
echo "Region: $(curl -s http://169.254.169.254/latest/meta-data/placement/region)"
echo "AMI ID: $(curl -s http://169.254.169.254/latest/meta-data/ami-id)"
echo ""
echo "=== System Details ==="
echo "OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)"
echo "Kernel: $(uname -r)"
echo "Architecture: $(uname -m)"
echo "CPU cores: $(nproc)"
echo "Memory: $(free -h | grep Mem | awk '{print $2}')"
echo "User: $(whoami)"
echo "Home: $HOME"
- name: Sleep Test
run: |
DURATION=${{ inputs.sleep }}
echo "Starting sleep at: $(date '+%Y-%m-%d %H:%M:%S.%3N')"
echo "Sleeping for ${DURATION} seconds..."
sleep $DURATION
echo "Finished at: $(date '+%Y-%m-%d %H:%M:%S.%3N')"
- name: Debug Info
run: |
echo "=== Runner Environment ==="
echo "Runner home: ${RUNNER_HOME:-not set}"
echo "Runner workspace: ${GITHUB_WORKSPACE:-not set}"
echo "Runner temp: ${RUNNER_TEMP:-not set}"
echo ""
echo "=== Timeout Settings ==="
echo "Debug mode: ${{ inputs.debug }}"
echo "Registration timeout: ${{ inputs.registration_timeout }}s"
echo "Grace period: ${{ inputs.grace_period }}s"
echo "Initial grace period: ${{ inputs.initial_grace_period }}s"
echo "Max lifetime: ${{ inputs.max_instance_lifetime }} minutes"
echo ""
echo "=== Important Logs ==="
echo "Setup log: /var/log/runner-setup.log"
echo "Debug log: /var/log/runner-debug.log"
if [ -f /tmp/runner-0-config.log ]; then
echo "Config log exists: /tmp/runner-0-config.log"
echo "Last 5 lines of config log:"
tail -5 /tmp/runner-0-config.log
fi