Verified Commit 312d9334 authored by David Runge's avatar David Runge
Browse files

Order pacman-init and reflector-init before cloud-final

http/install-common.sh:
Order pacman-init.service and reflector-init.service before
cloud-final.service, as the latter may install packages using pacman and
will introduce a broken pacman keyring if started simultaneously with
pacman-init.service.
The mirrorlist should be set before cloud-final.service is running, so
that pacman can use it.

.gitlab-ci.yml:
When testing the cloud image using cloud-init:
* Use the `packages` and `runcmd` directives to install packages using
  cloud-init (which is done during `cloud-final.service`).
* Check for packages installed via cloud-init.
* Write a test file to disk and check for its existence.

Fixes #121
parent 03a72dca
......@@ -86,6 +86,13 @@ test-cloudimg-qemu:
password: '${SSHPASS}'
chpasswd: { expire: False }
ssh_pwauth: True
packages:
- tmux
- tree
runcmd:
- [ echo, 'Install more packages using runcmd.' ]
- [ pacman, --noconfirm, -Syu, bat ]
- [ touch, /runcmd_successful ]
EOF
- |
cat > meta-data <<EOF
......@@ -96,6 +103,8 @@ test-cloudimg-qemu:
- genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
- qemu-system-x86_64 -m 512 -net nic -net user,hostfwd=tcp::2222-:22 -drive file=$(ls output/Arch-Linux-x86_64-cloudimg-*.qcow2),if=virtio -drive file=seed.iso,if=virtio -nographic &
- timeout 15m sh -c "while ! sshpass -e ssh -o ConnectTimeout=2 -o StrictHostKeyChecking=no arch@localhost -p 2222 true; do sleep 1; done"
- timeout 15m sh -c "while ! sshpass -e ssh -o ConnectTimeout=2 -o StrictHostKeyChecking=no arch@localhost -p 2222 pacman -Q bat tmux tree; do sleep 1; done"
- timeout 15m sh -c "while ! sshpass -e ssh -o ConnectTimeout=2 -o StrictHostKeyChecking=no arch@localhost -p 2222 test -f /runcmd_successful ; do sleep 1; done"
tag_release:
stage: publish
......
......@@ -9,7 +9,7 @@ cat <<EOF >/etc/systemd/system/pacman-init.service
Description=Initializes Pacman keyring
Wants=haveged.service
After=haveged.service
Before=sshd.service
Before=sshd.service cloud-final.service
ConditionFirstBoot=yes
[Service]
......@@ -28,7 +28,7 @@ cat <<EOF >/etc/systemd/system/reflector-init.service
Description=Initializes mirrors for the VM
After=network-online.target
Wants=network-online.target
Before=sshd.service
Before=sshd.service cloud-final.service
ConditionFirstBoot=yes
[Service]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment