我在我的rails应用程序中使用coverity,但我无法上传任何版本。
我尝试使用 Coverity Scan Self-Build 。它运行没有任何问题,但是当我上传我的.tgz
文件时,它失败并显示以下消息:
请修正以下错误。
- 项目无效
我使用了以下命令:
$ ~/Downloads/cov-analysis-linux64-8.5.0.3/bin/cov-build --dir cov-int --no-command --fs-capture-search ./
Coverity Build Capture (64-bit) version 8.5.0.3 on Linux 4.7.4-1-ARCH x86_64
Internal version numbers: db70178643 p-kent-push-26368.949
[STATUS] Running filesystem capture search...
[WARNING] Path '/<PATH_TO_MY_APP>/cov-int' looks like an idir. Skipping filesystem capture on it.
[STATUS] Emitting 239 source files from filesystem capture
|0----------25-----------50----------75---------100|
****************************************************
Emitted 3 JavaScript compilation units (100%) successfully
Emitted 233 Ruby compilation units (100%) successfully
3 JavaScript compilation units (100%) are ready for analysis
233 Ruby compilation units (100%) are ready for analysis
The cov-build utility completed successfully.
$ tar czvf myproject.tgz cov-int
cov-int/
cov-int/build-id.txt
cov-int/emit/
cov-int/emit/<HOST>/
cov-int/emit/<HOST>/emit-db.lock
cov-int/emit/<HOST>/emit-db
cov-int/emit/<HOST>/config/
cov-int/emit/<HOST>/config/80d7f82624e3b17456da362d1e5400da/
cov-int/emit/<HOST>/config/80d7f82624e3b17456da362d1e5400da/coverity_config_created
cov-int/emit/<HOST>/config/80d7f82624e3b17456da362d1e5400da/coverity_config.xml
cov-int/emit/<HOST>/config/80d7f82624e3b17456da362d1e5400da/ruby-config-0/
cov-int/emit/<HOST>/config/80d7f82624e3b17456da362d1e5400da/ruby-config-0/coverity_config.xml
cov-int/emit/<HOST>/emit-db.write-lock
cov-int/emit/version
cov-int/tmp/
cov-int/build-log.txt
cov-int/BUILD.metrics.xml
cov-int/build-cwd.txt
cov-int/build-timings.txt
$
之后我尝试上传文件myproject.tgz
。
我还尝试使用travis上传我的第一个构建版本,但它也失败并显示以下消息:
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="${COVERITY_SCAN_NOTIFICATION_EMAIL:-<MY_EMAIL>}" COVERITY_SCAN_BUILD_COMMAND="${COVERITY_SCAN_BUILD_COMMAND:---no-command --fs-capture-search ./}" COVERITY_SCAN_BUILD_COMMAND_PREPEND="${COVERITY_SCAN_BUILD_COMMAND_PREPEND:-}" COVERITY_SCAN_BRANCH_PATTERN=${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-29 20:36:31 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
[STATUS] Running filesystem capture search...
[WARNING] Path '/home/travis/build/<PROJECT_NAME>/cov-int' looks like an idir. Skipping filesystem capture on it.
[STATUS] Emitting 238 source files from filesystem capture
|0----------25-----------50----------75---------100|
|******/*****/*****/******/*****/*****/*****/******/****/*****
Emitted 2 JavaScript compilation units (100%) successfully
Emitted 233 Ruby compilation units (100%) successfully
2 JavaScript compilation units (100%) are ready for analysis
233 Ruby compilation units (100%) are ready for analysis
The cov-build utility completed successfully.
Extracting SCM data for 235 files...
|0----------25-----------50----------75---------100|
*******/************************************|*********
Please see the log file '/home/travis/build/<PROJECT_NAME>/cov-int/scm_log.txt' for warnings and SCM command issues.
[WARNING] SCM data appears to be mismatched.
File: '/home/travis/build/<PROJECT_NAME>/config/initializers/cookies_serializer.rb'
Please check the correctness of the SCM data with cov-manage-emit.
Successfully added SCM data for 235 files
Tarring Coverity Scan Analysis results...
Uploading Coverity Scan Analysis results...
Coverity Scan upload failed: ERROR: Project is invalid.
它还说项目无效。由于构建来自travis,我无法查看日志。
参考文件config/initializers/cookies_serializer.rb
如下所示:
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
第三种可能性是命令行上传。这是日志:
$ curl --form token=<TOKEN> \
--form email=<MY_EMAIL> \
--form file=@/<PATH_TO_MY_APP>/myproject.zip \
--form version="1.0" \
--form description="Initial" \
https://scan.coverity.com/builds?project=<MY_USERNAME>%2F<MY_PROJECT_NAME>
ERROR: Project is invalid
$
以下是我的.travis.yml
文件的摘录:
# environment settings
env:
global:
- secure: "<SECURE>"
matrix:
- DB=sqlite
- DB=mysql
- DB=postgresql
# commands to run before the install
before_install:
# download certificate
- echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-
# 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 --fs-capture-search ./"
branch_pattern: coverity_scan
我也尝试使用build命令选项--fs-capture-search ./app/
,因此只扫描所有应用程序文件。
有谁知道为什么会出现这种错误?
提前致谢!
编辑:添加了命令行示例
答案 0 :(得分:1)
我认为此处的错误消息是抱怨您尝试将结果提交到SCAN的项目未正确配置。在您的其他问题How to setup a Travis Rails project to submit to Coverity Scan?中,您可以在travis.yml
中找到此问题。您是否更新了这个以指向正确的项目?
# addons
addons:
coverity_scan:
project:
name: "<PROJECT_NAME>"
description: "Build submitted via Travis CI"