Skip to content

Overview

Speed up your build by hosting CI Runners inside your existing EngFlow cluster and benefit from efficiency gains from co-location, warm Bazel instances, and warm Bazel caches.

CI Runners availability

CI Runners are not yet available to the public. Contact us to know when this feature becomes available.

CI Runners work equally well with

  • GitHub Actions (with a GitHub App)
  • Buildkite
  • And more coming soon!

CI Runners can be registered both at an organization and repository level, but they require a different pool separate from the other remote execution pools.

Configure GitHub Action CI Runners with a GitHub App

To configure GitHub Action CI runners you'll need to be a GitHub organization admin.

  1. Create a GitHub App in your organization with permission to register GitHub Self-hosted runners in the organization.
  2. Create a Private Key for the GitHub App.
  3. Create a .json file containing both the App ID and the Private Key, using the format.

    JSON
    1
    2
    3
    4
    {
      "github_app_id": "<app id>",
      "private_key": "<private key with newlines escaped>"
    }
    
  4. Upload that .json file to the Secrets Manager running in your EngFlow cluster. Note the address of the secret.

  5. Contact EngFlow support to configure the cluster for CI Runners. We will:

    1. Adding one or more pools for the CI Runners (one for each combination of architecture and OS).
    2. Providing the address for the GitHub App credential stored in Secrets Manager.
    3. (optional) Enabling sysbox docker runtime for docker-in-docker.

Configure GitHub Webhooks

  1. Contact EngFlow support to enable webhooks on the cluster for GitHub actions. EngFlow support will provide you with a confidential UUID for the GitHub webhook.
  2. Configure the GitHub webhook, in https://github.com/<organization>/ Settings Webhooks Add webhook, with the following settings:

    • Payload URL:

      https://<name>.cluster.engflow.com/webhooks/github/runners/<uuid> (provided by EngFlow)

    • Content type:

      application/json

    • Secret:

      none (we use a secret embedded in the webhook URL)

    • Select "Let me select individual events" and make sure that the only selected event type is "Workflow Jobs".

Use GitHub Action CI Runners

Once you've configured the GitHub Action CI Runners, add them to any workflow by adding the following tags to the workflow YAML, including at least one that starts with engflow-*:

  • self-hosted
  • arch=x64 (x64 or arm64)
  • engflow-container-image=docker://<docker URL>
  • engflow-pool=<pool name>
  • engflow-runtime=sysbox-runc (only if docker-in-docker is needed)
  • engflow-runner-id=${{ github.repository_id }}_${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}
  • os=linux (the arch and os must match the pool configuration)

The engflow-runner-id tag is mandatory -- it is a unique identifier per job, which ensures that EngFlow correctly handles the JIT CI runners.

If you were previously running the action outside a docker container, and if you are relying on secrets present on the action runner machines, you may have to make changes to the GitHub action. Below an example of a GitHub Action workflow running on CI runners:

ci-runner.yml
  action:
    runs-on:
      - self-hosted
      - "arch=x64"
      - "engflow-container-image=docker://XXXXXXXXXXXX.dkr.ecr.eu-west-1.amazonaws.com/engflow-ci/debian-11-dind:v9@sha256:4f58eb0419bd1b93b75d93660627b75579effaf0d461f744f145a1a3e7392e20
      - "engflow-pool=ci_sysbox_x64"
      - "engflow-runtime=sysbox-runc"
      - "os=linux"
    steps:
    - uses: actions/checkout@v3
    - name: Run all tests
      run: bazel test //...

Configure Buildkite CI Runners

Buildkite CI Runners are referred to as Buildkite agents in the Buildkite documentation. EngFlow Buildkite agents are registered at the organization level, and are available to every pipeline within that organization.

You'll need a Buildkite token to register the agents.

  1. Create the Buildkite agent token.
  2. Upload a JSON secrets file containing the Buildkite agent token and an SSH private key for the source repo to the Secrets Manager in your EngFlow cluster:

    JSON
    1
    2
    3
    4
    5
    {
      "BUILDKITE_AGENT_TOKEN": "<Buildkite Agent Token>",
      "SSH_PRIVATE_KEY": "<Multi-line SSH private key with newline as \n>",
      "ADDITIONAL_SECRET": "<Whatever you want>"
    }
    

    The SSH key is written to ~/.ssh/id_rsa. Other variables are written to hooks/environment.

  3. IMPORTANT, unset the secrets before running Bazel so they are not uploaded to the BES.

    Bash
    unset BUILDKITE_AGENT_TOKEN
    unset ADDITIONAL_SECRET
    
  4. Contact EngFlow support to configure the cluster for CI Runners. We will:

    1. Adding one or more pools for the CI Runners (one for each combination of architecture and OS).
    2. Providing the address for the GitHub App credential stored in Secrets Manager.
    3. Providing a confidential UUID for the Buildkite webhook.
  5. Configure Buildkite Webhooks in Organization Settings Notification Settings Add Webhook, with the following settings:

    • Webhook URL:

      https://<name>.cluster.engflow.com/webhooks/buildkite/agents/<uuid> (provided by EngFlow)

    • Make sure that the only selected event type is "ping" and "job.scheduled".

  6. To avoid Bazel creating a new directory for every build, set BUILDKITE_BUILD_CHECKOUT_PATH to a fixed path:

    INI
    BUILDKITE_BUILD_CHECKOUT_PATH=/home/engflow/.buildkite-agent/build
    
  7. To speed up Git checkout, set BUILDKITE_GIT_MIRRORS_PATH to a fixed path:

    INI
    BUILDKITE_GIT_MIRRORS_PATH=/home/engflow/.buildkite-agent/git-mirrors/.
    

Use Buildkite CI Runners

Once you've configured the Buildkite CI Runners, add them to any workflow.

In your Buildkite Pipeline configuration, add the following tags:

  • arch: "amd64" (amd64 or arm64)
  • engflow-container-image: "docker://<docker URL>"
  • engflow-pool: "<pool name>"
  • engflow-runtime: "sysbox-runc" (only if needed)
  • os: "linux" (arch and os are currently not inferred from the pool name)
pipeline.yml
1
2
3
4
5
6
7
8
9
steps:
  - label: ":buildkite: Upload steps"
    command: "buildkite-agent pipeline upload .buildkite/pipeline.yml"
    agents:
      arch: "arm64"
      engflow-container-image: "docker://XXXXXXXXXXXX.dkr.ecr.eu-west-1.amazonaws.com/engflow-ci/debian-11-dind-arm64:v10@sha256:ede6696571f4f56eaa5f01070fd5cd071cddfcb4650728979f502717bf73100b"
      engflow-runtime: "sysbox-runc"
      engflow-pool: "ci_sysbox_arm64"
      os: "linux"