2017-04-27 31 views
2

コミットごとにarchlinuxパッケージを自動的にビルドしてテストするには、gitlab-ciをdockerで使用する必要があります。gitlab-ciでdocker内でarchlinux pkgbuildを構築するには

マイ.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... 

は、私はそれをどのように解決することができますか?

答えて

2

AFAIK、makepkgをルートとして実行する方法はありません。ルートとして実行する場合、makepkgは、そのパッケージが作成されている$pkgdirの中だけでなく、システムのどこにでもファイルを置くことができます。これはfakerootを使用すると停止し、rootとして実行すると無効になります。

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.

私はあなたがpritunl/archlinuxイメージを拡張し、ちょうどmakepkg操作のためのシンプルなユーザーを追加することをお勧めします。

+0

新しいイメージを作成する必要はなく、 '.gitlab-ci.yml'ファイルから新しいユーザーを作成し、それを' makepkg'コマンドに使用します。 – Jawad

+0

しかし、makepkgは、別のユーザーとして実行してからルートを実行するときに優先度を上げる必要があります。どのように私はそれを解決することができます? – CryptoManiac

+2

そのようなものは、ハックトリックですが、そのユーザーのroot権限を得るために 'echo 'your_user ALL =(ALL)ALL' >>/etc/sudoers'ですが、慎重に行ってください。 –

関連する問題