Install package on Travis-ci with sudo:false

Jérémie Chazelle

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 .

Marcus Hughes

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.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related