-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5573 from mook-as/e2e/runner-linux
GitHub Linux runner infra
- Loading branch information
Showing
25 changed files
with
1,530 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This workflow builds the Linux self-hosted GitHub Runner disk image. | ||
name: 'GitHub Runner: Build Linux Image' | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: registry.opensuse.org/opensuse/leap:15 | ||
options: --privileged | ||
steps: | ||
- run: >- | ||
zypper --non-interactive install python3-kiwi kiwi-systemdeps-disk-images sudo tar | ||
- run: echo 'ALL ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/nopasswd | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
sparse-checkout: src/disk-images/github-runner-linux | ||
- run: ./build-image.sh | ||
working-directory: src/disk-images/github-runner-linux | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: github-runner-image.qcow2.zip | ||
path: src/disk-images/github-runner-linux/*.qcow2 | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This workflow builds the GitHub runner | ||
name: 'GitHub Runner: Build Monitor' | ||
|
||
on: | ||
push: | ||
paths: [ src/go/github-runner-monitor/** ] | ||
pull_request: | ||
paths: [ src/go/github-runner-monitor/** ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
# This uses external actions, lock things down to read-only. | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
sparse-checkout: src/go/github-runner-monitor | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: src/go/github-runner-monitor/go.mod | ||
cache-dependency-path: src/go/github-runner-monitor/go.sum | ||
- run: go build . | ||
working-directory: src/go/github-runner-monitor | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: github-runner-linux | ||
path: src/go/github-runner-monitor/github-runner-monitor | ||
if-no-files-found: error | ||
- uses: golangci/[email protected] | ||
# This is only safe because this workflow does not allow writing | ||
with: | ||
working-directory: src/go/github-runner-monitor | ||
only-new-issues: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.vhdx | ||
*.qcow2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# github-runner-linux | ||
|
||
This is a [kiwi-ng](https://osinside.github.io/kiwi/) definition for a VM disk | ||
image for use as a self-hosted GitHub runner. | ||
|
||
## Usage | ||
|
||
The image can be built using `./build-image.sh` from an OpenSUSE host (or a | ||
container running OpenSUSE). `sudo` access will be required to delete the | ||
temporary directory, as well as to copy the output image around. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright © 2023 SUSE LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit -o nounset | ||
|
||
cleanup() { | ||
if [[ -n "${WORKDIR:-}" && -d "${WORKDIR}" ]]; then | ||
sudo rm -rf "${WORKDIR}" | ||
fi | ||
} | ||
trap cleanup EXIT | ||
|
||
WORKDIR="$(mktemp --tmpdir --directory kiwi.github-runner-linux.XXXXXX)" | ||
IMAGE_NAME="${1:-}" | ||
|
||
if [[ "${#@}" -gt 0 ]]; then | ||
shift | ||
fi | ||
|
||
global_options=() | ||
local_options=() | ||
|
||
while [[ "${#@}" -gt 0 ]]; do | ||
case "$1" in | ||
--color-output) global_options+=("$1");; | ||
--config=*) global_options+=("$1");; | ||
--config) global_options+=("$1" "$2"); shift;; | ||
--logfile=*) global_options+=("$1");; | ||
--logfile) global_options+=("$1" "$2"); shift;; | ||
--debug) global_options+=("$1");; | ||
--debug-run-scripts-in-screen) global_options+=("$1");; | ||
--version|-v) global_options+=("$1");; | ||
--profile=*) global_options+=("$1");; | ||
--profile) global_options+=("$1" "$2"); shift;; | ||
--shared-cache-dir=*) global_options+=("$1");; | ||
--shared-cache-dir) global_options+=("$1" "$2"); shift;; | ||
--temp-dir=*) global_options+=("$1");; | ||
--temp-dir) global_options+=("$1" "$2"); shift;; | ||
*) local_options+=("$1");; | ||
esac | ||
shift | ||
done | ||
|
||
sudo kiwi "${global_options[@]}" system build \ | ||
--description "${PWD}" \ | ||
--target-dir "${WORKDIR}" \ | ||
"${local_options[@]}" | ||
|
||
shopt -s nullglob # One of the two below will be missing | ||
cp "${WORKDIR}"/github-runner-linux.x86_64-*.qcow2 \ | ||
"${WORKDIR}"/github-runner-linux.x86_64-*.vhdx \ | ||
"${IMAGE_NAME:-./}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<image schemaversion="7.4" name="github-runner-linux"> | ||
<description type="system"> | ||
<author>Mook-as</author> | ||
<contact>[email protected]</contact> | ||
<specification>GitHub runner (Linux) for Rancher Desktop</specification> | ||
</description> | ||
<profiles> | ||
<profile name="qcow2" description="qcow2 image for qemu" import="true"/> | ||
<profile name="vhdx" description="vhdx image for Hyper-V"/> | ||
</profiles> | ||
<preferences> | ||
<version>1.0.0</version> | ||
<packagemanager>zypper</packagemanager> | ||
<locale>en_US</locale> | ||
<keytable>us</keytable> | ||
<timezone>UTC</timezone> | ||
<rpm-excludedocs>true</rpm-excludedocs> | ||
</preferences> | ||
<preferences profiles="qcow2"> | ||
<type image="oem" filesystem="xfs" firmware="uefi" format="qcow2"> | ||
<size unit="G">1024</size> | ||
<oemconfig> | ||
<oem-unattended>true</oem-unattended> | ||
</oemconfig> | ||
</type> | ||
</preferences> | ||
<preferences profiles="vhdx"> | ||
<type image="oem" filesystem="xfs" firmware="uefi" format="vhdx"> | ||
<size unit="G">1024</size> | ||
<oemconfig> | ||
<oem-unattended>true</oem-unattended> | ||
</oemconfig> | ||
</type> | ||
</preferences> | ||
<repository type="rpm-md" imageinclude="true"> | ||
<source path="obs://openSUSE:Leap:15.5/standard"/> | ||
</repository> | ||
<packages type="image"> | ||
<!-- base image --> | ||
<package name="dracut"/> | ||
<package name="dracut-kiwi-oem-repart"/> | ||
<package name="kernel-default"/> | ||
<package name="openSUSE-build-key"/> | ||
<package name="patterns-base-bootloader"/> | ||
<!-- GitHub runner dependencies --> | ||
<package name="lttng-ust"/> | ||
<package name="libopenssl1_1"/> | ||
<package name="krb5"/> | ||
<package name="zlib"/> | ||
<package name="libicu < 65"/> | ||
<package name="sudo"/> | ||
<package name="git"/> | ||
<!-- Depdencies for building Rancher Desktop --> | ||
<package name="jq"/> | ||
<package name="nodejs-devel"/> | ||
<namedCollection name="devel_basis"/> | ||
<namedCollection name="devel_C_C++"/> | ||
<!-- Dependencies for running Rancher Desktop --> | ||
<package name="openssh-clients"/> <!-- for lima --> | ||
<package name="xvfb-run"/> <!-- run things under x11 --> | ||
<package name="chromium"/> <!-- things we need to run Electron --> | ||
<package name="libgtk-3-0"/> <!-- also for Electron --> | ||
<package name="noto-sans-fonts"/> <!-- need any font --> | ||
</packages> | ||
<packages type="bootstrap"> | ||
<package name="glibc-locale"/> | ||
<package name="openSUSE-release"/> | ||
</packages> | ||
<users> | ||
<user pwdformat="plain" password="suse" home="/root" name="root" groups="root"/> | ||
<user pwdformat="plain" password="suse" name="runner" groups="runner,docker,kvm"/> | ||
</users> | ||
</image> |
Oops, something went wrong.