Jenkins学习之Jenkins历史任务构建时间引发的思考
问题背景我们在使用jenkins的过程中有没有发现 历史任务 那里的构建时间的格式 是不是怪怪的?
例如设置的晚上凌晨0点的 定时任务, 显示的时间会是 2020-10-22 上午12:00看着不习惯,感觉很怪。感觉显示的是12小时制的格式,但是又不太符合我们中国的风格?(这都是国外设计的,也怪不得我们.)
这里有个 issue 提问 , jenkins 简体中文插件中的, 参考这个 https://github.com/jenkinsci/localization-zh-cn-plugin/issues/79
由这个引发了以下的一些思考,特记录下来分享给大家.
问题1这个日期时间格式在哪里控制的呢?
12345678910111213在这个文件中控制的 core/src/main/resources/hudson/widgets/HistoryWidget/entry.jelly在48行左右: <i:formatDate value="${build.timestamp.time}" type="both" ...
Jenkins学习之Jenkins插件页面的一个报错
jenkins插件更新页面的一个报错doCheckUpdatesServer()123456789101112首先从 doCheckUpdatesServer() 这里 开始 执行 start(),在执行 start 方法之前需要初始化 updateServerRetrier 变量,FormValidation result = updateServerRetrier.start();在 Retrier.java 类中的 有个 start() 方法,中会执行 result = callable.call(); 这个。这个callable 是什么呢? 来自 java.util.concurrent.Callable;
updateServerRetrier初始化12345678910111213141516171819202122232425262728293031323334353637383940414243444546看 doCheckUpdatesServer() 中怎么初始化 updateServerRetrier的。updateServerRetrier 是 Retri ...
Jenkins学习之记master的一次报错
jenkins学习之记master的一次报错问题今天早上 打开jenkins,然后登录,然后 报错了 Oops!
A problem occurred while processing the request.Logging ID=7e123605-0518-46c7-b711-d3213948134d
主要报错如下,去掉了 其他没用的信息。
报错信息怎么 找,就是找 jenkins 关键字 的 行, 其他的 暂时忽略。从下往上找。
12345678java.lang.NullPointerException at hudson.model.ViewGroupMixIn.getView(ViewGroupMixIn.java:119) at hudson.model.ViewGroupMixIn.getPrimaryView(ViewGroupMixIn.java:172) at jenkins.model.Jenkins.getPrimaryView(Jenkins.java:1973) at jenkins.m ...
Jenkins插件学习之throttle-concurrent-builds-plugin
今天介绍一个插件 throttle-concurrent-builds-pluginhttps://github.com/jenkinsci/throttle-concurrent-builds-pluginThis plugin allows for throttling the number of concurrent builds of a project running per node or globally.
throttle 有节流的意思,也就是限制 某个任务同时并发的个数的。下面分别的讲解 这个插件在 free style project、matrix project 等项目中的应用和异同。
throttle-concurrent-builds-plugin 使用
throttle-concurrent-builds-plugin 插件是用来限制某个job并发数的. 可以限制一个job的总的并发数量, 可以限制一个job在一个节点上的并发数量.
12345678910111213141516配置 Maximum Total Concurrent Builds 为 0配置 ...
Jenkins插件学习之ssh-slaves-plugins插件
分析 slave 上的remtoe fs 目录什么时候创建, 创建的权限为什么是700??
123456789101112131415161718192021首先在hudson/plugins/sshslaves/SSHLauncher.java文件中这个方法是 启动 ssh slave的 入口public void launch(final SlaveComputer computer, final TaskListener listener) throws InterruptedException {connection = new Connection(host, port);launcherExecutorService = Executors.newSingleThreadExecutor(new NamingThreadFactory(Executors.defaultThreadFactory(), "SSHLauncher.launch for '" + computer.getName() + "' node ...
Jenkins插件学习之show-build-parameters-plugin
今天介绍一个插件 show-build-parameters-plugin
https://github.com/mamh-java/show-build-parameters-plugin.git
如下图所示,作用就是在job的每个构建历史上显示参数。
这里先点击左侧的 Build with Parameters 链接。进入界面填写,选择需要的参数。
构建结束,在历史中找到2这次构建,点进去,就能看到#2这次构建的所有参数了,
下面又是一个构建例子,选择参数,触发构建
下面这个是 不安装这个插件的话在这样的地方查看本次构建参数。
Jenkins插件学习之matrix-project-plugin
今天介绍一个插件 matrix-project-plugin
https://github.com/jenkinsci/matrix-project-plugin
matrix 矩阵的意思,这个插件在创建的时候又显示 Multi-Configuration Projects 这个名称,中文的界面的话 叫 多配置 项目, 这名称起的着实让人很迷惑,
通过使用,可以看出来是几个参数,或者几个配置, 几个节点的一个全排列组合 这样看就像是矩阵,一共二维表格。
123456789101112131415161718192021其中有个 User Defined Axis 类型的选项,可以翻译为用户自定义坐标。就是用户自定义几个字段,几个字段都可以有多个值,然后全排列组合一下。例如定义一个User Defined Axis,名称是 target, 可以取的值是 alpha,beta,gamma 三个值然后再定义一共User Defined Axis,名称是releasetype, 可以取的值是 debug,release 两值这样 排列组合下来就是2乘以3就是6个组合。alpha debuga ...
Jenkins插件学习之job-parameter-summary-plugin
今天介绍一个插件 job-parameter-summary-plugin
Display job parameter summary on main job page 在job主页上显示参数摘要
插件的源码地址: https://github.com/jenkinsci/job-parameter-summary-plugin
插件wiki地址: https://plugins.jenkins.io/job-parameter-summary/
如下图所示,作用就是在job主页上面显示参数摘要信息。
Jenkins插件学习之hidden-parameter-plugin
今天介绍一个插件 hidden-parameter-pluginhidden-parameter-plugin 这个插件用来隐藏 字符串参数的,就是用这种类型的参数 在 build with parameters 界面 不会显示出来。
但是在job中还是有这个参数的。用法 可以把一些不会变的参数 做成隐藏的。
对此插件的增强1. 增加可以隐藏 text类型的才是,也就是 多行字符串那种的参数
2. 支持 流水线中使用。 hidestring hidetext 或者 hidestringParam hidetextParam
3. https://github.com/mamh-java/hidden-parameter-plugin/tree/hidden-parameter-0.0.6-for-jenkins-2.249.3
Characteristics 1. Parameters once more, it looks bad user experience.this plugin can resolve the problem.
2. Some ...
Jenkins插件学习之extensible-choice-parameter-plugin
今天介绍一个插件 extensible-choice-parameter-plugin扩展的选项 参数 1. 支持 使用多行文本提供选项的 参数。类似 jenkins 自带的Choice参数
Textarea Choice Parameter: writes choices in a textarea, just like a built-in Choice parameter.
2. 执行groovy脚本,返回选项 列表的 参数。
System Groovy Script Choice Parameter: runs a System Groovy script to determine the list of choices
3. 支持 列出某个目录下所有文件作为选项的参数。
File Choice Parameter: lists files in a directory.
4. Editable。 勾选这个,可以 构建完成之后 把你手动编辑的那个选项 值 添加 到 job的配置中。这个只能在 非流水线job中 ...
Jenkins插件学习之extended-choice-parameter-plugin
今天介绍一个插件 extended-choice-parameter-plugin另外一个 扩展的选项 参数
JSON Parameter Type 举例
参考 这里:https://wiki.jenkins-ci.org/JENKINS/Extended-Choice-Parameter-plugin.html
12345678910111213141516171819202122232425262728293031323334353637383940414243444546// import org.boon.Boon;import net.sf.json.JSONObjectdef jsonEditorOptions = JSONObject.fromObject(/{ disable_edit_json: true, disable_properties: true, no_additional_properties: true, disable_collapse: true, disable_array_add: tru ...
Jenkins插件学习之Console-Tail-Plugin
今天介绍一个插件Console-Tail-Plugin
Console-Tail-Plugin12345678这个插件会在 最后一次如果是编译失败的情况下.在job的界面是 弄个一个 Console output 的 div。 显示log的最后几行输出。 如果点击了 "console output " 那个连接 会跳转到lastFailedBuild/console, ( http://example.com:8080/jenkins/job/test_Console-Tail-Plugin/lastFailedBuild/console)https://plugins.jenkins.io/console-tail/