git - jenkins 没有从管道运行我的 python 脚本
问题描述
我有一个.jenkinsfile
负责我的 CI。这是相关的片段(来自詹金斯“重播”):
try {
sh("pytest...")
} catch (e) {
sh("./clean_script.sh || true")
throw e
} finally ...
在查看控制台输出时,我可以检测到(失败时)这部分:[STAGE_NAME] + ./clean_script.sh
,这意味着我得到了catch
部分。
但是,我在稍后的提交和重新运行中添加的以下行没有执行。我的补充看起来像:
try {
sh("pytest...")
} catch (e) {
sh("./clean_script.sh || true")
println "start"
def good = ${GIT_PREVIOUS_SUCCESSFUL_COMMIT}
sh("python my_py.py ${good}")
println "end"
throw e
} finally ...
我什至看不到“开始”行,我不明白(“最终”部分被执行和打印)......假设 py 脚本失败,或者good
没有正确分配,为什么要影响它第一个println
?
解决方案
推荐阅读
- google-apps-script - google sheet split() 截断值,因为它认为它是一个数字?
- swift - 在运行时生成的访问元素(例如 UIView)
- python - 使用 chromedriver 访问“amiunique.org/fp”时,我的用户代理是“唯一的”,但与我的普通浏览器用户代理相同
- javascript - laravel foreach循环中的Javascript addEventListener问题
- javascript - JSON 数据未更新 onChange()
- sql - 每个唯一 ID 的 SQL 连接
- ffmpeg - 为什么 FFMpeg 不对视频输入应用视频过滤器?
- java - 代码的二叉树问题:NullPointerException
- python-3.x - 用 Bs4 刮掉标签的孩子
- java - 如何使用 Java/Selenium 在 Chrome 中禁用“退出前警告”?