Warning
This page was translated from the original Japanese version by PLaMo Translate. The Japanese version is authoritative; the English translation may contain inaccuracies.
Running GitHub Actions Jobs
PFCP enables the execution of GitHub Actions jobs on clusters. This allows users to build comprehensive CI/CD pipelines that leverage cluster resources.
For executing GitHub Actions jobs, PFCP provides the Actions Runner Controller (ARC). Using ARC, you can deploy self-hosted runners directly on your cluster to run GitHub Actions jobs.
Below we outline the process for executing GitHub Actions jobs with ARC.
Configuring Self-Hosted Runners
First, follow the steps below to set up self-hosted runners on your cluster. The number of runners will automatically scale based on the number of queued jobs.
-
Create a GitHub App and install it on the target repository. Also, create a Kubernetes Secret to store the GitHub App’s authentication credentials.
- For detailed instructions, refer to Authenticating ARC to the GitHub API - GitHub Documentation.
-
Create a
AutoscalingRunnerSetresource in your cluster. Below is an example configuration:apiVersion: actions.github.com/v1alpha1 kind: AutoscalingRunnerSet metadata: name: NAME spec: githubConfigUrl: https://github.com/ORG/REPO # The repository where runners will be registered githubConfigSecret: SECRET_NAME # The name of the Secret created in step 1 runnerScaleSetName: RUNNER_NAME # The name specified in the "runs-on" field for GitHub Actions jobs # Configuration for automatic runner scaling minRunners: 0 maxRunners: 20 # Template for runner pods template: spec: containers: - name: runner image: ghcr.io/actions/actions-runner command: - /home/runner/run.sh # Adjust resource limits according to the jobs you intend to run resources: requests: cpu: 100m limits: memory: 256MiNote
The
app.kubernetes.io/versionlabel and.spec.listenerTemplatefield of the AutoscalingRunnerSet resource are automatically configured. Any existing values will be overwritten.
Using with Your GitHub Actions Job
To utilize the self-hosted runners you’ve created in your GitHub Actions job, follow these steps:
- In the job’s
runs-onproperty, specify the name set in therunnerScaleSetNameof the AutoscalingRunnerSet.jobs: build: runs-on: RUNNER_NAME steps: - ...
References
For more detailed information about Actions Runner Controller, please refer to the official documentation.