Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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.

  1. Create a GitHub App and install it on the target repository. Also, create a Kubernetes Secret to store the GitHub App’s authentication credentials.

  2. Create a AutoscalingRunnerSet resource 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: 256Mi
    

    Note

    The app.kubernetes.io/version label and .spec.listenerTemplate field 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:

  1. In the job’s runs-on property, specify the name set in the runnerScaleSetName of the AutoscalingRunnerSet.
    jobs:
      build:
        runs-on: RUNNER_NAME
        steps:
        - ...
    

References

For more detailed information about Actions Runner Controller, please refer to the official documentation.