Skip to content
Snippets Groups Projects
Verified Commit 085fd77a authored by Rafael Epplée's avatar Rafael Epplée
Browse files

wip: Add custom gitlab runner executor

parent 13f4c9e7
Branches buildbot
No related tags found
No related merge requests found
Pipeline #122789 passed
#!/usr/bin/bash
set -o nounset -o errexit -o pipefail
pacman --noconfirm -Sy devtools
useradd -m -p '' builder
echo 'builder ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
chown -R builder .
sudo -u builder bash << EOF
pkgctl repo clone --protocol https miniserve
pkgctl build miniserve
EOF
#!/usr/bin/bash
set -o nounset -o errexit -o pipefail
# https://docs.gitlab.com/runner/executors/custom.html#prepare
prepare() {
# Pull image if it doesn't exist and make sure a booted snapshot is available.
vmexec run --os archlinux --pull newer --pmem /var/lib/archbuild:30 -- echo 'VM started'
}
# https://docs.gitlab.com/runner/executors/custom.html#run
run() {
vmexec run --os archlinux --pmem /var/lib/archbuild:30 \
--volume "$PWD:/mnt:ro" \
-- \
/mnt/build-inside-vm || exit "${BUILD_FAILURE_EXIT_CODE:-1}"
}
# https://docs.gitlab.com/runner/executors/custom.html#cleanup
cleanup() {
# vmexec mostly cleans up after itself
# TODO: clean up old versions of VM base images
:
}
case "${1:-}" in
prepare)
prepare
;;
run)
run
;;
cleanup)
cleanup
;;
*)
echo "Error invalid command: ${1:-}"
exit 1;
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment