Skip to content

Commit

Permalink
use Libvirt
Browse files Browse the repository at this point in the history
  • Loading branch information
neil committed Nov 7, 2023
1 parent 4a6ddda commit a7da9a0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ jobs:
build:
strategy:
matrix:
os: ["8.0", "8.1", "8.2", "9.0", "9.1", "9.2", "9.3"]
runs-on: macos-12
os: ["9.3"]
runs-on: ubuntu-22.04
env:
SEC_VBOX : ${{ secrets.SEC_VBOX }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: vmactions/cf-tunnel@v0
id: tunnel
with:
protocol: http
port: 8000
- run: |
bash build.sh conf/netbsd-${{ matrix.os }}.conf
- name: Upload Release Asset
Expand All @@ -40,8 +45,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
netbsd-${{ matrix.os }}.ova
netbsd-${{ matrix.os }}.qcow2.xz
netbsd-${{ matrix.os }}-id_rsa.pub
netbsd-${{ matrix.os }}-mac.id_rsa
netbsd-${{ matrix.os }}-host.id_rsa
13 changes: 9 additions & 4 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@ on:

jobs:
build:
runs-on: macos-12
runs-on: ubuntu-22.04
env:
RELEASE: "9.0"
RELEASE: "9.3"
DEBUG: 1
VM_OS_NAME: netbsd
NGROK_TOKEN : ${{ secrets.NGROK_TOKEN }}
SEC_VBOX : ${{ secrets.SEC_VBOX }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: vmactions/cf-tunnel@v0
id: tunnel
with:
protocol: http
port: 8000
- name: Run establish a ngrok tunnel
id: test
uses: vmactions/ngrok-tunnel@v0.0.1
with:
protocol: tcp
port: 3390
port: 5900
- name: Sleep
run: |
for i in $(seq 1 10) ; do echo $i; sleep 1; done
Expand Down
29 changes: 13 additions & 16 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fi
chmod +x "$vmsh"


$vmsh addSSHHost $osname $sshport




Expand All @@ -70,20 +70,13 @@ if ! $vmsh clearVM $osname; then
echo "vm does not exists"
fi

$vmsh createVM $VM_ISO_LINK $osname $ostype $sshport



$vmsh startWeb $osname



$vmsh startCF

$vmsh createVM $VM_ISO_LINK $osname $ostype $sshport

_sleep=20
echo "Sleep $_sleep seconds, please open the link in your browser."
sleep $_sleep

$vmsh startVM $osname

Expand All @@ -97,12 +90,13 @@ $vmsh processOpts $osname "$opts"
$vmsh shutdownVM $osname


$vmsh detachISO $osname


$vmsh startVM $osname




###############################################


Expand Down Expand Up @@ -135,20 +129,23 @@ echo >>enablessh.local

$vmsh inputFile $osname enablessh.local


###############################################################

$vmsh addSSHHost $osname $sshport


ssh $osname sh <<EOF
echo 'StrictHostKeyChecking=accept-new' >.ssh/config
echo "Host host" >>.ssh/config
echo " HostName 10.0.2.2" >>.ssh/config
echo " HostName 192.168.122.1" >>.ssh/config
echo " User runner" >>.ssh/config
echo " ServerAliveInterval 1" >>.ssh/config
EOF


###############################################################


if [ -e "hooks/postBuild.sh" ]; then
ssh $osname sh<"hooks/postBuild.sh"
fi
Expand Down Expand Up @@ -176,13 +173,13 @@ $vmsh shutdownVM $osname



ova="$osname-$VM_RELEASE.ova"
ova="$osname-$VM_RELEASE.qcow2"


echo "Exporting $ova"
$vmsh exportOVA $osname "$ova"

cp ~/.ssh/id_rsa $osname-$VM_RELEASE-mac.id_rsa
cp ~/.ssh/id_rsa $osname-$VM_RELEASE-host.id_rsa


ls -lah
Expand Down
6 changes: 4 additions & 2 deletions conf/netbsd-9.3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

VM_ISO_LINK="https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/images/NetBSD-9.3-amd64.iso"
VM_OS_NAME="netbsd"
VM_OS_TYPE="NetBSD_64"
VM_OS_TYPE="netbsd9.0"
VM_SSH_PORT=2225


Expand All @@ -22,4 +22,6 @@ VM_OPTS="conf/netbsd-9.0.opts.txt"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.0.3/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.0/vbox.sh"


0 comments on commit a7da9a0

Please sign in to comment.