2017-04-27 4 views
2

Ich muss gitlab-ci mit docker verwenden, um archlinux-Pakete automatisch bei jedem commit zu erstellen und zu testen.Wie man archlinux pkgbuild in docker mit gitlab-ci erstellt

Mein .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 

Alles ist gut, aber wenn Befehl CI Anruf makepkg ich diesen Fehler:

==> 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... 

Wie kann ich es lösen?

Antwort

2

AFAIK, gibt es keine Möglichkeit, makepkg als root auszuführen. Wenn Sie als root ausgeführt werden, können makepkg Dateien überall auf Ihrem System und nicht nur in $pkgdir, wo das Paket hergestellt wird, ablegen. Dies wird gestoppt, indem fakeroot verwendet wird, das deaktiviert ist, wenn es als root ausgeführt wird.

A fake root is simply a subdirectory within the build directory that functions and behaves as the system's root directory. In conjunction with the fakeroot program, makepkg creates a fake root directory, and installs the compiled binaries and associated files into it, with root as owner.

Ich schlage vor, Sie pritunl/archlinux Bild zu erweitern und einen einfachen Benutzer hinzufügen, nur für makepkg Operationen.

+0

Oder, ohne ein neues Image zu erstellen, erstellen Sie einen neuen Benutzer aus Ihrer '.gitlab-ci.yml' Datei und verwenden Sie ihn für den' makepkg' Befehl. – Jawad

+0

Aber makepkg benötigt eine Erhöhung von privelagions, wenn es als ein anderer Benutzer ausgeführt wird. Wie kann ich es lösen? – CryptoManiac

+2

so etwas ist, ist Hacky Trick, aber es eine Root-Berechtigung zu Benutzer echo 'your_user ALL = (ALL) ALL' >>/etc/sudoers ', aber sei vorsichtig. –

Verwandte Themen