mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-10 11:41:27 +00:00
* feat: HorizontalRunnerAutoscaler Webhook server This introduces a Webhook server that responds GitHub `check_run`, `pull_request`, and `push` events by scaling up matched HorizontalRunnerAutoscaler by 1 replica. This allows you to immediately add "resource slack" for future GitHub Actions job runs, without waiting next sync period to add insufficient runners. This feature is highly inspired by https://github.com/philips-labs/terraform-aws-github-runner. terraform-aws-github-runner can manage one set of runners per deployment, where actions-runner-controller with this feature can manage as many sets of runners as you declare with HorizontalRunnerAutoscaler and RunnerDeployment pairs. On each GitHub event received, the webhook server queries repository-wide and organizational runners from the cluster and searches for the single target to scale up. The webhook server tries to match HorizontalRunnerAutoscaler.Spec.ScaleUpTriggers[].GitHubEvent.[CheckRun|Push|PullRequest] against the event and if it finds only one HRA, it is the scale target. If none or two or more targets are found for repository-wide runners, it does the same on organizational runners. Changes: * Fix integration test * Update manifests * chart: Add support for github webhook server * dockerfile: Include github-webhook-server binary * Do not import unversioned go-github * Update README
40 lines
1.0 KiB
Docker
40 lines
1.0 KiB
Docker
# Build the manager binary
|
|
FROM golang:1.15 as builder
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
WORKDIR /workspace
|
|
|
|
ENV GO111MODULE=on \
|
|
CGO_ENABLED=0
|
|
|
|
# Copy the Go Modules manifests
|
|
COPY go.mod go.sum ./
|
|
|
|
# cache deps before building and copying source so that we don't need to re-download as much
|
|
# and so that source changes don't invalidate our downloaded layer
|
|
RUN go mod download
|
|
|
|
# Copy the go source
|
|
COPY . .
|
|
|
|
# Build
|
|
RUN export GOOS=$(echo ${TARGETPLATFORM} | cut -d / -f1) && \
|
|
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
|
|
GOARM=$(echo ${TARGETPLATFORM} | cut -d / -f3 | cut -c2-) && \
|
|
go build -a -o manager main.go && \
|
|
go build -a -o github-webhook-server ./cmd/githubwebhookserver
|
|
|
|
# Use distroless as minimal base image to package the manager binary
|
|
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
|
FROM gcr.io/distroless/static:nonroot
|
|
|
|
WORKDIR /
|
|
|
|
COPY --from=builder /workspace/manager .
|
|
COPY --from=builder /workspace/github-webhook-server .
|
|
|
|
USER nonroot:nonroot
|
|
|
|
ENTRYPOINT ["/manager"]
|