Integrating self-hosted runners for platform-specific builds in GitHub Actions Runner Group
TypeScriptWhen creating self-hosted runners for GitHub Actions Runner Groups with platform-specific builds, you're essentially setting up individual runners that will receive jobs from your GitHub Actions workflows to execute the CI/CD pipelines on servers you manage.
Below is a Pulumi program written in TypeScript which creates a Runner Group in GitHub. This Runner Group can then be populated with self-hosted runners that you set up outside of Pulumi.
The program uses the
github.ActionsRunnerGroup
resource to define a new runner group in GitHub. Note that the actual runners (the machines or containers that execute your CI/CD jobs) are not managed by Pulumi directly; you'll need to manually register them with GitHub after they are created using other tools or scripts. The Pulumi program simply sets up the organizational structure within GitHub Actions to manage these runners.import * as github from "@pulumi/github"; // Create a new GitHub Actions Runner Group. const runnerGroup = new github.ActionsRunnerGroup("example-runner-group", { // The name of the runner group. name: "platform-specific-builds", // The visibility of the group (all repositories, selected repositories, or private repositories). visibility: "all", }); // Export the runner group's ID for reference. export const runnerGroupId = runnerGroup.id;
Explanation
-
Import Statement: We import the necessary package to interact with GitHub (
@pulumi/github
). -
ActionsRunnerGroup: This is the Pulumi resource that defines a new GitHub Actions Runner Group.
-
visibility: This property determines which repositories this runner group can serve. Based on the value provided (
"all"
), this group will be available to all repositories within the associated GitHub organization.
After the Program
Once you have this runner group created, the next steps involve manual actions:
- Setting up a server or a virtual machine with the required specifications and operating system for your platform-specific builds.
- Installing GitHub Actions runner application on that server or VM.
- Configuring the runner application with the details of your GitHub organization and the newly created runner group.
After you follow the above steps, your self-hosted runner will be ready to process jobs from GitHub Actions workflows that specify to use runners from this runner group.
Keep in mind this program is focused on creating the GitHub Actions Runner Group only. If you want to automate the provisioning and configuration of the actual runner machines, you'd need to use additional tools or services outside of GitHub and Pulumi's GitHub provider.
-