travis-ci - Travis sudo 已禁用

标签 travis-ci

我想使用 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/

相关文章:

python - 如何将 Travis CI 与 gitignore 中的某些文件一起使用?

php - 为什么 APC 无法在 Travis-CI 上的 PHP v5.5 中工作?

python - 如何让 Travis-CI 在出现提示时输入密码?

r - 在 Travis CI 上为 R 包指定 valgrind 选项

node.js - 无法在 Travis CI 上运行 Bower

php - 使用 Travis CI 触发测试时无法访问 CakePHP fixture db

phpunit - travis-ci 中的可视化代码覆盖率

java - 如何使用 Gradle 测试编译后的 JAR 文件

ScalaTest 和 SBT : Reporting progress of test suite?

go - 在 travis 的 golang 仓库上运行 lint