ocaml-ci-scripts icon indicating copy to clipboard operation
ocaml-ci-scripts copied to clipboard

Whitelist PPA for faster builds

Open talex5 opened this issue 9 years ago • 7 comments

According to http://docs.travis-ci.com/user/apt/ we can ask for the opam PPA and packages to be whitelisted, which would allow building with sudo: false, which is apparently much faster.

talex5 avatar Apr 07 '15 08:04 talex5

This is related to #32. To be honest I have not yet encountered both issues, so I'm not sure what to do.

samoht avatar Apr 14 '15 21:04 samoht

Any new repositories created today require a sudo: required line. Existing repositories are slowing being included in this scheme, starting from the most recently created and working backwards. Eventually, everything will need to be updated.

talex5 avatar Apr 15 '15 08:04 talex5

ha ok, thanks for the explanation. We still need sudo to install the depexts though, so I'll merge #32 first.

samoht avatar Apr 15 '15 08:04 samoht

I've asked to have both avsm/ppa and opam added to the whitelist, so both are now available and we can now run travis without sudo.

bluddy avatar Apr 20 '15 13:04 bluddy

@bluddy thanks! unfortunately by default we don't know which packages to whitelist in the .travis.yml file, as this is detected at runtime using opam depext. Not sure if we can solve this properly.

samoht avatar Apr 24 '15 08:04 samoht

Ah ok. I hadn't bothered to look up opam depext before. You also can't install anything with apt - everything has to be done through travis' new API in the yaml file - so there's no way it'll work unless travis comes up with a more dynamic API.

bluddy avatar Apr 24 '15 13:04 bluddy

would something like this work? I haven't worked out the bash 100% (variable scoping), but it allows dpkg to test if a package is installed. if not, then it tries to run the sudo apt commands needed. still need to figure out how to get multiple, potentially conflicting, packages installed

this way, you could use the sudo: false infra if you take the time to list the packages in travis

pkgs=
for pkg in ocaml ocaml-base ocaml-native-compilers ocaml-compiler-libs\
ocaml-interp ocaml-base-nox ocaml-nox camlp4 camlp4-extra
do
  if ! dpkg -l $pkg | grep -Eq 'ii *'$pkg' *'$(full_version $pkg $OCAML_VERSION)
  then
    pkgs="$(full_apt_version $pkg $OCAML_VERSION) $pkgs"
  fi
done
for pkg in jq opam
do
  if ! dpkg -l $pkg; then
    pkgs="$pkg $pkgs"
  fi
done
if [ ! -z $pkgs ]; then
  sudo add-apt-repository --yes ppa:${ppa}
  sudo apt-get update -qq
  sudo apt-get install -y $pkgs
fi

stephengroat avatar Mar 07 '17 22:03 stephengroat