Jenkins Job DSL / Plugin
def gitUrl = 'git://github.com/jenkinsci/job-dsl-plugin.git' job('PROJ-unit-tests') { scm { git(gitUrl) } triggers { scm('*/15 * * * *') } steps { maven('-e clean test') } } job('PROJ-sonar') { scm { git(gitUrl) } triggers { cron('15 13 * * *') } steps { maven('sonar:sonar') } } job('PROJ-integration-tests') { scm { git(gitUrl) } triggers { cron('15 1,13 * * *') } steps { maven('-e clean integration-test') } } job('PROJ-release') { scm { git(gitUrl) } // no trigger authorization { // limit builds to just Jack and Jill permission('hudson.model.Item.Build', 'jill') permission('hudson.model.Item.Build', 'jack') } steps { maven('-B release:prepare release:perform') shell('cleanup.sh') } }
job('PROJ-unit-tests') { scm { git('https://github.com/bg7nyt/java.git') } triggers { scm('*/15 * * * *') } steps { maven('-e clean test') } }
12.5. Jenkins Plugin
12.5.1. Blue Ocean
Getting started with Blue Ocean
12.5.2. Locale Plugin (国际化插件)
安装Locale Plugin, 重启生效。
配置【Manage Jenkins】>【Configure System】> 【Locale】
Default Language 填写 zh_CN,勾选忽略浏览器设置强制设置语言
12.5.3. github-plugin 插件
https://github.com/jenkinsci/github-plugin
git clone https://github.com/jenkinsci/github-plugin.git mkdir target/classes
修改 rest-assured 去掉 exclusions 配置项
<dependency> <groupId>com.jayway.restassured</groupId> <artifactId>rest-assured</artifactId> <!--1.7.2 is the last version that use a compatible groovy version--> <version>1.7.2</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.apache.httpcomponents</groupId> <artifactId>*</artifactId> </exclusion> </exclusions> </dependency>
编译插件
[root@netkiller github-plugin]# mvn hpi:hpi [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building GitHub plugin 1.29.4-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-hpi-plugin:1.120:hpi (default-cli) @ github --- [INFO] Generating /srv/github-plugin/target/github/META-INF/MANIFEST.MF [INFO] Checking for attached .jar artifact ... [INFO] Generating jar /srv/github-plugin/target/github.jar [INFO] Building jar: /srv/github-plugin/target/github.jar [INFO] Exploding webapp... [INFO] Copy webapp webResources to /srv/github-plugin/target/github [INFO] Assembling webapp github in /srv/github-plugin/target/github [INFO] Generating hpi /srv/github-p