Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: build

on:
workflow_call:
inputs:
flavor:
description: flavor of Dockerfile, e.g., actions-runner.ubuntu-22.04
required: true
type: string
outputs:
image-uri:
description: image URI
value: ${{ jobs.runner.outputs.image-uri }}
# pull_request:
# paths:
# - .github/workflows/build.yaml

jobs:
runner:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
packages: write
outputs:
image-uri: ghcr.io/${{ github.repository }}/runner@${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v3
with:
# https://github.com/actions/actions-runner-controller/pull/2616
repository: actions/actions-runner-controller
ref: 74617c1861ea191f5301f99d5a921da1925205a5
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: metadata
with:
images: ghcr.io/${{ github.repository }}/runner
flavor: suffix=${{ inputs.flavor }}
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v3
id: build
with:
context: runner
file: runner/${{ inputs.flavor }}.dockerfile
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: |
RUNNER_ASSETS_DIR=/home/runner
EXTERNALS_DIR_NAME=externals
TARGETPLATFORM=linux/amd64
RUNNER_VERSION=2.304.0
58 changes: 39 additions & 19 deletions .github/workflows/run.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
name: run

on:
pull_request:
paths:
- .github/workflows/run.yaml
- Makefile
- aqua.yaml
- helmfile.yaml
push:
branches:
- main
paths:
- .github/workflows/run.yaml
- Makefile
- aqua.yaml
- helmfile.yaml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
workflow_call:
inputs:
flavor:
description: flavor of Dockerfile, e.g., actions-runner.ubuntu-22.04
required: true
type: string

jobs:
build:
uses: ./.github/workflows/build.yaml
with:
flavor: ${{ inputs.flavor }}
permissions:
contents: read
packages: write

params:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
runner-name: ${{ steps.generate.outputs.runner-name }}
steps:
- uses: actions/github-script@v6
id: generate
env:
flavor: ${{ inputs.flavor }}
with:
script: |
core.setOutput('runner-name', process.env.flavor.replaceAll('.', '-'))

controller:
needs:
- build
- params
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -32,6 +45,8 @@ jobs:
- run: make cluster
- run: make deploy
env:
MY_RUNNER_NAME: ${{ needs.params.outputs.runner-name }}
MY_RUNNER_IMAGE_URI: ${{ needs.build.outputs.image-uri }}
APP_ID: ${{ secrets.APP_ID }}
APP_INSTALLATION_ID: ${{ secrets.APP_INSTALLATION_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
Expand All @@ -42,8 +57,13 @@ jobs:
if: always()

runner:
runs-on: runner-scale-set-${{ github.run_id }}
needs:
- build
- params
runs-on: ${{ needs.params.outputs.runner-name }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- run: env
- run: docker version
continue-on-error: true
41 changes: 41 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: test

on:
pull_request:
paths:
- .github/workflows/run.yaml
- Makefile
- aqua.yaml
- helmfile.yaml
push:
branches:
- main
paths:
- .github/workflows/run.yaml
- Makefile
- aqua.yaml
- helmfile.yaml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
flavor:
strategy:
fail-fast: false
matrix:
flavor:
- actions-runner.ubuntu-22.04
- actions-runner-dind.ubuntu-22.04
- actions-runner-dind-rootless.ubuntu-22.04
- actions-runner.ubuntu-20.04
- actions-runner-dind.ubuntu-20.04
- actions-runner-dind-rootless.ubuntu-20.04
uses: ./.github/workflows/run.yaml
with:
flavor: ${{ matrix.flavor }}
permissions:
contents: read
packages: write
secrets: inherit
10 changes: 9 additions & 1 deletion helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ releases:
version: 0.4.0

- needs: [arc-systems/arc]
name: runner-scale-set-{{ requiredEnv "GITHUB_RUN_ID" }}
name: {{ requiredEnv "MY_RUNNER_NAME" | quote }}
namespace: arc-runners
chart: actions-runner-controller-charts/gha-runner-scale-set
version: 0.4.0
Expand All @@ -22,6 +22,14 @@ releases:
github_app_id: {{ requiredEnv "APP_ID" | quote }}
github_app_installation_id: {{ requiredEnv "APP_INSTALLATION_ID" | quote }}
github_app_private_key: {{ requiredEnv "APP_PRIVATE_KEY" | quote }}
template:
spec:
containers:
- name: runner
command: ["/home/runner/run.sh"]
image: {{ requiredEnv "MY_RUNNER_IMAGE_URI" | quote }}
securityContext:
privileged: true

helmDefaults:
wait: true