DevZero Logo
DevZero

GitHub Actions

GitHub Actions starter template for DevZero.

Self-hosted runner

These steps will allow you to create a workspace with all of the GitHub Actions required packages and binaries for a self-hosted runner

See DevZero's GitHub Actions docs for usage.

OPEN IN DEVZERO
Github Actions

version: "3"
build:
  steps:
    - type: apt-get
      packages:
        [
          "build-essential",
          "curl",
          "git",
          "nano",
          "software-properties-common",
          "ssh",
          "sudo",
          "tar",
          "unzip",
          "vim",
          "wget",
          "zip",
          "jq",
        ]
    - type: command
      command: |
        mkdir actions-runner && cd actions-runner
        curl -o actions-runner-linux-x64-2.320.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.320.0/actions-runner-linux-x64-2.320.0.tar.gz
        tar xzf ./actions-runner-linux-x64-2.320.0.tar.gz

launch:
  environment:
    - name: OWNER
      value: "INSERT-YOUR-GITHUB-ORG-NAME"
    - name: REPO
      value: "INSERT-YOUR-REPO-NAME"
    - name: GITHUB_PAT
      value: "{{secret:team.GITHUB_RUNNER_PAT}}" # see token permissions: https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-organization
  steps:
    - type: command
      name: create runner
      command: |
        cd actions-runner && ./config.sh --unattended --url https://github.com/${OWNER}/${REPO} --token $(curl         -X POST         -H "Accept: application/vnd.github+json"         -H "Authorization: Bearer "${GITHUB_PAT}""         https://api.github.com/repos/${OWNER}/${REPO}/actions/runners/registration-token | jq -r '.token')
    - type: command
      name: install and start runner
      command: |
        cd actions-runner && sudo ./svc.sh install && sudo ./svc.sh start

Actions Runner Controller

The Actions Runner Controller directions are in beta and running tests which require Docker aren't supported yet

Adjust the INSTALLATION_NAME, NAMESPACE, GITHUB_CONFIG_URL, and GITHUB_PAT variables as needed.

OPEN IN DEVZERO
Github Actions Runner

version: "3"
build:
  steps:
    - type: apt-get
      packages:
        [
          "build-essential",
          "curl",
          "git",
          "nano",
          "software-properties-common",
          "ssh",
          "sudo",
          "tar",
          "unzip",
          "vim",
          "wget",
          "zip",
        ]
    - type: command
      command: |
        curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
        sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && rm kubectl
      directory: /home/devzero
      user: devzero
    - type: command
      name: install helm
      command: |
        curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
        chmod 700 get_helm.sh
        ./get_helm.sh

launch:
  environment:
    - name: INSTALLATION_NAME
      value: "dz-arc-controller"
    - name: NAMESPACE
      value: "dz-arc-systems"
    - name: GITHUB_CONFIG_URL
      value: "https://github.com/ORG" # TODO: update with your org
    - name: GITHUB_PAT
      value: "{{ secret:team.GITHUB_ARC_PAT }}" # TODO: generate and set a Github PAT: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/authenticating-to-the-github-api#authenticating-arc-with-a-personal-access-token-classic
  steps:
    - type: command
      name: install controller
      command: helm install arc --namespace "${NAMESPACE}" --create-namespace  oci://ghcr.io/devzero-inc/actions-runner-charts/gha-runner-scale-set-controller
    - type: command
      name: install scale set
      command: |
        helm upgrade "${INSTALLATION_NAME}"             --install             --namespace "${NAMESPACE}"             --create-namespace             --set githubConfigUrl="${GITHUB_CONFIG_URL}"             --set githubConfigSecret.github_token="${GITHUB_PAT}"             oci://ghcr.io/devzero-inc/actions-runner-charts/gha-runner-scale-set

On this page