【发布时间】:2017-08-29 14:27:53
【问题描述】:
是否可以使用 groovysh 或 groovy scriptname 测试 jenkins 管道脚本以在不使用 Jenkins UI 的情况下运行验证测试
例如一个简单的脚本
pipeline {
stages {
stage ('test') {
steps {
sh '''
env
'''
}
}
}
}
运行这样的测试,具体取决于脚本的子集:
No signature of method: * is applicable for argument types
groovysh_evaluate.pipeline()
或为 阶段('测试'){ 嘘''' 环境 ''' }
报告:
No signature of method: groovysh_evaluate.stages()
或者干脆
sh '''
env
'''
报告:
No signature of method: groovysh_evaluate.sh()
问题可能是需要哪些导入以及如何在 jenkins 安装之外安装它们?
为什么有人要这样做?
简化和缩短测试用例的迭代、库版本的验证,而无需修改 jenkins 安装以及其他单元和功能测试场景。
【问题讨论】:
标签: jenkins jenkins-pipeline jenkins-groovy