Skip to content

Commit

Permalink
test runh on ubuntu-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Feb 20, 2025
1 parent d9bc5ff commit 5ddd4af
Showing 1 changed file with 72 additions and 32 deletions.
104 changes: 72 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
components: rustfmt
- run: cargo fmt -- --check

test:
name: Setup, build and test
runs-on: ubuntu-22.04
crio:
name: Setup, build and test (CRI-O)
runs-on: ubuntu-latest
env:
KUBERNETES_VERSION: v1.31
CRIO_VERSION: v1.31
KUBERNETES_VERSION: v1.32
CRIO_VERSION: v1.32
steps:
- name: Install CRI-O
run: |
Expand All @@ -46,7 +46,7 @@ jobs:
sudo apt-get remove conmon
sudo apt-get update
sudo apt-get install -y cri-o docker
sudo apt-get install -y cri-o
sudo systemctl start crio.service
- name: Install crictl
Expand All @@ -59,13 +59,7 @@ jobs:
sudo crictl version
- name: Pull images
run: |
docker pull ghcr.io/hermit-os/rusty_demo:latest
sudo crictl pull ghcr.io/hermit-os/rusty_demo:latest
- name: Setup rootfs
run: |
docker export $(docker create ghcr.io/hermit-os/rusty_demo:latest) > runh-image.tar
mkdir -p /home/runner/runh-image/rootfs
tar -xf runh-image.tar -C /home/runner/runh-image/rootfs
- name: Create CRI configurations
run: |
echo '{ "metadata": { "name": "hermit-sandbox", "namespace": "default", "attempt": 1, "uid": "hdishd83djaidwnduwk28bcsb" }, "log_directory": "/tmp", "linux": { } }' \
Expand All @@ -83,14 +77,6 @@ jobs:
sudo cp /home/runner/.cargo/bin/runh /usr/sbin/runh
sudo chown root:root /usr/sbin/runh
sudo chmod a+rx /usr/sbin/runh
- name: Setup runh with Docker
shell: sudo bash --noprofile --norc -eo pipefail {0}
run: |
sed -i 's/{/{ "default-runtime": "runc", "runtimes": { "runh": { "path": "\/home\/runner\/.cargo\/bin\/runh", "runtimeArgs": ["-l", "debug"] } },/g' /etc/docker/daemon.json
>&2 cat /etc/docker/daemon.json
systemctl restart docker || systemctl status docker
- name: Check Docker runtime
run: docker info|grep -i runtime
- name: Set up runh with CRI-O
id: runh-crio-setup
shell: sudo bash --noprofile --norc -eo pipefail {0}
Expand All @@ -104,17 +90,6 @@ jobs:
privileged_without_host_devices = false
EOF
systemctl restart crio || systemctl status crio
- name: Test runh standalone
shell: sudo bash --noprofile --norc -eo pipefail {0}
if: ${{ always() && steps.runh-crio-setup.outcome == 'success' }}
run: |
cd /home/runner/runh-image
tree .
runh --root /run/runh spec --bundle . --args /hermit/rusty_demo
runh --root /run/runh -l debug create --bundle . runh-container
runh --root /run/runh -l debug start runh-container
sleep 10
runh --root /run/runh -l debug delete runh-container
- name: Test runh with CRIO
if: ${{ always() && steps.runh-crio-setup.outcome == 'success' }}
shell: sudo bash --noprofile --norc -eo pipefail {0}
Expand All @@ -132,9 +107,74 @@ jobs:
crictl rm $CONTAINERID
crictl stopp $PODID
crictl rmp $PODID
docker:
name: Setup, build and test (Docker)
runs-on: ubuntu-latest
env:
KUBERNETES_VERSION: v1.32
CRIO_VERSION: v1.32
steps:
- name: Install Docker
run: |
sudo apt-get remove conmon containerd.io
sudo apt-get update
sudo apt-get install -y docker.io runc
sudo systemctl start docker
- name: Pull images
run: |
docker pull ghcr.io/hermit-os/rusty_demo:latest
- name: Setup rootfs
run: |
docker export $(docker create ghcr.io/hermit-os/rusty_demo:latest) > runh-image.tar
mkdir -p /home/runner/runh-image/rootfs
tar -xf runh-image.tar -C /home/runner/runh-image/rootfs
- uses: actions/checkout@v4
with:
lfs: true
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build runh
run: |
cargo install --locked --path .
sudo cp /home/runner/.cargo/bin/runh /usr/sbin/runh
sudo chown root:root /usr/sbin/runh
sudo chmod a+rx /usr/sbin/runh
- name: Setup runh with Docker
shell: sudo bash --noprofile --norc -eo pipefail {0}
run: |
cat << END > /etc/docker/daemon.json
{
"default-runtime": "runc",
"runtimes": {
"runh": {
"path": "/home/runner/.cargo/bin/runh",
"runtimeArgs": [
"-l", "debug"
]
}
}
}
END
- name: Restart docker
shell: sudo bash --noprofile --norc -eo pipefail {0}
run: |
systemctl restart docker || systemctl status docker
- name: Check Docker runtime
run: |
docker info|grep -i runtime
- name: Test runh standalone
shell: sudo bash --noprofile --norc -eo pipefail {0}
run: |
cd /home/runner/runh-image
tree .
runh --root /run/runh spec --bundle . --args /hermit/rusty_demo
runh --root /run/runh -l debug create --bundle . runh-container
runh --root /run/runh -l debug start runh-container
sleep 10
runh --root /run/runh -l debug delete runh-container
- name: Test runh with Docker
shell: sudo bash --noprofile --norc -eo pipefail {0}
if: ${{ always() && steps.runh-crio-setup.outcome == 'success' }}
run: |
docker run --runtime=runh -it -d -p 9975:9975 ghcr.io/hermit-os/rusty_demo:latest > container.id
export CONTAINERID=$(cat container.id)
Expand Down

0 comments on commit 5ddd4af

Please sign in to comment.