-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare resources in the GitHub action for test scripts (#220)
--------- Co-authored-by: Jip-Hop <[email protected]>
- Loading branch information
Showing
2 changed files
with
71 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,12 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
export PYTHONUNBUFFERED=1 | ||
|
||
uname -r | ||
cat /etc/os-release | ||
python3 --version | ||
|
||
apt-get update -qq && apt-get install -qq -y systemd-container | ||
|
||
# # TODO: create zpool with virtual disks, create jailmaker dataset and test jlmkr.py from there | ||
# # https://medium.com/@abaddonsd/zfs-usage-with-virtual-disks-62898064a29b | ||
# apt-get install -y -qq zfsutils-linux | ||
# modinfo zfs | grep version | ||
# zfs --version | ||
# zpool --version | ||
|
||
# TODO: create a path and/or zfs pool with a space in it to test if jlmkr.py still works properly when ran from inside | ||
# mkdir -p "/tmp/path with space/jailmaker" | ||
|
||
chown 0:0 jlmkr.py | ||
chmod +x jlmkr.py | ||
|
||
# Setup NAT to give the jail access to the outside network | ||
# https://wiki.archlinux.org/title/systemd-nspawn#Use_a_virtual_Ethernet_link | ||
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | ||
iptables -I DOCKER-USER -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | ||
iptables -I DOCKER-USER -i ve-+ -o eth0 -j ACCEPT | ||
iptables -A INPUT -i ve-+ -p udp -m udp --dport 67 -j ACCEPT | ||
# TODO: many more test cases and checking if actual output (text, files on disk etc.) is correct instead of just a 0 exit code | ||
|
||
# TODO: test jlmkr.py from inside another working directory, with a relative path to a config file to test if it uses the config file (and doesn't look for it relative to the jlmkr.py file itself) | ||
./jlmkr.py create --start --config=./templates/docker/config test --network-veth --system-call-filter='add_key' --system-call-filter='bpf' --system-call-filter='keyctl' | ||
./jlmkr.py exec test docker run hello-world | ||
|
||
# TODO: many more test cases and checking if actual output (text, files on disk etc.) is correct instead of just a 0 exit code | ||
./jlmkr.py create --start --config=./templates/docker/config test | ||
./jlmkr.py exec test docker run hello-world |