2021-06-22 17:10:09 +09:00
|
|
|
apiVersion: actions.summerwind.dev/v1alpha1
|
|
|
|
|
kind: RunnerSet
|
|
|
|
|
metadata:
|
2022-02-27 11:43:07 +00:00
|
|
|
name: ${NAME}
|
2021-06-22 17:10:09 +09:00
|
|
|
spec:
|
|
|
|
|
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted:
|
|
|
|
|
# missing required field "selector" in dev.summerwind.actions.v1alpha1.RunnerSet.spec
|
|
|
|
|
selector:
|
|
|
|
|
matchLabels:
|
2022-02-27 11:43:07 +00:00
|
|
|
app: ${NAME}
|
2021-06-22 17:10:09 +09:00
|
|
|
|
|
|
|
|
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted:
|
|
|
|
|
# missing required field "serviceName" in dev.summerwind.actions.v1alpha1.RunnerSet.spec]
|
2022-02-27 11:43:07 +00:00
|
|
|
serviceName: ${NAME}
|
2021-06-22 17:10:09 +09:00
|
|
|
|
|
|
|
|
#replicas: 1
|
2021-06-24 20:39:37 +09:00
|
|
|
|
|
|
|
|
# From my limited testing, `ephemeral: true` is more reliable.
|
|
|
|
|
# Seomtimes, updating already deployed runners from `ephemeral: false` to `ephemeral: true` seems to
|
|
|
|
|
# result in queued jobs hanging forever.
|
feat: Workflow job based ephemeral runner scaling (#721)
This add support for two upcoming enhancements on the GitHub side of self-hosted runners, ephemeral runners, and `workflow_jow` events. You can't use these yet.
**These features are not yet generally available to all GitHub users**. Please take this pull request as a preparation to make it available to actions-runner-controller users as soon as possible after GitHub released the necessary features on their end.
**Ephemeral runners**:
The former, ephemeral runners, is basically the reliable alternative to `--once`, which we've been using when you enabled `ephemeral: true` (default in actions-runner-controller).
`--once` has been suffering from a race issue #466. `--ephemeral` fixes that.
To enable ephemeral runners with `actions/runner`, you give `--ephemeral` to `config.sh`. This updated version of `actions-runner-controller` does it for you, by using `--ephemeral` instead of `--once` when you set `RUNNER_FEATURE_FLAG_EPHEMERAL=true`.
Please read the section `Ephemeral Runners` in the updated version of our README for more information.
Note that ephemeral runners is not released on GitHub yet. And `RUNNER_FEATURE_FLAG_EPHEMERAL=true` won't work at all until the feature gets released on GitHub. Stay tuned for an announcement from GitHub!
**`workflow_job` events**:
`workflow_job` is the additional webhook event that corresponds to each GitHub Actions workflow job run. It provides `actions-runner-controller` a solid foundation to improve our webhook-based autoscale.
Formerly, we've been exploiting webhook events like `check_run` for autoscaling. However, as none of our supported events has included `labels`, you had to configure an HRA to only match relevant `check_run` events. It wasn't trivial.
In contrast, a `workflow_job` event payload contains `labels` of runners requested. `actions-runner-controller` is able to automatically decide which HRA to scale by filtering the corresponding RunnerDeployment by `labels` included in the webhook payload. So all you need to use webhook-based autoscale will be to enable `workflow_job` on GitHub and expose actions-runner-controller's webhook server to the internet.
Note that the current implementation of `workflow_job` support works in two ways, increment, and decrement. An increment happens when the webhook server receives` workflow_job` of `queued` status. A decrement happens when it receives `workflow_job` of `completed` status. The latter is used to make scaling-down faster so that you waste money less than before. You still don't suffer from flapping, as a scale-down is still subject to `scaleDownDelaySecondsAfterScaleOut `.
Please read the section `Example 3: Scale on each `workflow_job` event` in the updated version of our README for more information on its usage.
2021-08-11 09:52:04 +09:00
|
|
|
ephemeral: ${TEST_EPHEMERAL}
|
2021-06-22 17:10:09 +09:00
|
|
|
|
2022-02-27 11:43:07 +00:00
|
|
|
enterprise: ${TEST_ENTERPRISE}
|
|
|
|
|
group: ${TEST_GROUP}
|
|
|
|
|
organization: ${TEST_ORG}
|
2021-06-22 17:10:09 +09:00
|
|
|
repository: ${TEST_REPO}
|
2022-02-27 11:43:07 +00:00
|
|
|
|
2021-06-22 17:10:09 +09:00
|
|
|
#
|
|
|
|
|
# Custom runner image
|
|
|
|
|
#
|
|
|
|
|
image: ${RUNNER_NAME}:${RUNNER_TAG}
|
2022-02-27 11:43:07 +00:00
|
|
|
|
2021-06-22 17:10:09 +09:00
|
|
|
#
|
|
|
|
|
# dockerd within runner container
|
|
|
|
|
#
|
|
|
|
|
## Replace `mumoshu/actions-runner-dind:dev` with your dind image
|
|
|
|
|
#dockerdWithinRunnerContainer: true
|
2022-02-27 11:43:07 +00:00
|
|
|
dockerdWithinRunnerContainer: ${RUNNER_DOCKERD_WITHIN_RUNNER_CONTAINER}
|
|
|
|
|
|
2021-06-22 17:10:09 +09:00
|
|
|
#
|
|
|
|
|
# Set the MTU used by dockerd-managed network interfaces (including docker-build-ubuntu)
|
|
|
|
|
#
|
|
|
|
|
#dockerMTU: 1450
|
|
|
|
|
#Runner group
|
|
|
|
|
# labels:
|
|
|
|
|
# - "mylabel 1"
|
|
|
|
|
# - "mylabel 2"
|
e2e: Install and run workflow and verify the result (#661)
This enhances the E2E test suite introduced in #658 to also include the following steps:
- Install GitHub Actions workflow
- Trigger a workflow run via a git commit
- Verify the workflow run result
In the workflow, we use `kubectl create cm --from-literal` to create a configmap that contains an unique test ID. In the last step we obtain the configmap from within the E2E test and check the test ID to match the expected one.
To install a GitHub Actions workflow, we clone a GitHub repository denoted by the TEST_REPO envvar, progmatically generate a few files with some Go code, run `git-add`, `git-commit`, and then `git-push` to actually push the files to the repository. A single commit containing an updated workflow definition and an updated file seems to run a workflow derived to the definition introduced in the commit, which was a bit surpirising and useful behaviour.
At this point, the E2E test fully covers all the steps for a GitHub token based installation. We need to add scenarios for more deployment options, like GitHub App, RunnerDeployment, HRA, and so on. But each of them would worth another pull request.
2021-06-28 08:30:32 +09:00
|
|
|
labels:
|
|
|
|
|
- "${RUNNER_LABEL}"
|
2021-06-22 17:10:09 +09:00
|
|
|
#
|
|
|
|
|
# Non-standard working directory
|
|
|
|
|
#
|
|
|
|
|
# workDir: "/"
|
|
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
2022-02-27 11:43:07 +00:00
|
|
|
app: ${NAME}
|
2021-06-22 17:10:09 +09:00
|
|
|
spec:
|
|
|
|
|
containers:
|
|
|
|
|
- name: runner
|
|
|
|
|
imagePullPolicy: IfNotPresent
|
feat: Workflow job based ephemeral runner scaling (#721)
This add support for two upcoming enhancements on the GitHub side of self-hosted runners, ephemeral runners, and `workflow_jow` events. You can't use these yet.
**These features are not yet generally available to all GitHub users**. Please take this pull request as a preparation to make it available to actions-runner-controller users as soon as possible after GitHub released the necessary features on their end.
**Ephemeral runners**:
The former, ephemeral runners, is basically the reliable alternative to `--once`, which we've been using when you enabled `ephemeral: true` (default in actions-runner-controller).
`--once` has been suffering from a race issue #466. `--ephemeral` fixes that.
To enable ephemeral runners with `actions/runner`, you give `--ephemeral` to `config.sh`. This updated version of `actions-runner-controller` does it for you, by using `--ephemeral` instead of `--once` when you set `RUNNER_FEATURE_FLAG_EPHEMERAL=true`.
Please read the section `Ephemeral Runners` in the updated version of our README for more information.
Note that ephemeral runners is not released on GitHub yet. And `RUNNER_FEATURE_FLAG_EPHEMERAL=true` won't work at all until the feature gets released on GitHub. Stay tuned for an announcement from GitHub!
**`workflow_job` events**:
`workflow_job` is the additional webhook event that corresponds to each GitHub Actions workflow job run. It provides `actions-runner-controller` a solid foundation to improve our webhook-based autoscale.
Formerly, we've been exploiting webhook events like `check_run` for autoscaling. However, as none of our supported events has included `labels`, you had to configure an HRA to only match relevant `check_run` events. It wasn't trivial.
In contrast, a `workflow_job` event payload contains `labels` of runners requested. `actions-runner-controller` is able to automatically decide which HRA to scale by filtering the corresponding RunnerDeployment by `labels` included in the webhook payload. So all you need to use webhook-based autoscale will be to enable `workflow_job` on GitHub and expose actions-runner-controller's webhook server to the internet.
Note that the current implementation of `workflow_job` support works in two ways, increment, and decrement. An increment happens when the webhook server receives` workflow_job` of `queued` status. A decrement happens when it receives `workflow_job` of `completed` status. The latter is used to make scaling-down faster so that you waste money less than before. You still don't suffer from flapping, as a scale-down is still subject to `scaleDownDelaySecondsAfterScaleOut `.
Please read the section `Example 3: Scale on each `workflow_job` event` in the updated version of our README for more information on its usage.
2021-08-11 09:52:04 +09:00
|
|
|
env:
|
|
|
|
|
- name: RUNNER_FEATURE_FLAG_EPHEMERAL
|
|
|
|
|
value: "${RUNNER_FEATURE_FLAG_EPHEMERAL}"
|
2021-06-22 17:10:09 +09:00
|
|
|
#- name: docker
|
|
|
|
|
# #image: mumoshu/actions-runner-dind:dev
|
2022-02-27 11:43:07 +00:00
|
|
|
---
|
|
|
|
|
apiVersion: actions.summerwind.dev/v1alpha1
|
|
|
|
|
kind: HorizontalRunnerAutoscaler
|
|
|
|
|
metadata:
|
|
|
|
|
name: ${NAME}
|
|
|
|
|
spec:
|
|
|
|
|
scaleTargetRef:
|
|
|
|
|
kind: RunnerSet
|
|
|
|
|
name: ${NAME}
|
|
|
|
|
scaleUpTriggers:
|
|
|
|
|
- githubEvent: {}
|
|
|
|
|
amount: 1
|
|
|
|
|
duration: "10m"
|
|
|
|
|
minReplicas: ${RUNNER_MIN_REPLICAS}
|
|
|
|
|
maxReplicas: 10
|
|
|
|
|
scaleDownDelaySecondsAfterScaleOut: ${RUNNER_SCALE_DOWN_DELAY_SECONDS_AFTER_SCALE_OUT}
|