跳过正文
Background Image
  1. Posts/

已解决 - The Pip Inspector tree parse failed to produce output

·524 字·2 分钟· ·
沈显鹏
作者
沈显鹏
目录

问题详情
#

Failure: PIP - Pip Inspector
  The Pip Inspector tree parse failed to produce output.

Overall Status: FAILURE_DETECTOR - Detect had one or more detector failures while extracting dependencies.
点击展开完整输出
[main] --- ======== Detect Issues ========
[main] ---
[main] --- DETECTORS:
[main] --- 	Detector Issue
[main] --- 		/workdir/test
[main] --- 		Failure: PIP - Pip Inspector
[main] --- 			The Pip Inspector tree parse failed to produce output.
[main] ---
[main] --- ======== Detect Result ========
[main] ---
[main] --- Black Duck Project BOM: https://org.blackducksoftware.com/api/projects/246c8952-7cb8-40e9-9987-35f7d4602ae1/versions/e1cb4204-42d0-4445-8675-978df62b150d/components
[main] ---
[main] --- ======== Detect Status ========
[main] ---
[main] --- GIT: SUCCESS
[main] --- PIP: FAILURE
[main] ---
[main] --- Signature scan / Snippet scan on /workdir/test: SUCCESS
[main] --- Overall Status: FAILURE_DETECTOR - Detect had one or more detector failures while extracting dependencies. Check that all projects build and your environment is configured correctly.
[main] ---
[main] --- If you need help troubleshooting this problem, generate a diagnostic zip file by adding '-d' to the command line, and provide it to Synopsys Technical Support. See 'Diagnostic Mode' in the Detect documentation for more information.
[main] ---
[main] --- ===============================
[main] ---
[main] --- Detect duration: 00h 00m 54s 951ms
[main] --- Exiting with code 5 - FAILURE_DETECTOR

运行环境

  • Product: synopsys-detect-7.11.1.jar
  • OpenJDK 11
  • Python 3.6 和 Python 2.7.5

根本原因
#

在调试输出中可以看到,Detect 调用的是 python(指向 python2),而不是 python3,导致运行 pip-inspector.py 失败:

DEBUG [main-Executable_Stream_Thread] --- Python 2.7.5
...
[main] --- Running executable >/usr/bin/python .../pip-inspector.py --projectname=test

解决方法
#

python 链接到 python3 即可。

# 备份原 python
sudo mv /usr/bin/python /usr/bin/python.old
# 建立指向 python3 的软链接
sudo ln -s /usr/bin/python3 /usr/bin/python

然后重新运行 Detect,例如:

bash <(curl -s -L https://detect.synopsys.com/detect7.sh) \
  --blackduck.url=https://org.blackducksoftware.com \
  --blackduck.api.token=MmMwMjdlOTctMT \
  --detect.project.name=HUB \
  --detect.project.version.name=TEST_v1.1.1 \
  --detect.source.path=/workdir/test \
  --logging.level.com.synopsys.integration=DEBUG \
  --blackduck.trust.cert=TRUE \
  --detect.tools.excluded=POLARIS \
  --detect.blackduck.signature.scanner.snippet.matching=SNIPPET_MATCHING

Docker 方式
#

如果想用 Docker 来进行 Black Duck 扫描,可以构建镜像,例如:

FROM openjdk:11

# 可指定需要的 DETECT 版本,留空则下载最新
ENV DETECT_LATEST_RELEASE_VERSION=""

RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y \
        git \
        python \
        pip \
    && apt-get autoremove \
    && apt-get clean

RUN curl -sSOL https://detect.synopsys.com/detect7.sh && bash detect7.sh --help \
    && rm -rf /usr/bin/python \
    && ln -s /usr/bin/python3 /usr/bin/python

WORKDIR /src

希望能帮到你。


转载本文请注明作者与出处,禁止商业用途。欢迎关注公众号「DevOps攻城狮」。

相关文章

关于 Artifactory 上传制品变得非常缓慢,偶尔失败的问题分享
·710 字·2 分钟
在使用 JFrog Artifactory 上传制品时遇到速度缓慢和上传失败的问题,经过排查和解决,分享经验和教训。
解决 ESlint HTML 报告在 Jenkins 作业中无法正常显示的问题
·331 字·1 分钟
本文记录了 ESlint HTML 报告在 Jenkins 中因内容安全策略(CSP)限制而无法正确显示的问题,并介绍了如何通过修改 Jenkins 配置使报告正常加载。
解决 “.NET Framework 2.0 or later is required on this computer to run a Jenkins agent as a Windows service” 问题
·316 字·1 分钟
当 Jenkins Windows Agent 因缺少 .NET Framework 无法连接时,通过安装 .NET Framework 3.5 并设置 Jenkins Agent 服务来解决问题。
解决 Jenkins Artifactory Plugin 仅在 AIX 上传制品到 https 协议的 Artifactory 失败的问题
·1995 字·4 分钟
本文介绍了在 AIX 上使用 Jenkins Artifactory 插件上传制品到 https 协议的 Artifactory 失败的问题及其解决方法,包括设置环境变量和调整 Java 系统属性。
三种方法解决 Jenkins 声明式流水线 Exception Method code too large !
·1033 字·3 分钟
本文介绍了三种方法来解决 Jenkins 声明式流水线中出现的 “Method code too large” 异常,包括将步骤放到管道外的方法、从声明式迁移到脚本式管道以及使用 Shared Libraries。
Black Duck 与 Jenkins 集成
·1010 字·3 分钟
本文介绍如何将 Black Duck 与 Jenkins 集成,实现对代码仓库的自动化安全扫描和漏洞检测。