mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-12 04:26:51 +00:00
Compare commits
70 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2d3489171 | ||
|
|
90db051e3e | ||
|
|
41e135be59 | ||
|
|
11938d728d | ||
|
|
bfd63fb6f9 | ||
|
|
c70e760b19 | ||
|
|
3c7e32eb9f | ||
|
|
ccc7b81b5c | ||
|
|
701f8427a0 | ||
|
|
20322eb2c9 | ||
|
|
72edcbba10 | ||
|
|
5396f9322b | ||
|
|
65b0cdc588 | ||
|
|
b7dbf997ec | ||
|
|
c04f1daeab | ||
|
|
84b7abe2ce | ||
|
|
85422d15a8 | ||
|
|
d3e9c43c34 | ||
|
|
6a9b0d74fd | ||
|
|
3e1fbfa830 | ||
|
|
c842be4501 | ||
|
|
132867482f | ||
|
|
6a2a90164f | ||
|
|
f7952743e5 | ||
|
|
1492a0d0f9 | ||
|
|
26d9758452 | ||
|
|
6ac125f060 | ||
|
|
48af148297 | ||
|
|
818c1bd3dd | ||
|
|
a4c569f552 | ||
|
|
55d5550ad4 | ||
|
|
ddc29b1d38 | ||
|
|
b684553da2 | ||
|
|
ec8a74f219 | ||
|
|
73e6a91de3 | ||
|
|
e1c62ee5e5 | ||
|
|
a192a76ca9 | ||
|
|
a7d378ca09 | ||
|
|
285cfd69cd | ||
|
|
c1fb952a94 | ||
|
|
b1916a0e1a | ||
|
|
44972a284c | ||
|
|
6dd93508e7 | ||
|
|
930efd244d | ||
|
|
60f577ea04 | ||
|
|
31a16d3c2e | ||
|
|
c53a03372d | ||
|
|
e9caad7dec | ||
|
|
7a21693912 | ||
|
|
942fc9fe00 | ||
|
|
a2096046d5 | ||
|
|
a7cb21605c | ||
|
|
c495ce47ed | ||
|
|
f1a1941455 | ||
|
|
a19eab8382 | ||
|
|
4ee7e5541f | ||
|
|
013d5bd2b2 | ||
|
|
c1d36ebaef | ||
|
|
71eb2ae333 | ||
|
|
dd1ad63ca9 | ||
|
|
de7e37509c | ||
|
|
51918fecbe | ||
|
|
4fb7d154d6 | ||
|
|
ace95d72ab | ||
|
|
42493d5e01 | ||
|
|
94e8c6ffbf | ||
|
|
563c79c1b9 | ||
|
|
cbb41cbd18 | ||
|
|
64a1a58acf | ||
|
|
524cf1b379 |
2
.github/workflows/build-runner.yml
vendored
2
.github/workflows/build-runner.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
- name: actions-runner-dind
|
- name: actions-runner-dind
|
||||||
dockerfile: dindrunner.Dockerfile
|
dockerfile: dindrunner.Dockerfile
|
||||||
env:
|
env:
|
||||||
RUNNER_VERSION: 2.274.2
|
RUNNER_VERSION: 2.275.1
|
||||||
DOCKER_VERSION: 19.03.12
|
DOCKER_VERSION: 19.03.12
|
||||||
DOCKERHUB_USERNAME: ${{ github.repository_owner }}
|
DOCKERHUB_USERNAME: ${{ github.repository_owner }}
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -25,7 +25,7 @@ kubectl apply -f https://github.com/summerwind/actions-runner-controller/release
|
|||||||
If you use either Github Enterprise Cloud or Server (and have recent enought version supporting Actions), you can use **actions-runner-controller** with those, too. Authentication works same way as with public Github (repo and organization level).
|
If you use either Github Enterprise Cloud or Server (and have recent enought version supporting Actions), you can use **actions-runner-controller** with those, too. Authentication works same way as with public Github (repo and organization level).
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl set env deploy controller-manager -c manager GITHUB_ENTERPRISE_URL=<GHEC/S URL>
|
kubectl set env deploy controller-manager -c manager GITHUB_ENTERPRISE_URL=<GHEC/S URL> --namespace actions-runner-system
|
||||||
```
|
```
|
||||||
|
|
||||||
[Enterprise level](https://docs.github.com/en/enterprise-server@2.22/actions/hosting-your-own-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-an-enterprise) runners are not working yet as there's no API definition for those.
|
[Enterprise level](https://docs.github.com/en/enterprise-server@2.22/actions/hosting-your-own-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-an-enterprise) runners are not working yet as there's no API definition for those.
|
||||||
@@ -409,7 +409,7 @@ Note that if you specify `self-hosted` in your workflow, then this will run your
|
|||||||
|
|
||||||
## Runner Groups
|
## Runner Groups
|
||||||
|
|
||||||
Runner groups can be used to limit which repositories are able to use the GitHub Runner at an Organisation level.
|
Runner groups can be used to limit which repositories are able to use the GitHub Runner at an Organisation level. Runner groups have to be [created in GitHub first](https://docs.github.com/en/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups) before they can be referenced.
|
||||||
|
|
||||||
To add the runner to the group `NewGroup`, specify the group in your `Runner` or `RunnerDeployment` spec.
|
To add the runner to the group `NewGroup`, specify the group in your `Runner` or `RunnerDeployment` spec.
|
||||||
|
|
||||||
@@ -468,11 +468,11 @@ The virtual environments from GitHub contain a lot more software packages (diffe
|
|||||||
If there is a need to include packages in the runner image for which there is no setup action, then this can be achieved by building a custom container image for the runner. The easiest way is to start with the `summerwind/actions-runner` image and installing the extra dependencies directly in the docker image:
|
If there is a need to include packages in the runner image for which there is no setup action, then this can be achieved by building a custom container image for the runner. The easiest way is to start with the `summerwind/actions-runner` image and installing the extra dependencies directly in the docker image:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
FROM summerwind/actions-runner:v2.169.1
|
FROM summerwind/actions-runner:latest
|
||||||
|
|
||||||
RUN sudo apt update -y \
|
RUN sudo apt update -y \
|
||||||
&& apt install YOUR_PACKAGE
|
&& sudo apt install YOUR_PACKAGE
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& sudo rm -rf /var/lib/apt/lists/*
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then configure the runner to use a custom docker image by configuring the `image` field of a `Runner` or `RunnerDeployment`:
|
You can then configure the runner to use a custom docker image by configuring the `image` field of a `Runner` or `RunnerDeployment`:
|
||||||
@@ -519,7 +519,7 @@ NAME=$DOCKER_USER/actions-runner-controller \
|
|||||||
|
|
||||||
Please follow the instructions explained in [Using Personal Access Token](#using-personal-access-token) to obtain
|
Please follow the instructions explained in [Using Personal Access Token](#using-personal-access-token) to obtain
|
||||||
`GITHUB_TOKEN`, and those in [Using GitHub App](#using-github-app) to obtain `APP_ID`, `INSTALLATION_ID`, and
|
`GITHUB_TOKEN`, and those in [Using GitHub App](#using-github-app) to obtain `APP_ID`, `INSTALLATION_ID`, and
|
||||||
`PRIAVTE_KEY_FILE_PATH`.
|
`PRIVATE_KEY_FILE_PATH`.
|
||||||
|
|
||||||
The test creates a one-off `kind` cluster, deploys `cert-manager` and `actions-runner-controller`,
|
The test creates a one-off `kind` cluster, deploys `cert-manager` and `actions-runner-controller`,
|
||||||
creates a `RunnerDeployment` custom resource for a public Git repository to confirm that the
|
creates a `RunnerDeployment` custom resource for a public Git repository to confirm that the
|
||||||
@@ -527,7 +527,7 @@ controller is able to bring up a runner pod with the actions runner registration
|
|||||||
|
|
||||||
If you prefer to test in a non-kind cluster, you can instead run:
|
If you prefer to test in a non-kind cluster, you can instead run:
|
||||||
|
|
||||||
```shell script
|
```shell
|
||||||
KUBECONFIG=path/to/kubeconfig \
|
KUBECONFIG=path/to/kubeconfig \
|
||||||
NAME=$DOCKER_USER/actions-runner-controller \
|
NAME=$DOCKER_USER/actions-runner-controller \
|
||||||
GITHUB_TOKEN=*** \
|
GITHUB_TOKEN=*** \
|
||||||
|
|||||||
4
artifacthub-repo.yml
Normal file
4
artifacthub-repo.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
repositoryID: 6e120248-b034-45e5-b16c-6015ecfa7c6c
|
||||||
|
owners:
|
||||||
|
- name: mumoshu
|
||||||
|
email: ykuoka@gmail.com
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{{- if or .Values.authSecret.enabled }}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: controller-manager
|
||||||
|
namespace: {{ .Release.Namespace }}
|
||||||
|
labels:
|
||||||
|
{{- include "actions-runner-controller.labels" . | nindent 4 }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{- range $k, $v := .Values.authSecret }}
|
||||||
|
{{ $k }}: {{ $v | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
@@ -8,6 +8,17 @@ replicaCount: 1
|
|||||||
|
|
||||||
syncPeriod: 10m
|
syncPeriod: 10m
|
||||||
|
|
||||||
|
# Only 1 authentication method can be deployed at a time
|
||||||
|
# Uncomment the configuration you are applying and fill in the details
|
||||||
|
authSecret:
|
||||||
|
enabled: false
|
||||||
|
### GitHub Apps Configuration
|
||||||
|
#github_app_id: ""
|
||||||
|
#github_app_installation_id: ""
|
||||||
|
#github_app_private_key: |
|
||||||
|
### GitHub PAT Configuration
|
||||||
|
#github_token: ""
|
||||||
|
|
||||||
image:
|
image:
|
||||||
repository: summerwind/actions-runner-controller
|
repository: summerwind/actions-runner-controller
|
||||||
# Overrides the manager image tag whose default is the chart appVersion if the tag key is commented out
|
# Overrides the manager image tag whose default is the chart appVersion if the tag key is commented out
|
||||||
|
|||||||
@@ -219,23 +219,19 @@ func (r *HorizontalRunnerAutoscalerReconciler) calculateReplicasByPercentageRunn
|
|||||||
var desiredReplicas int
|
var desiredReplicas int
|
||||||
fractionBusy := float64(numRunnersBusy) / float64(numRunners)
|
fractionBusy := float64(numRunnersBusy) / float64(numRunners)
|
||||||
if fractionBusy >= scaleUpThreshold {
|
if fractionBusy >= scaleUpThreshold {
|
||||||
scaleUpReplicas := int(math.Ceil(float64(numRunners) * scaleUpFactor))
|
desiredReplicas = int(math.Ceil(float64(numRunners) * scaleUpFactor))
|
||||||
if scaleUpReplicas > maxReplicas {
|
|
||||||
desiredReplicas = maxReplicas
|
|
||||||
} else {
|
|
||||||
desiredReplicas = scaleUpReplicas
|
|
||||||
}
|
|
||||||
} else if fractionBusy < scaleDownThreshold {
|
} else if fractionBusy < scaleDownThreshold {
|
||||||
scaleDownReplicas := int(float64(numRunners) * scaleDownFactor)
|
desiredReplicas = int(float64(numRunners) * scaleDownFactor)
|
||||||
if scaleDownReplicas < minReplicas {
|
|
||||||
desiredReplicas = minReplicas
|
|
||||||
} else {
|
|
||||||
desiredReplicas = scaleDownReplicas
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
desiredReplicas = *rd.Spec.Replicas
|
desiredReplicas = *rd.Spec.Replicas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if desiredReplicas < minReplicas {
|
||||||
|
desiredReplicas = minReplicas
|
||||||
|
} else if desiredReplicas > maxReplicas {
|
||||||
|
desiredReplicas = maxReplicas
|
||||||
|
}
|
||||||
|
|
||||||
r.Log.V(1).Info(
|
r.Log.V(1).Info(
|
||||||
"Calculated desired replicas",
|
"Calculated desired replicas",
|
||||||
"computed_replicas_desired", desiredReplicas,
|
"computed_replicas_desired", desiredReplicas,
|
||||||
|
|||||||
@@ -426,6 +426,9 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !dockerdInRunner && dockerEnabled {
|
if !dockerdInRunner && dockerEnabled {
|
||||||
|
runnerVolumeName := "runner"
|
||||||
|
runnerVolumeMountPath := "/runner"
|
||||||
|
|
||||||
pod.Spec.Volumes = []corev1.Volume{
|
pod.Spec.Volumes = []corev1.Volume{
|
||||||
{
|
{
|
||||||
Name: "work",
|
Name: "work",
|
||||||
@@ -434,7 +437,7 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "externals",
|
Name: runnerVolumeName,
|
||||||
VolumeSource: corev1.VolumeSource{
|
VolumeSource: corev1.VolumeSource{
|
||||||
EmptyDir: &corev1.EmptyDirVolumeSource{},
|
EmptyDir: &corev1.EmptyDirVolumeSource{},
|
||||||
},
|
},
|
||||||
@@ -452,8 +455,8 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
|
|||||||
MountPath: workDir,
|
MountPath: workDir,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "externals",
|
Name: runnerVolumeName,
|
||||||
MountPath: "/runner/externals",
|
MountPath: runnerVolumeMountPath,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "certs-client",
|
Name: "certs-client",
|
||||||
@@ -484,8 +487,8 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) {
|
|||||||
MountPath: workDir,
|
MountPath: workDir,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "externals",
|
Name: runnerVolumeName,
|
||||||
MountPath: "/runner/externals",
|
MountPath: runnerVolumeMountPath,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "certs-client",
|
Name: "certs-client",
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ type RunnerReplicaSetReconciler struct {
|
|||||||
|
|
||||||
func (r *RunnerReplicaSetReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
func (r *RunnerReplicaSetReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
log := r.Log.WithValues("runner", req.NamespacedName)
|
log := r.Log.WithValues("runnerreplicaset", req.NamespacedName)
|
||||||
|
|
||||||
var rs v1alpha1.RunnerReplicaSet
|
var rs v1alpha1.RunnerReplicaSet
|
||||||
if err := r.Get(ctx, req.NamespacedName, &rs); err != nil {
|
if err := r.Get(ctx, req.NamespacedName, &rs); err != nil {
|
||||||
|
|||||||
1089
index.yaml
Normal file
1089
index.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,8 @@ ARG TARGETPLATFORM
|
|||||||
ARG RUNNER_VERSION=2.274.2
|
ARG RUNNER_VERSION=2.274.2
|
||||||
ARG DOCKER_VERSION=19.03.12
|
ARG DOCKER_VERSION=19.03.12
|
||||||
|
|
||||||
|
RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt update -y \
|
RUN apt update -y \
|
||||||
&& apt install -y software-properties-common \
|
&& apt install -y software-properties-common \
|
||||||
@@ -42,7 +44,8 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
|||||||
&& chmod +x /usr/local/bin/dumb-init
|
&& chmod +x /usr/local/bin/dumb-init
|
||||||
|
|
||||||
# Docker download supports arm64 as aarch64 & amd64 as x86_64
|
# Docker download supports arm64 as aarch64 & amd64 as x86_64
|
||||||
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
RUN set -vx; \
|
||||||
|
export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
&& if [ "$ARCH" = "amd64" ]; then export ARCH=x86_64 ; fi \
|
&& if [ "$ARCH" = "amd64" ]; then export ARCH=x86_64 ; fi \
|
||||||
&& curl -L -o docker.tgz https://download.docker.com/linux/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz \
|
&& curl -L -o docker.tgz https://download.docker.com/linux/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz \
|
||||||
@@ -55,6 +58,8 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
|||||||
&& usermod -aG docker runner \
|
&& usermod -aG docker runner \
|
||||||
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers
|
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers
|
||||||
|
|
||||||
|
ENV RUNNER_ASSETS_DIR=/runnertmp
|
||||||
|
|
||||||
# Runner download supports amd64 as x64. Externalstmp is needed for making mount points work inside DinD.
|
# Runner download supports amd64 as x64. Externalstmp is needed for making mount points work inside DinD.
|
||||||
#
|
#
|
||||||
# libyaml-dev is required for ruby/setup-ruby action.
|
# libyaml-dev is required for ruby/setup-ruby action.
|
||||||
@@ -62,8 +67,8 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
|||||||
# to avoid rerunning apt-update on its own.
|
# to avoid rerunning apt-update on its own.
|
||||||
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
&& if [ "$ARCH" = "amd64" ]; then export ARCH=x64 ; fi \
|
&& if [ "$ARCH" = "amd64" ]; then export ARCH=x64 ; fi \
|
||||||
&& mkdir -p /runner \
|
&& mkdir -p "$RUNNER_ASSETS_DIR" \
|
||||||
&& cd /runner \
|
&& cd "$RUNNER_ASSETS_DIR" \
|
||||||
&& curl -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz \
|
&& curl -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz \
|
||||||
&& tar xzf ./runner.tar.gz \
|
&& tar xzf ./runner.tar.gz \
|
||||||
&& rm runner.tar.gz \
|
&& rm runner.tar.gz \
|
||||||
@@ -72,14 +77,14 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
|||||||
&& apt-get install -y libyaml-dev \
|
&& apt-get install -y libyaml-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN echo AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache > /runner.env \
|
RUN echo AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache > .env \
|
||||||
&& mkdir /opt/hostedtoolcache \
|
&& mkdir /opt/hostedtoolcache \
|
||||||
&& chgrp runner /opt/hostedtoolcache \
|
&& chgrp runner /opt/hostedtoolcache \
|
||||||
&& chmod g+rwx /opt/hostedtoolcache
|
&& chmod g+rwx /opt/hostedtoolcache
|
||||||
|
|
||||||
COPY entrypoint.sh /runner
|
COPY entrypoint.sh /
|
||||||
COPY patched /runner/patched
|
COPY patched $RUNNER_ASSETS_DIR/patched
|
||||||
|
|
||||||
USER runner
|
USER runner
|
||||||
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
|
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
|
||||||
CMD ["/runner/entrypoint.sh"]
|
CMD ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -23,15 +23,13 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
docker build --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} -t ${NAME}:${TAG} -t ${NAME}:v${RUNNER_VERSION} .
|
docker build --build-arg TARGETPLATFORM=amd64 --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} -t ${NAME}:${TAG} .
|
||||||
docker build --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} -t ${DIND_RUNNER_NAME}:${TAG} -t ${DIND_RUNNER_NAME}:v${RUNNER_VERSION} -f dindrunner.Dockerfile .
|
docker build --build-arg TARGETPLATFORM=amd64 --build-arg RUNNER_VERSION=${RUNNER_VERSION} --build-arg DOCKER_VERSION=${DOCKER_VERSION} -t ${DIND_RUNNER_NAME}:${TAG} -f dindrunner.Dockerfile .
|
||||||
|
|
||||||
|
|
||||||
docker-push:
|
docker-push:
|
||||||
docker push ${NAME}:${TAG}
|
docker push ${NAME}:${TAG}
|
||||||
docker push ${NAME}:v${RUNNER_VERSION}
|
|
||||||
docker push ${DIND_RUNNER_NAME}:${TAG}
|
docker push ${DIND_RUNNER_NAME}:${TAG}
|
||||||
docker push ${DIND_RUNNER_NAME}:v${RUNNER_VERSION}
|
|
||||||
|
|
||||||
docker-buildx:
|
docker-buildx:
|
||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ ARG DOCKER_CHANNEL=stable
|
|||||||
ARG DOCKER_VERSION=19.03.13
|
ARG DOCKER_VERSION=19.03.13
|
||||||
ARG DEBUG=false
|
ARG DEBUG=false
|
||||||
|
|
||||||
|
RUN test -n "$TARGETPLATFORM" || (echo "TARGETPLATFORM must be set" && false)
|
||||||
|
|
||||||
# Docker installation
|
# Docker installation
|
||||||
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
&& if [ "$ARCH" = "arm64" ]; then export ARCH=aarch64 ; fi \
|
||||||
@@ -66,6 +68,8 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
|||||||
dockerd --version; \
|
dockerd --version; \
|
||||||
docker --version
|
docker --version
|
||||||
|
|
||||||
|
ENV RUNNER_ASSETS_DIR=/runnertmp
|
||||||
|
|
||||||
# Runner download supports amd64 as x64
|
# Runner download supports amd64 as x64
|
||||||
#
|
#
|
||||||
# libyaml-dev is required for ruby/setup-ruby action.
|
# libyaml-dev is required for ruby/setup-ruby action.
|
||||||
@@ -73,8 +77,8 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
|||||||
# to avoid rerunning apt-update on its own.
|
# to avoid rerunning apt-update on its own.
|
||||||
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||||
&& if [ "$ARCH" = "amd64" ]; then export ARCH=x64 ; fi \
|
&& if [ "$ARCH" = "amd64" ]; then export ARCH=x64 ; fi \
|
||||||
&& mkdir -p /runner \
|
&& mkdir -p "$RUNNER_ASSETS_DIR" \
|
||||||
&& cd /runner \
|
&& cd "$RUNNER_ASSETS_DIR" \
|
||||||
&& curl -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz \
|
&& curl -L -o runner.tar.gz https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-${ARCH}-${RUNNER_VERSION}.tar.gz \
|
||||||
&& tar xzf ./runner.tar.gz \
|
&& tar xzf ./runner.tar.gz \
|
||||||
&& rm runner.tar.gz \
|
&& rm runner.tar.gz \
|
||||||
@@ -100,7 +104,7 @@ RUN export ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
|||||||
|
|
||||||
VOLUME /var/lib/docker
|
VOLUME /var/lib/docker
|
||||||
|
|
||||||
COPY patched /runner/patched
|
COPY patched $RUNNER_ASSETS_DIR/patched
|
||||||
|
|
||||||
# No group definition, as that makes it harder to run docker.
|
# No group definition, as that makes it harder to run docker.
|
||||||
USER runner
|
USER runner
|
||||||
|
|||||||
@@ -44,9 +44,18 @@ if [ -z "${RUNNER_REPO}" ] && [ -n "${RUNNER_ORG}" ] && [ -n "${RUNNER_GROUP}" ]
|
|||||||
RUNNER_GROUP_ARG="--runnergroup ${RUNNER_GROUP}"
|
RUNNER_GROUP_ARG="--runnergroup ${RUNNER_GROUP}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Hack due to https://github.com/summerwind/actions-runner-controller/issues/252#issuecomment-758338483
|
||||||
|
if [ ! -d /runner ]; then
|
||||||
|
echo "/runner should be an emptyDir mount. Please fix the pod spec." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo chown -R runner:docker /runner
|
||||||
|
mv /runnertmp/* /runner/
|
||||||
|
|
||||||
cd /runner
|
cd /runner
|
||||||
./config.sh --unattended --replace --name "${RUNNER_NAME}" --url "${GITHUB_URL}${ATTACH}" --token "${RUNNER_TOKEN}" ${RUNNER_GROUP_ARG} ${LABEL_ARG} ${WORKDIR_ARG}
|
./config.sh --unattended --replace --name "${RUNNER_NAME}" --url "${GITHUB_URL}${ATTACH}" --token "${RUNNER_TOKEN}" ${RUNNER_GROUP_ARG} ${LABEL_ARG} ${WORKDIR_ARG}
|
||||||
|
mkdir ./externals
|
||||||
# Hack due to the DinD volumes
|
# Hack due to the DinD volumes
|
||||||
mv ./externalstmp/* ./externals/
|
mv ./externalstmp/* ./externals/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user