如何使用gitlab-ci构builddocker内的archlinux pkgbuild

我需要在Docker中使用gitlab-ci,以便在每次提交时自动构build和testingarchlinux软件包。

我的.gitlab-ci.yml

 image: pritunl/archlinux before_script: - pacman -Su pkgbuild-introspection --noconfirm stages: - build makepkg: script: - makepkg --clean --rmdeps --syncdeps --noarchive --noconfirm --noprogressbar --asdeps stage: build 

一切都很好,但是当CI调用makepkg命令时,我得到这个错误:

 ==> ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system. ==> ERROR: An unknown error has occurred. Exiting... 

我该如何解决?

AFAIK,没有办法以root身份运行makepkg 。 如果以root用户身份运行, makepkg可以将文件放在系统中的任何位置,而不是放在$pkgdir所在的位置。 这是通过使用fakeroot停止的,当以root身份运行时, fakeroot被禁用。

假根只是构build目录中的一个子目录,其function和行为与系统的根目录相同。 与fakeroot程序一起,makepkg会创build一个假根目录,并将编译的二进制文件和相关文件安装到其中,并以root身份作为所有者。

我build议你扩展pritunl/archlinux镜像,并添加一个简单的用户,仅用于makepkg操作。