python - Jenkins - 推送部署测试步骤失败

标签 python google-app-engine jenkins

我正在按照 Push to deploy 上的说明进行操作使用 Jenkins 测试和部署用 python 和 Flask 编写的 Google App Engine 应用程序。

测试位于应用程序根文件夹中名为 tests.py

的文件中

执行 shell 步骤中的命令是

nosetests tests.py

我收到以下错误,但我不知道如何解决此问题,因为我对 Jenkins 相当陌生。

Started by user User Name
Building remotely on cloud-dev-php in workspace /var/jenkins/workspace/CFC Melbourne production pipeline
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://source.developers.google.com/p/cfc-melbourne-website/ # timeout=10
Fetching upstream changes from https://source.developers.google.com/p/cfc-melbourne-website/
 > git --version # timeout=10
using .gitcredentials to set credentials
 > git config --local credential.helper store --file=/tmp/git7069316934747655973.credentials # timeout=10
 > git -c core.askpass=true fetch --tags --progress https://source.developers.google.com/p/cfc-melbourne-website/ +refs/heads/*:refs/remotes/origin/*
 > git config --local --remove-section credential # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 3a8caffa38303b3ae4741aac83e6ac807077b5be (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 3a8caffa38303b3ae4741aac83e6ac807077b5be
 > git rev-list 3a8caffa38303b3ae4741aac83e6ac807077b5be # timeout=10
[CFC Melbourne production pipeline] $ /bin/sh -xe /tmp/hudson3364335209750264714.sh
+ nosetests tests.py
/tmp/hudson3364335209750264714.sh: 2: /tmp/hudson3364335209750264714.sh: nosetests: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE

最佳答案

这并不是真正的 Jenkins 问题 - 正如构建输出所示,您的 shell 脚本失败,因为它找不到 nosetests 可执行文件:

nosetests: not found

您确定 nose is installedcloud-dev-php Jenkins 构建机器上?

据说应该是already be installed如果您使用的是推送部署镜像,但由于您的构建是在 PHP 构建机器而不是 Python 机器上运行,也许情况并非如此。
您应该仔细检查您是否遵循了 instructions确保您的 Python Jenkins 作业在 Python 构建机器上运行。

如果它已安装,可能它不在默认PATH上,在这种情况下,您可以将nosetests的用法更改为/usr/local/bin/nosetests (或任何路径)。

关于python - Jenkins - 推送部署测试步骤失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30123950/

相关文章:

python - 由于OSError无法运行python beautifulsoup Web抓取程序

python正则表达式在字符的最后两次出现之间保留文本

python - 在 numpy 中创建下一个有效 bool 值的索引数组

javascript - 使用 Python 提交 Javascript 表单和抓取

python - 与 Google App Engine 和 BigTable 的递归关系

google-app-engine - 如何从本地服务器提供谷歌云存储图像?

android - 使用 Google App Engine 和 Firebase Cloud Messaging 进行通知

jenkins - 我无法打开蓝海管道编辑器

visual-studio - 如何在 Microsoft Surface 上自动化非交互式测试

jenkins - 如何在声明性管道中从 archiveArtifact 中排除文件?