jenkins 由于找不到“setup.py”或“pyproject.toml ",pip安装失败

hkmswyz6  于 2023-03-01  发布在  Jenkins
关注(0)|答案(1)|浏览(456)

我有一个sh脚本行(作为Jenkinsfile groovy脚本的一部分),它

sh "python3 -m venv venv"
    sh "source venv/bin/activate"
    withCredentials([usernamePassword(credentialsId: XXXXXXX,
                                          usernameVariable: 'XXXXXXX',
                                          passwordVariable: 'XXXXXXX')]) {
    sh "pip install --extra-index-url 'https://${XXXXXXX}:${XXXXXX}@atifactory-url-base/artifactory/api/pypi/pypi-release-local/simple' -e ."
    }
    
    sh "pip freeze >> requirements.txt"

但是,上述失败的原因是

ERROR: file:///home/jenkins/workspace/XXXXXXXXXXX does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

我拥有的项目在顶层没有setup.py或requirements.txt文件-如果不添加当前的python项目以使用-e进行安装,我怎么能做到这一点?

xdnvmnnf

xdnvmnnf1#

如果您在Dockerfile中添加pip install命令,而该文件没有将setup.py复制到其上下文(如VSCode开发容器)中,则会发生这种情况。

相关问题