- Groovy 代码调试窗口
Jenkins -> Manage Jenkins ->Script Console 是一个非常好的Groovy 代码调试窗口
jenkins script console 的官方文档:
https://www.jenkins.io/doc/book/managing/script-console/
1.groovy 打印log
jenkins job 配置Groovy postbuild, 打印日志的方法:
manager.listener.logger.println("Complete build with skip")
jenkins job 配置Groovy postbuild, 打印日志的方法:
manager.listener.logger.println("Complete build with skip")
2.开源库
https://github.com/cloudbees/jenkins-scripts
https://github.com/jenkinsci/jenkins-scripts/tree/master/scriptler
https://github.com/tkrzeminski/jenkins-groovy-scripts
https://github.com/politie/pipeline-library
https://github.com/funkwerk/jenkins-workflow
https://github.com/cloudbees/jenkins-scripts
https://github.com/jenkinsci/jenkins-scripts/tree/master/scriptler
https://github.com/tkrzeminski/jenkins-groovy-scripts
https://github.com/politie/pipeline-library
https://github.com/funkwerk/jenkins-workflow
3.修改build状态
Groovy postbuild插件
import hudson.model.Result
String desc = "Build Skipped"<br>def build=Thread.currentThread().executable
manager.build.setDescription(desc)
manager.build.@result = hudson.model.Result.UNSTABLE
Groovy postbuild插件
import hudson.model.Result
String desc = "Build Skipped"<br>def build=Thread.currentThread().executable
manager.build.setDescription(desc)
manager.build.@result = hudson.model.Result.UNSTABLE