Skip to content

Commit 1b87a30

Browse files
committed
Add support for 24.04
1 parent 14f4d44 commit 1b87a30

10 files changed

Lines changed: 217 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
github-runner-version:
7-
description: 'Version on github runner(in https://github.com/actions/runner), e.g: 2.309.0'
7+
description: 'Version on github runner(in https://github.com/actions/runner), e.g: 2.322.0'
88
required: true
9-
default: '2.309.0'
9+
default: '2.322.0'
1010

1111
jobs:
1212
build-images:
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: true
1616
matrix:
1717
platform: [amd64, arm64]
18-
code_name: [focal, jammy]
18+
code_name: [focal, jammy, noble]
1919

2020
steps:
2121
- uses: actions/checkout@v4
@@ -98,11 +98,14 @@ jobs:
9898
docker manifest push ghcr.io/${{ github.repository }}:focal-${{ github.event.inputs.github-runner-version }}
9999
docker manifest create ghcr.io/${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }} --amend ghcr.io/${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }}-amd64 --amend ghcr.io/${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }}-arm64
100100
docker manifest push ghcr.io/${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }}
101+
docker manifest create ghcr.io/${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }} --amend ghcr.io/${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }}-amd64 --amend ghcr.io/${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }}-arm64
102+
docker manifest push ghcr.io/${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }}
101103
102104
./regctl-linux-amd64 image copy ghcr.io/${{ github.repository }}:focal-${{ github.event.inputs.github-runner-version }} ${{ github.repository }}:focal-${{ github.event.inputs.github-runner-version }} -v info
103105
./regctl-linux-amd64 image copy ghcr.io/${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }} ${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }} -v info
106+
./regctl-linux-amd64 image copy ghcr.io/${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }} ${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }} -v info
104107
105108
- name: Update image latest tag
106109
run: |
107-
./regctl-linux-amd64 image copy ghcr.io/${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }} ${{ github.repository }}:latest -v info
108-
./regctl-linux-amd64 image copy ghcr.io/${{ github.repository }}:jammy-${{ github.event.inputs.github-runner-version }} ghcr.io/${{ github.repository }}:latest -v info
110+
./regctl-linux-amd64 image copy ghcr.io/${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }} ${{ github.repository }}:latest -v info
111+
./regctl-linux-amd64 image copy ghcr.io/${{ github.repository }}:noble-${{ github.event.inputs.github-runner-version }} ghcr.io/${{ github.repository }}:latest -v info

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ This repo provides the following images, both are Multi-Arch(amd64/arm64 support
1010
- `ghcr.io/knatnetwork/github-runner:focal-<tag>`
1111
- `knatnetwork/github-runner:jammy-<tag>`
1212
- `ghcr.io/knatnetwork/github-runner:jammy-<tag>`
13+
- `knatnetwork/github-runner:noble-<tag>`
14+
- `ghcr.io/knatnetwork/github-runner:noble-<tag>`
1315

14-
`<tag>` is related to the https://github.com/actions/runner/tags, for example, you may expect a image called `knatnetwork/github-runner:jammy-2.309.0` when `v2.309.0` is released.
16+
17+
`<tag>` is related to the https://github.com/actions/runner/tags, for example, you may expect a image called `knatnetwork/github-runner:jammy-2.322.0` when `v2.322.0` is released.
1518

1619
## Specs
1720

1821
- `github-runner:focal-<tag>` images are based on Ubuntu 20.04
1922
- `github-runner:jammy-<tag>` images are based on Ubuntu 22.04
20-
- `github-runner:latest` images are latest image of `github-runner:jammy-<tag>`
23+
- `github-runner:noble-<tag>` images are based on Ubuntu 24.04
24+
- `github-runner:latest` images are latest image of `github-runner:noble-<tag>`
2125

2226
## Usage
2327

@@ -67,7 +71,7 @@ Notes:
6771

6872
- If you want to run runner without docker support inside it, just delete the `volumes`
6973
- If you don't want ephemeral runner(ref: [GitHub Actions: Ephemeral self-hosted runners & new webhooks for auto-scaling](https://github.blog/changelog/2021-09-20-github-actions-ephemeral-self-hosted-runners-new-webhooks-for-auto-scaling/), just remove `ADDITIONAL_FLAGS: '--ephemeral'` line.)
70-
- If you want to register runner to a repo only, you can just change value of `RUNNER_REGISTER_TO` to `<org_name>/<repo_name>`
74+
- If you want to register runner to a repo only, you can just change value of `RUNNER_REGISTER_TO` to `<org_name>/<repo_name>`, and use `PAT_<org_name>` as `environment` in `kms` container.
7175

7276
## Further Reading
7377

jammy-amd64/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ ENV ADDITIONAL_FLAGS ""
2222
ENV GOPROXY ""
2323

2424
RUN apt-get update \
25-
&& apt-get install -y curl sudo jq iputils-ping zip libssl-dev libcurl4-gnutls-dev zlib1g-dev gettext make build-essential python3-pip wget cmake clang perl psmisc software-properties-common git \
25+
&& apt-get install -y curl sudo jq iputils-ping zip libssl-dev libcurl4-gnutls-dev zlib1g-dev gettext make build-essential python3-pip wget cmake clang perl psmisc software-properties-common git
26+
27+
# Install Docker binary
28+
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh \
2629
&& apt-get clean \
2730
&& rm -rf /var/lib/apt/lists/*
2831

jammy-arm64/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ ENV ADDITIONAL_FLAGS ""
2222
ENV GOPROXY ""
2323

2424
RUN apt-get update \
25-
&& apt-get install -y git curl sudo jq iputils-ping zip gcc libssl-dev libcurl4-gnutls-dev zlib1g-dev make gettext wget docker-compose cmake clang perl psmisc software-properties-common \
25+
&& apt-get install -y curl sudo jq iputils-ping zip libssl-dev libcurl4-gnutls-dev zlib1g-dev gettext make build-essential python3-pip wget cmake clang perl psmisc software-properties-common
26+
27+
# Install Docker binary
28+
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh \
2629
&& apt-get clean \
2730
&& rm -rf /var/lib/apt/lists/*
2831

noble-amd64/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM ubuntu:24.04 as env
2+
3+
ARG GITHUB_RUNNER_VERSION=2.322.0
4+
ARG DEBIAN_FRONTEND=noninteractive
5+
6+
WORKDIR /root
7+
RUN apt-get update && apt install wget -y
8+
RUN wget https://github.com/actions/runner/releases/download/v${GITHUB_RUNNER_VERSION}/actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz \
9+
&& tar xzf ./actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz && rm -f actions-runner-linux-x64-${GITHUB_RUNNER_VERSION}.tar.gz \
10+
&& sed -i '3,9d' ./config.sh \
11+
&& sed -i '3,8d' ./run.sh
12+
13+
FROM ubuntu:24.04 as runner
14+
15+
ARG DEBIAN_FRONTEND=noninteractive
16+
ENV KMS_SERVER_ADDR ""
17+
ENV RUNNER_REGISTER_TO ""
18+
ENV RUNNER_WORKDIR "_work"
19+
ENV RUNNER_LABELS ""
20+
ENV ADDITIONAL_PACKAGES ""
21+
ENV ADDITIONAL_FLAGS ""
22+
ENV GOPROXY ""
23+
24+
RUN apt-get update \
25+
&& apt-get install -y curl sudo jq iputils-ping zip libssl-dev libcurl4-gnutls-dev zlib1g-dev gettext make build-essential python3-pip wget cmake clang perl psmisc software-properties-common git
26+
27+
# Install Docker binary
28+
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh \
29+
&& apt-get clean \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
USER root
33+
WORKDIR /root/
34+
35+
COPY --from=env /root/ /root/
36+
RUN /root/bin/installdependencies.sh
37+
38+
COPY entrypoint.sh runsvc.sh ./
39+
RUN sudo chmod u+x ./entrypoint.sh ./runsvc.sh
40+
41+
ENTRYPOINT ["./entrypoint.sh"]

noble-amd64/entrypoint.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
if [ -n "${ADDITIONAL_PACKAGES}" ]; then
4+
TO_BE_INSTALLED=$(echo ${ADDITIONAL_PACKAGES} | tr "," " " )
5+
echo "Installing additional packages: ${TO_BE_INSTALLED}"
6+
sudo apt-get update && sudo apt-get install -y ${TO_BE_INSTALLED} && sudo apt-get clean
7+
fi
8+
9+
if [ -z "${RUNNER_NAME}" ]; then
10+
RUNNER_NAME=$(hostname)
11+
fi
12+
13+
if [[ "${RUNNER_REGISTER_TO}" == *\/* ]]; then
14+
# Contain "/", to Repo
15+
./config.sh --unattended --url https://github.com/${RUNNER_REGISTER_TO} --token $(curl ${KMS_SERVER_ADDR}/repo/${RUNNER_REGISTER_TO}/registration-token) ${ADDITIONAL_FLAGS} --labels "${RUNNER_LABELS}" --disableupdate
16+
else
17+
# Not contain "/", to Org
18+
./config.sh --unattended --url https://github.com/${RUNNER_REGISTER_TO} --token $(curl ${KMS_SERVER_ADDR}/${RUNNER_REGISTER_TO}/registration-token) ${ADDITIONAL_FLAGS} --labels "${RUNNER_LABELS}" --disableupdate
19+
fi
20+
21+
remove() {
22+
if [[ "${RUNNER_REGISTER_TO}" == *\/* ]]; then
23+
# Contain "/", to Repo
24+
./config.sh remove --token $(curl ${KMS_SERVER_ADDR}/repo/${RUNNER_REGISTER_TO}/remove-token)
25+
else
26+
# Not contain "/", to Org
27+
./config.sh remove --token $(curl ${KMS_SERVER_ADDR}/${RUNNER_REGISTER_TO}/remove-token)
28+
fi
29+
}
30+
31+
trap 'remove; exit 130' INT
32+
trap 'remove; exit 143' TERM
33+
34+
./runsvc.sh "$*" &
35+
36+
wait $!

noble-amd64/runsvc.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# convert SIGTERM signal to SIGINT
4+
# for more info on how to propagate SIGTERM to a child process see: http://veithen.github.io/2014/11/16/sigterm-propagation.html
5+
trap 'kill -INT $PID' TERM INT
6+
7+
if [ -f ".path" ]; then
8+
# configure
9+
export PATH=`cat .path`
10+
echo ".path=${PATH}"
11+
fi
12+
13+
# insert anything to setup env when running as a service
14+
15+
# run the host process which keep the listener alive
16+
./externals/node20/bin/node ./bin/RunnerService.js &
17+
PID=$!
18+
wait $PID
19+
trap - TERM INT
20+
wait $PID

noble-arm64/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM ubuntu:24.04 as env
2+
3+
ARG GITHUB_RUNNER_VERSION=2.322.0
4+
ARG DEBIAN_FRONTEND=noninteractive
5+
6+
WORKDIR /root
7+
RUN apt-get update && apt install wget -y
8+
RUN wget https://github.com/actions/runner/releases/download/v${GITHUB_RUNNER_VERSION}/actions-runner-linux-arm64-${GITHUB_RUNNER_VERSION}.tar.gz \
9+
&& tar xzf ./actions-runner-linux-arm64-${GITHUB_RUNNER_VERSION}.tar.gz && rm -f actions-runner-linux-arm64-${GITHUB_RUNNER_VERSION}.tar.gz \
10+
&& sed -i '3,9d' ./config.sh \
11+
&& sed -i '3,8d' ./run.sh
12+
13+
FROM ubuntu:24.04 as runner
14+
15+
ARG DEBIAN_FRONTEND=noninteractive
16+
ENV KMS_SERVER_ADDR ""
17+
ENV RUNNER_REGISTER_TO ""
18+
ENV RUNNER_WORKDIR "_work"
19+
ENV RUNNER_LABELS ""
20+
ENV ADDITIONAL_PACKAGES ""
21+
ENV ADDITIONAL_FLAGS ""
22+
ENV GOPROXY ""
23+
24+
RUN apt-get update \
25+
&& apt-get install -y git curl sudo jq iputils-ping zip gcc libssl-dev libcurl4-gnutls-dev zlib1g-dev make gettext wget docker-compose cmake clang perl psmisc software-properties-common
26+
27+
# Install Docker binary
28+
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh \
29+
&& apt-get clean \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
USER root
33+
WORKDIR /root/
34+
35+
COPY --from=env /root/ /root/
36+
RUN /root/bin/installdependencies.sh
37+
38+
COPY entrypoint.sh runsvc.sh ./
39+
RUN sudo chmod u+x ./entrypoint.sh ./runsvc.sh
40+
41+
ENTRYPOINT ["./entrypoint.sh"]

noble-arm64/entrypoint.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
if [ -n "${ADDITIONAL_PACKAGES}" ]; then
4+
TO_BE_INSTALLED=$(echo ${ADDITIONAL_PACKAGES} | tr "," " " )
5+
echo "Installing additional packages: ${TO_BE_INSTALLED}"
6+
sudo apt-get update && sudo apt-get install -y ${TO_BE_INSTALLED} && sudo apt-get clean
7+
fi
8+
9+
if [ -z "${RUNNER_NAME}" ]; then
10+
RUNNER_NAME=$(hostname)
11+
fi
12+
13+
if [[ "${RUNNER_REGISTER_TO}" == *\/* ]]; then
14+
# Contain "/", to Repo
15+
./config.sh --unattended --url https://github.com/${RUNNER_REGISTER_TO} --token $(curl ${KMS_SERVER_ADDR}/repo/${RUNNER_REGISTER_TO}/registration-token) ${ADDITIONAL_FLAGS} --labels "${RUNNER_LABELS}" --disableupdate
16+
else
17+
# Not contain "/", to Org
18+
./config.sh --unattended --url https://github.com/${RUNNER_REGISTER_TO} --token $(curl ${KMS_SERVER_ADDR}/${RUNNER_REGISTER_TO}/registration-token) ${ADDITIONAL_FLAGS} --labels "${RUNNER_LABELS}" --disableupdate
19+
fi
20+
21+
remove() {
22+
if [[ "${RUNNER_REGISTER_TO}" == *\/* ]]; then
23+
# Contain "/", to Repo
24+
./config.sh remove --token $(curl ${KMS_SERVER_ADDR}/repo/${RUNNER_REGISTER_TO}/remove-token)
25+
else
26+
# Not contain "/", to Org
27+
./config.sh remove --token $(curl ${KMS_SERVER_ADDR}/${RUNNER_REGISTER_TO}/remove-token)
28+
fi
29+
}
30+
31+
trap 'remove; exit 130' INT
32+
trap 'remove; exit 143' TERM
33+
34+
./runsvc.sh "$*" &
35+
36+
wait $!

noble-arm64/runsvc.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# convert SIGTERM signal to SIGINT
4+
# for more info on how to propagate SIGTERM to a child process see: http://veithen.github.io/2014/11/16/sigterm-propagation.html
5+
trap 'kill -INT $PID' TERM INT
6+
7+
if [ -f ".path" ]; then
8+
# configure
9+
export PATH=`cat .path`
10+
echo ".path=${PATH}"
11+
fi
12+
13+
# insert anything to setup env when running as a service
14+
15+
# run the host process which keep the listener alive
16+
./externals/node20/bin/node ./bin/RunnerService.js &
17+
PID=$!
18+
wait $PID
19+
trap - TERM INT
20+
wait $PID

0 commit comments

Comments
 (0)