1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 10:57:55 +01:00

just wait for ssh to be open

This commit is contained in:
Jason N. 2024-03-14 10:52:21 -04:00
parent 545b79d69a
commit d0abe79886
2 changed files with 28 additions and 20 deletions

View file

@ -161,10 +161,11 @@ jobs:
with: with:
submodules: recursive submodules: recursive
- name: Ensure qemu is installed - name: Install test tools
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y qemu qemu-utils xorriso unzip qemu-system-x86 netcat socat jq isomd5sum ansible make coreutils sudo apt-get install -y make
make install-test-deps
- name: Create disk - name: Create disk
run: | run: |
@ -253,7 +254,7 @@ jobs:
timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done" timeout 1m bash -c "while ! (echo > /dev/tcp/127.0.0.1/4321); do sleep 0.1; done"
(tail -f vm.stdin | nc localhost 4321 | tee vm.stdout) & (tail -f vm.stdin | nc localhost 4321 | tee vm.stdout) &
timeout 30m bash -c "while ! (grep 'login:' vm.stdout); do sleep 1; done" timeout 30m bash -c "while ! (echo > /dev/tcp/${VM_IP}/${VM_PORT}); do sleep 1; done"
if ! (echo > /dev/tcp/${VM_IP}/${VM_PORT}) if ! (echo > /dev/tcp/${VM_IP}/${VM_PORT})
then then
@ -261,17 +262,6 @@ jobs:
fi fi
echo "VM ready for tests at IP ${VM_IP}:${VM_PORT}" echo "VM ready for tests at IP ${VM_IP}:${VM_PORT}"
echo "Creating Ansible inventory"
cat << EOF > ansible_inventory
ungrouped:
hosts:
vm:
ansible_host: ${VM_IP}
ansible_port: ${VM_PORT}
ansible_user: ${VM_USER}
ansible_password: ${VM_PASS}
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
EOF
#make test-vm make test-vm VM_IP=${VM_IP} VM_PORT=${VM_PORT} VM_USER=${VM_USER} VM_PASS=${VM_PASS}
kill $QEMU_PID kill $QEMU_PID

View file

@ -23,6 +23,8 @@ SECURE_BOOT_KEY_URL =
# Cache # Cache
DNF_CACHE = DNF_CACHE =
PACKAGE_MANAGER = dnf
# Functions # Functions
## Formatting = lowercase ## Formatting = lowercase
# Get a list of templates for the feature # Get a list of templates for the feature
@ -205,7 +207,13 @@ clean:
rm -f $(_BASE_DIR)/*.log || true rm -f $(_BASE_DIR)/*.log || true
install-deps: install-deps:
dnf install -y lorax xorriso skopeo flatpak dbus-daemon ostree coreutils gettext git if [[ "$(PACKAGE_MANAGER)" =~ apt.* ]]; then $(PACKAGE_MANAGER) update; fi
$(PACKAGE_MANAGER) install -y lorax xorriso skopeo flatpak dbus-daemon ostree coreutils gettext git
install-test-deps:
if [[ "$(PACKAGE_MANAGER)" =~ apt.* ]]; then $(PACKAGE_MANAGER) update; fi
$(PACKAGE_MANAGER) install -y qemu qemu-utils xorriso unzip qemu-system-x86 netcat socat jq isomd5sum ansible make coreutils squashfs-tools
test: test-iso test-vm test: test-iso test-vm
@ -213,8 +221,6 @@ test-iso:
$(eval _TESTS = $(filter-out README.md,$(shell ls tests/iso))) $(eval _TESTS = $(filter-out README.md,$(shell ls tests/iso)))
$(eval _VARS = VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL) $(eval _VARS = VERSION FLATPAK_REMOTE_NAME _FLATPAK_REPO_URL)
sudo apt-get update
sudo apt-get install -y squashfs-tools
sudo modprobe loop sudo modprobe loop
sudo mkdir /mnt/iso /mnt/install sudo mkdir /mnt/iso /mnt/install
sudo mount -o loop deploy.iso /mnt/iso sudo mount -o loop deploy.iso /mnt/iso
@ -241,9 +247,21 @@ test-iso:
sudo umount /mnt/install sudo umount /mnt/install
sudo umount /mnt/iso sudo umount /mnt/iso
test-vm: ansible_inventory:
cat << EOF > ansible_inventory
ungrouped:
hosts:
vm:
ansible_host: ${VM_IP}
ansible_port: ${VM_PORT}
ansible_user: ${VM_USER}
ansible_password: ${VM_PASS}
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
EOF
test-vm: ansible_inventory
$(eval _TESTS = $(filter-out README.md,$(shell ls tests/vm))) $(eval _TESTS = $(filter-out README.md,$(shell ls tests/vm)))
chmod +x $(foreach test,$(_TESTS),tests/vm/$(test)) chmod +x $(foreach test,$(_TESTS),tests/vm/$(test))
for test in $(_TESTS); do ./tests/vm/$${test} deploy.iso; done for test in $(_TESTS); do ./tests/vm/$${test} deploy.iso; done
.PHONY: clean install-deps test test-iso test-vm .PHONY: clean install-deps install-test-deps test test-iso test-vm