Install package on Travis-ci with sudo:false [closed]

折月煮酒 提交于 2020-01-02 05:44:08

问题


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 .


回答1:


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.



来源:https://stackoverflow.com/questions/35222589/install-package-on-travis-ci-with-sudofalse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!