使用sudo:false在Travis-ci上安装软件包 [英] Install package on Travis-ci with sudo:false
问题描述
我有我的travis.yml:
$ b如何在travis-ci上安装travis-ci包?$ b
sudo:false
安装:
- wget http://security.ubuntu.com/ubuntu/pool /main/i/icu/libicu52_52.1-3ubuntu0.4_amd64.deb
- sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb
我有一个错误:
sudo:必须是setuid根
命令sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb失败,并在1之前退出。
是的,至少有一些可以。
Travis有一个允许的白名单软件包,您可以使用集装箱化环境进行安装。您可以在 addons
部分下的yaml中定义包,而不是使用wget和dpkg或apt。检查 https://docs.travis-ci.com/user/installing-dependencies/ 。
在yaml中,您可以使用以下内容:
addons:
apt:
包:
- ncftp
ncftp
已列入白名单这里。
如果您需要不被列入白名单的软件包,可以设置 sudo:true
并且您的构建将在非容器环境中启动,因此您有root( sudo
)访问来安装任何您想要的。或者,您可以在他们的Github上引发问题,为您的包添加白名单。
How can I Iinstall a package on Travis-ci with sudo:false in travis.yml ?
I have my travis.yml :
sudo: false
install:
- wget http://security.ubuntu.com/ubuntu/pool/main/i/icu/libicu52_52.1-3ubuntu0.4_amd64.deb
- sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb
I have an error :
sudo: must be setuid root
The command "sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb" failed and exited with 1 during .
Yes you can, at least some.
Travis has a whitelist of allowed packages you can install from using the containerised environment. Instead of using wget and dpkg, or apt, you define the packages in your yaml under the addons
section. Check https://docs.travis-ci.com/user/installing-dependencies/.
In the yaml you'd have something like:
addons:
apt:
packages:
- ncftp
ncftp
is whitelisted here.
If you need packages which are not whitelisted, you can set sudo: true
and your build will be launched in a non-containerised environment, so you have root (sudo
) access to install whatever you want. Alternatively you can raise an issue on their Github to add a whitelist for your package.
这篇关于使用sudo:false在Travis-ci上安装软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!