Documentation
¶
Overview ¶
Package github provides webhook validation and label parsing for GitHub Actions workflow jobs.
Index ¶
Constants ¶
const ( ArchARM64 = "arm64" ArchAMD64 = "amd64" )
Architecture constants.
Variables ¶
var DefaultRunnerSpecs = map[string]string{
"2cpu-linux-arm64": "t4g.medium",
"4cpu-linux-arm64": "c7g.xlarge",
"8cpu-linux-arm64": "c7g.2xlarge",
"2cpu-linux-amd64": "t3.medium",
"4cpu-linux-amd64": "c6i.xlarge",
"8cpu-linux-amd64": "c6i.2xlarge",
"2cpu-windows-amd64": "t3.medium",
"4cpu-windows-amd64": "m6i.xlarge",
"8cpu-windows-amd64": "m6i.2xlarge",
}
DefaultRunnerSpecs maps runner spec names to EC2 instance types.
var SpotDiversificationTypes = map[string][]string{
"2cpu-linux-arm64": {"t4g.medium", "t4g.large"},
"4cpu-linux-arm64": {"c7g.xlarge", "m7g.xlarge", "c6g.xlarge"},
"8cpu-linux-arm64": {"c7g.2xlarge", "m7g.2xlarge", "c6g.2xlarge"},
"2cpu-linux-amd64": {"t3.medium", "t3.large"},
"4cpu-linux-amd64": {"c6i.xlarge", "m6i.xlarge", "c7i.xlarge"},
"8cpu-linux-amd64": {"c6i.2xlarge", "m6i.2xlarge", "c7i.2xlarge"},
"2cpu-windows-amd64": {"t3.medium", "t3.large"},
"4cpu-windows-amd64": {"m6i.xlarge", "m7i.xlarge", "c6i.xlarge"},
"8cpu-windows-amd64": {"m6i.2xlarge", "m7i.2xlarge", "c6i.2xlarge"},
}
SpotDiversificationTypes maps runner specs to alternative instance types for spot capacity. When spot is enabled, EC2 Fleet selects from this pool for better availability. All instance types must meet the minimum CPU requirement of the runner spec. Note: 4cpu and 8cpu specs use only sustained-performance instances (no burstable) to avoid CPU throttling after burst credits exhaust.
Functions ¶
func IsWindowsRunner ¶
IsWindowsRunner returns true if the runner spec is for Windows.
func ParseWebhook ¶
ParseWebhook validates HMAC signature and parses GitHub webhook payload with 1MB size limit.
Types ¶
type JobConfig ¶
type JobConfig struct {
RunID string
InstanceType string
Pool string
Private bool
Spot bool
RunnerSpec string
Region string // Multi-region support (Phase 3)
Environment string // Per-stack environment support (Phase 6)
OS string // Operating system (linux, windows)
Arch string // Architecture (amd64, arm64)
Backend string // Compute backend: "ec2" or "k8s" (empty = use default)
// Flexible instance selection (Phase 10)
InstanceTypes []string // Multiple instance types for spot diversification
CPUMin int // Minimum vCPUs (from cpu= label)
CPUMax int // Maximum vCPUs (from cpu= label, e.g., cpu=4+16)
RAMMin float64 // Minimum RAM in GB (from ram= label)
RAMMax float64 // Maximum RAM in GB (from ram= label, e.g., ram=8+32)
Families []string // Instance families (from family= label, e.g., family=c7g+m7g)
OriginalLabel string // Original runs-fleet label from workflow (for GitHub matching)
// Storage configuration
StorageGiB int // Disk storage in GiB (from disk= label, e.g., disk=100)
}
JobConfig represents parsed runner configuration from workflow job labels.
func ParseLabels ¶
ParseLabels extracts runner configuration from runs-fleet= workflow job labels. Supports both legacy runner= specs and flexible cpu=/ram=/family=/arch= labels.
Legacy format:
runs-fleet=<run-id>/runner=4cpu-linux-arm64/pool=default/spot=true
Flexible format:
runs-fleet=<run-id>/cpu=4+16/ram=8+32/family=c7g+m7g/arch=arm64/spot=true
The flexible format allows specifying CPU and RAM ranges (min+max) for better spot instance availability. Multiple instance families can be specified with +.