-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated from https://github.com/vmactions/base-vm
- Loading branch information
Showing
5 changed files
with
55 additions
and
42 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 |
---|---|---|
|
@@ -5,19 +5,25 @@ on: | |
|
||
jobs: | ||
build: | ||
runs-on: macos-12 | ||
runs-on: ubuntu-22.04 | ||
env: | ||
DEBUG: 1 | ||
NGROK_TOKEN : ${{ secrets.NGROK_TOKEN }} | ||
VM_RELEASE: ${{ secrets.VM_RELEASE }} | ||
SEC_VBOX : ${{ secrets.SEC_VBOX }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run establish a ngrok tunnel | ||
- uses: vmactions/cf-tunnel@v0 | ||
id: tunnel | ||
with: | ||
protocol: http | ||
port: 8000 | ||
- name: Run vnc tunnel | ||
id: test | ||
uses: vmactions/[email protected] | ||
with: | ||
protocol: tcp | ||
port: 3390 | ||
port: 5900 | ||
- name: Sleep | ||
run: | | ||
for i in $(seq 1 10) ; do echo $i; sleep 1; done | ||
|
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 |
---|---|---|
|
@@ -73,51 +73,56 @@ osname="$VM_OS_NAME" | |
ostype="$VM_OS_TYPE" | ||
sshport=$VM_SSH_PORT | ||
|
||
ovafile="$osname-$VM_RELEASE.ova" | ||
|
||
ovafile="$osname-$VM_RELEASE.qcow2.xz" | ||
|
||
_idfile='~/.ssh/host.id_rsa' | ||
|
||
importVM() { | ||
_idfile='~/.ssh/mac.id_rsa' | ||
|
||
bash $vmsh addSSHHost $osname $sshport "$_idfile" | ||
|
||
bash $vmsh setup | ||
|
||
if [ ! -e "$ovafile" ]; then | ||
echo "Downloading $OVA_LINK" | ||
wget -O "$ovafile" -q "$OVA_LINK" | ||
axel -n 8 -o "$ovafile" -q "$OVA_LINK" | ||
echo "Download finished, extract" | ||
xz -d $ovafile | ||
echo "Extract finished" | ||
fi | ||
|
||
if [ ! -e "id_rsa.pub" ]; then | ||
echo "Downloading $VM_PUBID_LINK" | ||
wget -O "id_rsa.pub" -q "$VM_PUBID_LINK" | ||
fi | ||
|
||
if [ ! -e "mac.id_rsa" ]; then | ||
echo "Downloading $VM_PUBID_LINK" | ||
wget -O "mac.id_rsa" -q "$HOST_ID_LINK" | ||
if [ ! -e "host.id_rsa" ]; then | ||
echo "Downloading $HOST_ID_LINK" | ||
wget -O "host.id_rsa" -q "$HOST_ID_LINK" | ||
fi | ||
|
||
ls -lah | ||
|
||
bash $vmsh addSSHAuthorizedKeys id_rsa.pub | ||
cat mac.id_rsa >$HOME/.ssh/mac.id_rsa | ||
chmod 600 $HOME/.ssh/mac.id_rsa | ||
cat host.id_rsa >$HOME/.ssh/host.id_rsa | ||
chmod 600 $HOME/.ssh/host.id_rsa | ||
|
||
bash $vmsh importVM "$ovafile" | ||
bash $vmsh importVM $osname $ostype "$osname-$VM_RELEASE.qcow2" | ||
|
||
if [ "$DEBUG" ]; then | ||
bash $vmsh startWeb $osname | ||
bash $vmsh startCF | ||
fi | ||
|
||
} | ||
|
||
|
||
|
||
waitForLoginTag() { | ||
bash $vmsh waitForText "$osname" "$VM_LOGIN_TAG" | ||
if [ -e "hooks/waitForLoginTag.sh" ]; then | ||
echo "Run hooks/waitForLoginTag.sh" | ||
. hooks/waitForLoginTag.sh | ||
else | ||
bash $vmsh waitForText "$osname" "$VM_LOGIN_TAG" | ||
fi | ||
|
||
} | ||
|
||
|
||
|
@@ -153,15 +158,15 @@ startVM() { | |
rsyncToVM() { | ||
_pwd="$PWD" | ||
cd "$_oldPWD" | ||
rsync -avrtopg -e 'ssh -o [email protected]' --exclude _actions --exclude _PipelineMapping --exclude _temp /Users/runner/work/ $osname:work | ||
rsync -avrtopg -e 'ssh -o [email protected]' --exclude _actions --exclude _PipelineMapping --exclude _temp $HOME/work/ $osname:work | ||
cd "$_pwd" | ||
} | ||
|
||
|
||
rsyncBackFromVM() { | ||
_pwd="$PWD" | ||
cd "$_oldPWD" | ||
rsync -vrtopg -e 'ssh -o [email protected]' $osname:work/ /Users/runner/work | ||
rsync -vrtopg -e 'ssh -o [email protected]' $osname:work/ $HOME/work | ||
cd "$_pwd" | ||
} | ||
|
||
|
@@ -176,20 +181,11 @@ EOF | |
} | ||
|
||
runSSHFSInVM() { | ||
# remove these when using the vbox v0.0.2 and newer | ||
echo "Reloading sshd services in the Host" | ||
sudo sh <<EOF | ||
echo "" >>/etc/ssh/sshd_config | ||
echo "StrictModes no" >>/etc/ssh/sshd_config | ||
EOF | ||
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist | ||
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist | ||
|
||
|
||
if [ -e "hooks/onRunSSHFS.sh" ] && ssh "$osname" sh <hooks/onRunSSHFS.sh; then | ||
echo "OK"; | ||
elif [ "$VM_SSHFS_PKG" ]; then | ||
echo "Insalling $VM_SSHFS_PKG" | ||
echo "Installing $VM_SSHFS_PKG" | ||
ssh "$osname" sh <<EOF | ||
$VM_INSTALL_CMD $VM_SSHFS_PKG | ||
|
@@ -198,7 +194,7 @@ EOF | |
echo "Run sshfs" | ||
ssh "$osname" sh <<EOF | ||
sshfs -o reconnect,ServerAliveCountMax=2,allow_other,default_permissions host:work /Users/runner/work | ||
sshfs -o reconnect,ServerAliveCountMax=2,allow_other,default_permissions host:work $HOME/work | ||
EOF | ||
|
||
|
@@ -210,6 +206,7 @@ EOF | |
|
||
#run in the vm, just as soon as the vm is up | ||
onStarted() { | ||
bash $vmsh addSSHHost $osname "$_idfile" | ||
if [ -e "hooks/onStarted.sh" ]; then | ||
ssh "$osname" sh <hooks/onStarted.sh | ||
fi | ||
|
@@ -248,7 +245,7 @@ waitForBooting() { | |
showDebugInfo() { | ||
echo "==================Debug Info====================" | ||
pwd && ls -lah | ||
bash -c 'pwd && ls -lah ~/.ssh/ && cat ~/.ssh/config' | ||
bash -c 'pwd && ls -lah ~/.ssh/ && [ -e "~/.ssh/config" ] && cat ~/.ssh/config' | ||
cat $_conf_filename | ||
|
||
echo "===================Debug Info in VM=============" | ||
|