Verified Commit c6b1d3fb authored by Sven-Hendrik Haase's avatar Sven-Hendrik Haase
Browse files

Make builds work more consistently

parent cc6dee0a
......@@ -34,7 +34,7 @@ build:cloud-qemu:
before_script:
- pacman -Syu --needed --noconfirm packer qemu-headless
script:
- packer build -parallel-builds=1 -var 'write_zeroes=yes' -except=sign cloud.json
- packer build -var 'write_zeroes=yes' -except=sign cloud.json
artifacts:
name: "cloud-qemu"
paths:
......@@ -46,7 +46,7 @@ build:vagrant-qemu:
before_script:
- pacman -Syu --needed --noconfirm packer qemu-headless
script:
- packer build -parallel-builds=1 -var 'write_zeroes=yes' -only=qemu local.json
- packer build -var 'write_zeroes=yes' -only=qemu local.json
publish:
stage: publish
......
......@@ -9,7 +9,7 @@
"write_zeroes": "",
"boot_wait": "60s",
"accelerator": "",
"mirror": ""
"mirror": "https://mirror.pkgbuild.com/$repo/os/$arch"
},
"builders": [
{
......
......@@ -38,60 +38,25 @@ Name=eth0
DHCP=ipv4
EOF
# Setup pacman-init.service for clean pacman keyring initialization
cat <<EOF >/etc/systemd/system/pacman-init.service
[Unit]
Description=Initializes Pacman keyring
Wants=haveged.service
After=haveged.service
Before=sshd.service
ConditionFirstBoot=yes
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/pacman-key --init
ExecStart=/usr/bin/pacman-key --populate archlinux
[Install]
WantedBy=multi-user.target
EOF
# Add service for running reflector on first boot
cat <<EOF >/etc/systemd/system/reflector-init.service
[Unit]
Description=Initializes mirrors for the VM
After=network-online.target
Wants=network-online.target
Before=sshd.service
ConditionFirstBoot=yes
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=reflector --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
[Install]
WantedBy=multi-user.target
EOF
# enabling important services
systemctl daemon-reload
systemctl enable sshd
systemctl enable haveged
systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl enable pacman-init.service
systemctl enable reflector-init.service
pacman-key --init
pacman-key --populate archlinux
if [ -b "/dev/sda" ]; then
grub-install /dev/sda
elif [ -b "/dev/vda" ]; then
grub-install /dev/vda
fi
sed -i -e 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub
sed -i 's/^GRUB_TIMEOUT=.*$/GRUB_TIMEOUT=1/' /etc/default/grub
# setup unpredictable kernel names
sed -i -e 's/^GRUB_CMDLINE_LINUX=.*$/GRUB_CMDLINE_LINUX="net.ifnames=0"/' /etc/default/grub
sed -i 's/^GRUB_CMDLINE_LINUX=.*$/GRUB_CMDLINE_LINUX="net.ifnames=0"/' /etc/default/grub
sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"rootflags=compress-force=zstd\"/' /mnt/etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
# lock root account
......
......@@ -22,19 +22,10 @@ size=${swap_size_in_kilobytes}KiB, type=82
EOF
mkswap "${device}1"
mkfs.ext4 -L "rootfs" "${device}2"
mount "${device}2" /mnt
mkfs.btrfs -L "rootfs" "${device}2"
mount -o compress-force=zstd "${device}2" /mnt
if [ -n "${MIRROR}" ]; then
echo "Server = ${MIRROR}" >/etc/pacman.d/mirrorlist
else
pacman -Sy --noconfirm reflector
reflector --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
fi
pacstrap -M /mnt base linux grub openssh sudo polkit haveged netctl python reflector
swapon "${device}1"
genfstab -pU /mnt >>/mnt/etc/fstab
swapoff "${device}1"
echo "Server = ${MIRROR}" >/etc/pacman.d/mirrorlist
pacstrap -M /mnt base linux grub openssh sudo polkit haveged netctl python
arch-chroot /mnt /usr/bin/sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist
arch-chroot /mnt /bin/bash
......@@ -10,7 +10,7 @@
"write_zeroes": "",
"boot_wait": "60s",
"accelerator": "",
"mirror": ""
"mirror": "https://mirror.pkgbuild.com/$repo/os/$arch"
},
"builders": [
{
......
Supports Markdown
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