【问题标题】:How to setup a Travis/Rails project to submit to Coverity Scan?如何设置 Travis/Rails 项目以提交到 Coverity Scan?
【发布时间】:2016-09-14 00:05:08
【问题描述】:

我正在寻找用于 rails 应用程序的 std travis 覆盖设置。

我当前的 .travis.yml 文件如下所示:

# environment settings
env:
  - DB=sqlite
  - DB=mysql
  - DB=postgresql
env:
  global:
   # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
   #   via the "travis encrypt" command using the project repo's public key
   - secure: "<SECURE>"

# project language
language: ruby
rvm:
  - 2.3.1

# branches to build (whitelist)
branches:
  only:
    - master
    - coverity_scan
    - testing

# command to run before install
before_install:
      - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-

# arguments for the bundler
bundler_args: --without production development

# addons
addons:
  coverity_scan:
    project:
      name: "<PROJECT_NAME>"
      description: "Build submitted via Travis CI"
    notification_email: <MY_EMAIL>
    build_command_prepend: ""
    build_command: "--no-command"
    branch_pattern: coverity_scan

# script
script:
  - RAILS_ENV=test bundle exec rake db:migrate --trace
  - bundle exec rake db:test:prepare
  - bundle exec rspec spec/
  - bundle exec cucumber

# run before script
before_script:
  - mysql -e 'create database my_app_test'
  - psql -c 'create database my_app_test' -U postgres

我不确定在addons.coverity_scanbuild_command 部分中添加什么。我已经尝试将其留空,--no-commandbundle installbundle install --jobs=3 --retry=3,但它们都不起作用。例如,--no_command 给了我以下信息:

Coverity Scan analysis selected for branch coverity_scan.
Coverity Scan analysis authorized per quota.
$ curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh | COVERITY_SCAN_PROJECT_NAME="$PROJECT_NAME" COVERITY_SCAN_NOTIFICATION_EMAIL="<MY_EMAIL>" COVERITY_SCAN_BUILD_COMMAND="--no-command" COVERITY_SCAN_BUILD_COMMAND_PREPEND="" COVERITY_SCAN_BRANCH_PATTERN=coverity_scan bash
Note: COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN are available on Project Settings page on scan.coverity.com
Coverity Scan configured to run on branch coverity_scan
Coverity Scan analysis authorized per quota.
Downloading Coverity Scan Analysis Tool...
2016-09-13 23:26:36 URL:https://scan.coverity.com/download/Linux [449455458/449455458] -> "/tmp/cov-analysis-Linux.tgz" [1]
Extracting Coverity Scan Analysis Tool...
/tmp/coverity-scan-analysis ~/build/<PROJECT_NAME>
~/build/<PROJECT_NAME>
Running Coverity Scan Analysis Tool...
Coverity Build Capture (64-bit) version 8.5.0.3 on Linux 3.13.0-92-generic x86_64
Internal version numbers: db70178643 p-kent-push-26368.949
[WARNING] No files were emitted. This may be due to a problem with your configuration
or because no files were actually compiled by your build command.
Please make sure you have configured the compilers actually used in the compilation.
 For more details, please look at: 
    /home/travis/build/<PROJECT_NAME>/cov-int/build-log.txt
Extracting SCM data for 0 files...
Please see the log file '/home/travis/build/<PROJECT_NAME>/cov-int/scm_log.txt' for warnings and SCM command issues.
[WARNING] Unable to gather all SCM data - see log at /home/travis/build/<PROJECT_NAME>/cov-int/scm_log.txt for details.
Successfully added SCM data for 0 files
Tarring Coverity Scan Analysis results...
Uploading Coverity Scan Analysis results...

因为我使用的是 travis,所以我无法查看日志文件...

当命令为空时,它会因错误而失败,需要给出一个命令并且它什么也不做。

有人可以帮助我为 Rails 应用程序设置某种标准吗?

提前致谢!

【问题讨论】:

    标签: ruby-on-rails travis-ci coverity


    【解决方案1】:

    8.5 支持的新语言使用 Coverity SCAN 的说明可在此处找到:https://scan.coverity.com/download?tab=other。我们假设用户在尝试 TravisCI 集成之前首先阅读了这些说明。还强烈建议在尝试任何 CI 之前测试本地集成以确保捕获干净。

    【讨论】:

    • 好吧,我是个白痴……我之前在那个页面上,但没有找到解决方案(--no-command 除外……)。我将其余部分误解为我的问题不需要的东西......非常感谢!
    【解决方案2】:

    Coverity 8.5 支持 Ruby。没有日志就很难调试。 SCAN 套件可能缺少 Ruby 的配置,可以通过运行 cov-configure --ruby 来修复。

    然而,更可能的问题是,Ruby 是 Coverity 认为的“非编译”语言(这意味着您通常没有在它们可以使用之前编译它们的构建)。所以这意味着你需要通知cov-build你的Ruby文件在哪里。查看您的 travis 配置,我希望您需要将其添加到您的 build_command--fs-capture-search /path/to/your/ruby/files

    【讨论】:

    • 好的,谢谢。我找不到任何信息,所以我认为这是不可能的。您知道任何 Getting Started 页面或提供某些常用语言的设置信息的页面吗?我给覆盖团队发了邮件,问他们是否可以重新激活我的项目。我会尽快报告您的建议。
    • @Caleb - Coverity 是否在 OS X 上进行测试? Apple 提供了一些非常古老的软件,即使在他们的现代操作系统上也是如此。它不限于 OpenSSL 0.9.8。
    • @jww 是的,Coverity 确实在 OS X 上测试了支持的版本。
    【解决方案3】:

    似乎无法分析rails(一般解释为)项目(如果我错了,请纠正我)。我从报道中删除了我的项目。

    【讨论】:

    • 您正在使用的版本 Coverity 8.5 支持 Ruby。 Coverity 支持多种解释语言;红宝石,Python,PHP,JavaScript。但是,您确实需要告诉 Coverity 在哪里可以找到您的文件。
    • 元问题:这里是否常见删除包含不正确信息的答案,这些信息对于理解问题和其他答案是不必要的?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-20
    • 2017-09-19
    • 2018-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多