我想使用 apt
为测试安装一些软件包,但是,由于禁用了 sudo,它失败了。我在测试输出中发现了以下内容:
Sudo, the FireFox addon, setuid and setgid have been disabled.
似乎输出来自this line in travic-ci , 但设置
paranoid_mode
在 .travis.yml
中为假不起作用。如何启用 sudo 访问?
PS:我正在使用私有(private) repo 。
编辑:以下
.travis.yml
由于 sudo: must be setuid root
将失败运行时sudo apt-get update -qq
language: python
python:
- "3.4"
before_install:
- sudo apt-get update -qq
script:
- nosetests
设置
sudo: true
和/或 paranoid_mode: false
不起作用。
最佳答案
如“Combining The Linux Infrastructures ”中所述
Going forward, we will slowly transition the container-based environment out, in favor of a build environment that is entirely virtual machine-based.
Folks using container-based infrastructures will be the only ones affected, and this transition will roll out slowly, depending on whether you specify
sudo: false
in your.travis.yml
.
这在 Git 2.20(2018 年第四季度)中进行了说明,其中:
Travis CI will soon deprecate the container-based infrastructure enabled by
sudo: false
in ce59dff (Git 2.8.0, Jan. 2016).
见 commit 0f0c511 (2018 年 11 月 1 日)作者 SZEDER Gábor (
szeder
) .(由 Junio C Hamano --
gitster
-- 在 commit 57f06d5 中合并,2018 年 11 月 13 日)travis-ci:在 'ci/install-dependencies.sh' 中安装软件包
Ever since we started using Travis CI, we specified the list of packages to install in '
.travis.yml
' via the APT addon.While running our builds on Travis CI's container-based infrastructure we didn't have another choice, because that environment didn't support '
sudo
', and thus we didn't have permission to install packages ourselves.With the switch to the VM-based infrastructure in the previous patch we do get a working '
sudo
', so we can install packages by running 'sudo apt-get -y install ...
' as well.Let's make use of this and install necessary packages in '
ci/install-dependencies.sh
', so all the dependencies (i.e. both packages and "non-packages" (P4 and Git-LFS)) are handled in the same file.Install
gcc-8
only in the 'linux-gcc
' build job; so far it has been unnecessarily installed in the 'linux-clang
' build job as well.
Print the versions of P4 and Git-LFS conditionally, i.e. only when they have been installed; with this change even the static analysis and documentation build jobs start using 'ci/install-dependencies.sh
' to install packages, and neither of these two build jobs depend on and thus install those.This change will presumably be beneficial for the upcoming Azure Pipelines integration preliminary versions of that patch series run a couple of '
apt-get
' commands to install the necessary packages before running 'ci/install-dependencies.sh
', but with this patch it will be sufficient to run only 'ci/install-dependencies.sh
'.
关于travis-ci - Travis sudo 已禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26299552/