default: image: "archlinux:latest" variables: PACKER_LOG: 1 stages: - lint - build - publish shellcheck: stage: lint before_script: - pacman -Syu --needed --noconfirm shellcheck script: - find . -iname "*.sh" -exec shellcheck {} + shfmt: stage: lint before_script: - pacman -Syu --needed --noconfirm shfmt script: - find . -iname "*.sh" -exec shfmt -i 2 -ci -d {} + validate-packer: stage: lint before_script: - pacman -Syu --needed --noconfirm packer script: - packer validate config.json # Note: We explicitly need the `ipv6` tag here because otherwise we'd get random # gpg/pacman-key issues. build:cloud-qemu: stage: build tags: - ipv6 before_script: - pacman -Syu --needed --noconfirm packer qemu-headless script: - packer build -only=cloud -except=sign config.json artifacts: name: "archlinux_x86_64_qcow2" paths: - "Arch-Linux-x86_64-cloudimg-*.*" expire_in: 2d build:vagrant-virtualbox: stage: build tags: - ipv6 before_script: - pacman -Syu --needed --noconfirm packer qemu-headless script: - packer build -only=virtualbox config.json artifacts: name: "archlinux_x86_64_virtualbox" paths: - "*.box" expire_in: 2d build:vagrant-qemu: stage: build tags: - ipv6 before_script: - pacman -Syu --needed --noconfirm packer qemu-headless script: - packer build -only=libvirt config.json artifacts: name: "archlinux_x86_64_libvirt" paths: - "*.box" expire_in: 2d publish: stage: publish tags: - ipv6 - secure before_script: - pacman -Syu --needed --noconfirm vagrant script: - vagrant cloud auth login --token $VAGRANT_API_TOKEN - vagrant cloud auth login --check - vagrant cloud box show archlinux/archlinux - LIBVIRT_RELEASE=`ls Arch-Linux-x86_64-libvirt-*.box | awk -F "." '{print $1}' | awk -F "-" '{print $5"."$6"."$7}'` - VIRTUALBOX_RELEASE=`ls Arch-Linux-x86_64-virtualbox-*.box | awk -F "." '{print $1}' | awk -F "-" '{print $5"."$6"."$7}'` - vagrant cloud publish archlinux/archlinux $LIBVIRT_RELEASE libvirt Arch-Linux-x86_64-libvirt-*.box --release -f - vagrant cloud publish archlinux/archlinux $VIRTUALBOX_RELEASE virtualbox Arch-Linux-x86_64-virtualbox-*.box --release -f only: variables: - $SCHEDULED_PUBLISH == "TRUE" resource_group: vm-build