Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 .

like image 758
Jérémie Chazelle Avatar asked Feb 05 '16 11:02

Jérémie Chazelle


1 Answers

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.

like image 149
Marcus Hughes Avatar answered Nov 07 '22 01:11

Marcus Hughes