Working on the base of the plugin some more.

This commit is contained in:
Daniel Brooks 2014-05-21 23:18:59 -07:00
parent ef545a7770
commit 3ed3da2462
9 changed files with 745 additions and 325 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ pom.xml.tag
pom.xml.releaseBackup
pom.xml.next
release.properties
work

View File

@ -4,128 +4,148 @@
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/localizer" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
<excludeFolder url="file://$MODULE_DIR$/target/classes" />
<excludeFolder url="file://$MODULE_DIR$/target/generated-sources/groovy-stubs" />
<excludeFolder url="file://$MODULE_DIR$/target/work" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.jenkins-ci.main:jenkins-core:1.532.3" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.main:remoting:2.33" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:constant-pool-scanner:1.2" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.main:cli:1.532.3" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.8" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.localizer:localizer:1.10" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:trilead-ssh2:build217-jenkins-3" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:version-number:1.1" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:crypto-util:1.1" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:1.4" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson:jtidy:4aug2000r7-dev-hudson-1" level="project" />
<orderEntry type="library" name="Maven: com.google.inject:guice:no_aop:4.0-beta" level="project" />
<orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:git:2.2.1" level="project" />
<orderEntry type="library" name="Maven: org.eclipse.jgit:org.eclipse.jgit:3.3.1.201403241930-r" level="project" />
<orderEntry type="library" name="Maven: com.jcraft:jsch:0.1.50" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.javaewah:JavaEWAH:0.7.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.1.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.2.4" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.4" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.3" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:11.0.1" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
<orderEntry type="library" name="Maven: org.jruby.ext.posix:jna-posix:1.0.3" level="project" />
<orderEntry type="library" name="Maven: com.github.jnr:jnr-posix:3.0.1" level="project" />
<orderEntry type="library" name="Maven: com.github.jnr:jnr-ffi:1.0.7" level="project" />
<orderEntry type="library" name="Maven: com.github.jnr:jffi:1.2.7" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: com.github.jnr:jffi:native:1.2.7" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm:4.0" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-commons:4.0" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-tree:4.0" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-analysis:4.0" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-util:4.0" level="project" />
<orderEntry type="library" name="Maven: com.github.jnr:jnr-x86asm:1.0.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jnr:jnr-constants:0.8.5" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke:trilead-putty-extension:1.2" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:stapler-groovy:1.223" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:stapler-jelly:1.223" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:stapler:1.223" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-discovery:commons-discovery:0.4" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.3" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:json-lib:2.4-jenkins-2" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" />
<orderEntry type="library" name="Maven: org.jvnet:tiger-types:1.3" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke:asm3:3.3.0" level="project" />
<orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.2.1" level="project" />
<orderEntry type="library" name="Maven: com.jcraft:jzlib:1.1.3" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:commons-jelly:1.1-jenkins-20120928" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:commons-jexl:1.1-jenkins-20111212" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson.dom4j:dom4j:1.6.1-hudson-3" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy-all:1.8.9" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:stapler-jrebel:1.223" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke:windows-package-checker:1.0" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:stapler-adjunct-zeroclipboard:1.1.7-1" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:stapler-adjunct-timeline:1.4" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.stapler:stapler-adjunct-codemirror:1.2" level="project" />
<orderEntry type="library" name="Maven: com.infradna.tool:bridge-method-annotation:1.8" level="project" />
<orderEntry type="library" name="Maven: com.infradna.tool:bridge-method-annotation:1.12" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:annotation-indexer:1.7" level="project" />
<orderEntry type="library" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
<orderEntry type="library" name="Maven: args4j:args4j:2.0.23" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:bytecode-compatibility-transformer:1.4" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson:task-reactor:1.2" level="project" />
<orderEntry type="library" name="Maven: antlr:antlr:2.7.6" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson:xstream:1.4.4-jenkins-5" level="project" />
<orderEntry type="library" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
<orderEntry type="library" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
<orderEntry type="library" name="Maven: jfree:jfreechart:1.0.9" level="project" />
<orderEntry type="library" name="Maven: jfree:jcommon:1.0.12" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant:1.8.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant-launcher:1.8.3" level="project" />
<orderEntry type="library" name="Maven: commons-digester:commons-digester:2.1" level="project" />
<orderEntry type="library" name="Maven: javax.mail:mail:1.4.4" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson:activation:1.1.1-hudson-1" level="project" />
<orderEntry type="library" name="Maven: jaxen:jaxen:1.1-beta-11" level="project" />
<orderEntry type="library" name="Maven: commons-jelly:commons-jelly-tags-fmt:1.0" level="project" />
<orderEntry type="library" name="Maven: commons-jelly:commons-jelly-tags-xml:1.1" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hudson:commons-jelly-tags-define:1.0.1-hudson-20071021" level="project" />
<orderEntry type="library" name="Maven: org.acegisecurity:acegi-security:1.0.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:2.5.6.SEC03" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:1.2.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:2.5.6.SEC03" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-dao:1.2.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:2.5.6.SEC03" level="project" />
<orderEntry type="library" name="Maven: oro:oro:2.0.8" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: log4j:log4j:1.2.9" level="project" />
<orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.11" level="project" />
<orderEntry type="library" name="Maven: org.fusesource.jansi:jansi:1.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:2.5.6.SEC03" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:2.5.6.SEC03" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:2.5.6.SEC03" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:2.5.6.SEC03" level="project" />
<orderEntry type="library" name="Maven: xpp3:xpp3:1.1.4c" level="project" />
<orderEntry type="library" name="Maven: javax.servlet:jstl:1.1.0" level="project" />
<orderEntry type="library" name="Maven: com.sun.xml.txw2:txw2:20110809" level="project" />
<orderEntry type="library" name="Maven: javax.xml.stream:stax-api:1.0-2" level="project" />
<orderEntry type="library" name="Maven: relaxngDatatype:relaxngDatatype:20020414" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.winp:winp:1.16" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:memory-monitor:1.7" level="project" />
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:3.3.0-jenkins-3" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.woodstox:wstx-asl:3.2.9" level="project" />
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:jmdns:3.4.0-jenkins-3" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke:akuma:1.9" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke:libpam4j:1.6" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.libzfs:libzfs:0.5" level="project" />
<orderEntry type="library" name="Maven: com.sun.solaris:embedded_su4j:1.1" level="project" />
<orderEntry type="library" name="Maven: net.java.sezpoz:sezpoz:1.9" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:jinterop-wmi:1.1" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.jinterop:jinterop-proxy:1.1" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.jinterop:j-interop:2.0.6-kohsuke-1" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke.jinterop:j-interopdeps:2.0.6-kohsuke-1" level="project" />
<orderEntry type="library" name="Maven: org.samba.jcifs:jcifs:1.3.14-kohsuke-1" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci:windows-remote-command:1.3" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.robust-http-client:robust-http-client:1.2" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke:access-modifier-annotation:1.4" level="project" />
<orderEntry type="library" name="Maven: org.kohsuke:owasp-html-sanitizer:r88" level="project" />
<orderEntry type="library" name="Maven: org.mindrot:jbcrypt:0.3m" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:git-client:1.8.0" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:ssh-credentials:1.6.1" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:credentials:1.10" level="project" />
<orderEntry type="library" name="Maven: net.jcip:jcip-annotations:1.0" level="project" />
<orderEntry type="library" name="Maven: com.github.stephenc.findbugs:findbugs-annotations:1.3.9-1" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:scm-api:0.2" level="project" />
<orderEntry type="library" name="Maven: org.jenkins-ci.plugins:multiple-scms:0.2" level="project" />
<orderEntry type="library" name="Maven: findbugs:annotations:1.0.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.9.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jenkins-ci.main:jenkins-war:war:1.532.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci.main:jenkins-core:1.532.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci.main:remoting:2.33" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:constant-pool-scanner:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci.main:cli:1.532.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.localizer:localizer:1.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:trilead-ssh2:build217-jenkins-3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:version-number:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:crypto-util:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-io:commons-io:1.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:jtidy:4aug2000r7-dev-hudson-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.inject:guice:no_aop:4.0-beta" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jruby.ext.posix:jna-posix:1.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.jnr:jnr-posix:3.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.jnr:jnr-ffi:1.0.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.jnr:jffi:1.2.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.jnr:jffi:native:1.2.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm:4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-commons:4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-tree:4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-analysis:4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.ow2.asm:asm-util:4.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.jnr:jnr-x86asm:1.0.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.jnr:jnr-constants:0.8.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke:trilead-putty-extension:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:stapler-groovy:1.223" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:stapler-jelly:1.223" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:stapler:1.223" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-discovery:commons-discovery:0.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:json-lib:2.4-jenkins-2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.ezmorph:ezmorph:1.0.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet:tiger-types:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke:asm3:3.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-fileupload:commons-fileupload:1.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.jcraft:jzlib:1.1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:commons-jelly:1.1-jenkins-20120928" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:commons-jexl:1.1-jenkins-20111212" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson.dom4j:dom4j:1.6.1-hudson-3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.groovy:groovy-all:1.8.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:stapler-jrebel:1.223" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke:windows-package-checker:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:stapler-adjunct-zeroclipboard:1.1.7-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:stapler-adjunct-timeline:1.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:stapler-adjunct-codemirror:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: args4j:args4j:2.0.23" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:bytecode-compatibility-transformer:1.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:task-reactor:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: antlr:antlr:2.7.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:xstream:1.4.4-jenkins-5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: xmlpull:xmlpull:1.1.3.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: xpp3:xpp3_min:1.1.4c" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: jfree:jfreechart:1.0.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: jfree:jcommon:1.0.12" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.ant:ant:1.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.ant:ant-launcher:1.8.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-digester:commons-digester:2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.mail:mail:1.4.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:activation:1.1.1-hudson-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: jaxen:jaxen:1.1-beta-11" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-jelly:commons-jelly-tags-fmt:1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-jelly:commons-jelly-tags-xml:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:commons-jelly-tags-define:1.0.1-hudson-20071021" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.acegisecurity:acegi-security:1.0.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-core:2.5.6.SEC03" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-jdbc:1.2.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-beans:2.5.6.SEC03" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-dao:1.2.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-context:2.5.6.SEC03" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: oro:oro:2.0.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: log4j:log4j:1.2.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: jline:jline:0.9.94" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.fusesource.jansi:jansi:1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-webmvc:2.5.6.SEC03" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-context-support:2.5.6.SEC03" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-web:2.5.6.SEC03" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework:spring-aop:2.5.6.SEC03" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: xpp3:xpp3:1.1.4c" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:jstl:1.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sun.xml.txw2:txw2:20110809" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.xml.stream:stax-api:1.0-2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: relaxngDatatype:relaxngDatatype:20020414" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.winp:winp:1.16" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:memory-monitor:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.dev.jna:jna:3.3.0-jenkins-3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.codehaus.woodstox:wstx-asl:3.2.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: stax:stax-api:1.0.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:jmdns:3.4.0-jenkins-3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke:akuma:1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke:libpam4j:1.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.libzfs:libzfs:0.5" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sun.solaris:embedded_su4j:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.java.sezpoz:sezpoz:1.9" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:jinterop-wmi:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.jinterop:jinterop-proxy:1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.jinterop:j-interop:2.0.6-kohsuke-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.jinterop:j-interopdeps:2.0.6-kohsuke-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.samba.jcifs:jcifs:1.3.14-kohsuke-1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:windows-remote-command:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.robust-http-client:robust-http-client:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke:access-modifier-annotation:1.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke:owasp-html-sanitizer:r88" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.mindrot:jbcrypt:0.3m" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jenkins-ci.main:jenkins-test-harness:1.532.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jenkins-ci.main:jenkins-war:war-for-test:1.532.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jenkins-ci.modules:instance-identity:1.3" level="project" />
@ -180,13 +200,10 @@
<orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http:2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-http-shared4:2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jsoup:jsoup:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpclient:4.2.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpcore:4.2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-file:2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-ftp:2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: commons-net:commons-net:3.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-ssh:2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jcraft:jsch:0.1.44-1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-ssh-common:2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.codehaus.plexus:plexus-interactivity-api:1.0-alpha-6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.maven.wagon:wagon-ssh-external:2.4" level="project" />
@ -210,7 +227,6 @@
<orderEntry type="library" scope="TEST" name="Maven: org.jvnet.hudson:test-annotations:1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jvnet.mock-javamail:mock-javamail:1.7" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jenkins-ci:htmlunit:2.6-jenkins-6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: xalan:xalan:2.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: xalan:serializer:2.7.1" level="project" />
@ -224,7 +240,6 @@
<orderEntry type="library" scope="TEST" name="Maven: org.jvnet.hudson:netx:0.5-hudson-2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.easymock:easymock:2.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.netbeans.modules:org-netbeans-insane:RELEASE72" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.github.stephenc.findbugs:findbugs-annotations:1.3.9-1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.codehaus.geb:geb-implicit-assertions:0.7.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jenkins-ci.main:ui-samples-plugin:1.532.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:servlet-api:2.4" level="project" />

71
pom.xml
View File

@ -1,22 +1,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>1.532.3</version>
</dependency>
</dependencies>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.532.3</version><!-- which version of Jenkins is this plugin built against? Users must have at least this Jenkins version to use this plugin. -->
</parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.532.3</version><!-- which version of Jenkins is this plugin built against? Users must have at least this Jenkins version to use this plugin. -->
</parent>
<groupId>com.dabsquared</groupId>
<artifactId>gitlab-jenkins</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>hpi</packaging>
<name>GitLab Plugin</name>
<url>http://wiki.jenkins-ci.org/display/JENKINS/Gitlab+Plugin</url>
<licenses>
<license>
@ -25,12 +20,30 @@
</license>
</licenses>
<developers>
<developer>
<id>bass_rock</id>
<name>Daniel Brooks</name>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/DABSquared/gitlab-jenkins-plugin.git</connection>
<developerConnection>scm:git:git@github.com:DABSquared/gitlab-jenkins-plugin.git</developerConnection>
<url>https://github.com/DABSquared/gitlab-jenkins-plugin</url>
</scm>
<!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
<repository>
<id>jgit-repository</id>
<name>Eclipse JGit Repository</name>
<url>http://download.eclipse.org/jgit/maven</url>
</repository>
</repositories>
<pluginRepositories>
@ -40,4 +53,32 @@
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>multiple-scms</artifactId>
<version>0.2</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,38 +0,0 @@
package com.dabsquared.gitlabjenkins;
import hudson.triggers.SCMTrigger;
import java.io.File;
import java.io.IOException;
/**
* UI object that says a build is started by GitHub post-commit hook.
*
* @author Daniel Brooks
*/
public class GitLabPushCause extends SCMTrigger.SCMTriggerCause {
/**
* The name of the user who pushed to GitHub.
*/
private String pushedBy;
public GitLabPushCause(String pusher) {
this("", pusher);
}
public GitLabPushCause(String pollingLog, String pusher) {
super(pollingLog);
pushedBy = pusher;
}
public GitLabPushCause(File pollingLog, String pusher) throws IOException {
super(pollingLog);
pushedBy = pusher;
}
@Override
public String getShortDescription() {
String pusher = pushedBy != null ? pushedBy : "";
return "Started by GitLab push by " + pusher;
}
}

View File

@ -0,0 +1,304 @@
package com.dabsquared.gitlabjenkins;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.util.JavaIdentifierTransformer;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Represents for WebHook payload
*
* @author Daniel Brooks
*/
public class GitLabPushRequest {
private User pusher;
private String ref;
private List<Commit> commits;
private Repository repository;
public static GitLabPushRequest create(String payload) {
if (payload == null) {
throw new IllegalArgumentException("payload should not be null");
}
return create(JSONObject.fromObject(payload));
}
public static GitLabPushRequest create(JSONObject payload) {
if (payload == null || payload.isNullObject()) {
throw new IllegalArgumentException("payload should not be null");
}
JsonConfig config = createJsonConfig();
return (GitLabPushRequest) JSONObject.toBean(payload, config);
}
private static JsonConfig createJsonConfig() {
JsonConfig config = new JsonConfig();
config.setRootClass(GitLabPushRequest.class);
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
classMap.put("commits", Commit.class);
classMap.put("added", String.class);
classMap.put("removed", String.class);
classMap.put("modified", String.class);
config.setClassMap(classMap);
config.setJavaIdentifierTransformer(new JavaIdentifierTransformer() {
@Override
public String transformToJavaIdentifier(String param) {
if (param == null) {
return null;
}
if ("private".equals(param)) {
return "private_";
}
return param;
}
});
return config;
}
public GitLabPushRequest() {
}
public User getPusher() {
return pusher;
}
public void setPusher(User pusher) {
this.pusher = pusher;
}
public String getRef() {
return ref;
}
public void setRef(String ref) {
this.ref = ref;
}
public List<Commit> getCommits() {
return commits;
}
public Commit getLastCommit() {
if (commits.isEmpty()) {
return null;
}
return commits.get(commits.size() - 1);
}
public void setCommits(List<Commit> commits) {
this.commits = commits;
}
public Repository getRepository() {
return repository;
}
public void setRepository(Repository repository) {
this.repository = repository;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static class Repository {
private String name;
private String url;
private String description;
private Integer forks;
private boolean private_;
private User owner;
public Repository() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getForks() {
return forks;
}
public void setForks(Integer forks) {
this.forks = forks;
}
public boolean isPrivate_() {
return private_;
}
public void setPrivate_(boolean private_) {
this.private_ = private_;
}
public User getOwner() {
return owner;
}
public void setOwner(User owner) {
this.owner = owner;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class Commit {
private String id;
private String message;
private String timestamp;
private String url;
private List<String> added;
private List<String> removed;
private List<String> modified;
public Commit() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public List<String> getAdded() {
return added;
}
public void setAdded(List<String> added) {
this.added = added;
}
public List<String> getRemoved() {
return removed;
}
public void setRemoved(List<String> removed) {
this.removed = removed;
}
public List<String> getModified() {
return modified;
}
public void setModified(List<String> modified) {
this.modified = modified;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
public static class User {
private String name;
private String email;
public User() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
}

View File

@ -5,141 +5,191 @@ import hudson.Util;
import hudson.console.AnnotatedLargeText;
import hudson.model.AbstractProject;
import hudson.model.Action;
import hudson.model.Hudson;
import hudson.model.Item;
import hudson.plugins.git.RevisionParameterAction;
import hudson.triggers.SCMTrigger;
import hudson.triggers.SCMTrigger.SCMTriggerCause;
import hudson.triggers.Trigger;
import hudson.triggers.TriggerDescriptor;
import hudson.util.SequentialExecutionQueue;
import hudson.util.StreamTaskListener;
import net.sf.json.JSONObject;
import org.apache.commons.jelly.XMLOutput;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import sun.misc.Cleaner;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import org.kohsuke.stapler.DataBoundConstructor;
import jenkins.model.Jenkins.MasterComputer;
import org.apache.commons.jelly.XMLOutput;
import com.dabsquared.gitlabjenkins.GitLabPushRequest.Commit;
/**
* Triggers a build when we receive a GitHub post-commit webhook.
* Triggers a build when we receive a GitLab WebHook.
*
* @author Daniel Brooks
*/
public class GitLabPushTrigger extends Trigger<AbstractProject<?,?>> implements GitLabTrigger {
public class GitLabPushTrigger extends Trigger<AbstractProject<?, ?>> {
@DataBoundConstructor
public GitLabPushTrigger() {
}
/**
* Called when a POST is made.
*/
@Deprecated
public void onPost() {
onPost("");
}
/**
* Called when a POST is made.
*/
public void onPost(String triggeredByUser) {
final String pushBy = triggeredByUser;
public void onPost(final GitLabPushRequest req) {
getDescriptor().queue.execute(new Runnable() {
private boolean runPolling() {
private boolean polling() {
try {
StreamTaskListener listener = new StreamTaskListener(getLogFile());
try {
PrintStream logger = listener.getLogger();
long start = System.currentTimeMillis();
logger.println("Started on "+ DateFormat.getDateTimeInstance().format(new Date()));
logger.println("Started on " + DateFormat.getDateTimeInstance().format(new Date()));
boolean result = job.poll(listener).hasChanges();
logger.println("Done. Took "+ Util.getTimeSpanString(System.currentTimeMillis() - start));
if(result)
logger.println("Done. Took " + Util.getTimeSpanString(System.currentTimeMillis() - start));
if (result) {
logger.println("Changes found");
else
} else {
logger.println("No changes");
}
return result;
} catch (Error e) {
e.printStackTrace(listener.error("Failed to record SCM polling"));
LOGGER.log(Level.SEVERE,"Failed to record SCM polling",e);
LOGGER.log(Level.SEVERE, "Failed to record SCM polling", e);
throw e;
} catch (RuntimeException e) {
e.printStackTrace(listener.error("Failed to record SCM polling"));
LOGGER.log(Level.SEVERE,"Failed to record SCM polling",e);
LOGGER.log(Level.SEVERE, "Failed to record SCM polling", e);
throw e;
} finally {
listener.close();
listener.closeQuietly();
}
} catch (IOException e) {
LOGGER.log(Level.SEVERE,"Failed to record SCM polling",e);
LOGGER.log(Level.SEVERE, "Failed to record SCM polling", e);
}
return false;
}
public void run() {
if (runPolling()) {
String name = " #"+job.getNextBuildNumber();
GitLabPushCause cause;
try {
cause = new GitLabPushCause(getLogFile(), pushBy);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to parse the polling log",e);
cause = new GitLabPushCause(pushBy);
}
if (job.scheduleBuild(cause)) {
LOGGER.info("SCM changes detected in "+ job.getName()+". Triggering "+name);
LOGGER.log(Level.INFO, "{0} triggered.", job.getName());
if (polling()) {
String name = " #" + job.getNextBuildNumber();
GitLabPushCause cause = createGitLabPushCause(req);
if (job.scheduleBuild(job.getQuietPeriod(), cause)) {
LOGGER.log(Level.INFO, "SCM changes detected in {0}. Triggering {1}", new String[]{job.getName(), name});
} else {
LOGGER.info("SCM changes detected in "+ job.getName()+". Job is already in the queue");
LOGGER.log(Level.INFO, "SCM changes detected in {0}. Job is already in the queue.", job.getName());
}
}
}
private GitLabPushCause createGitLabPushCause(GitLabPushRequest req) {
GitLabPushCause cause;
String triggeredByUser = req.getPusher().getName();
try {
cause = new GitLabPushCause(triggeredByUser, getLogFile());
} catch (IOException ex) {
cause = new GitLabPushCause(triggeredByUser);
}
return cause;
}
});
}
/**
* Returns the file that records the last/current polling activity.
*/
public File getLogFile() {
return new File(job.getRootDir(),"gitlab-polling.log");
}
@Override
public void start(AbstractProject<?,?> project, boolean newInstance) {
super.start(project, newInstance);
if (newInstance) {
}
public Collection<? extends Action> getProjectActions() {
return Collections.singletonList(new GitLabWebHookPollingAction());
}
@Override
public void stop() {
}
@Override
public DescriptorImpl getDescriptor() {
return (DescriptorImpl)super.getDescriptor();
return DescriptorImpl.get();
}
public File getLogFile() {
return new File(job.getRootDir(), "gitlab-polling.log");
}
private static final Logger LOGGER = Logger.getLogger(GitLabPushTrigger.class.getName());
public class GitLabWebHookPollingAction implements Action {
public AbstractProject<?, ?> getOwner() {
return job;
}
public String getIconFileName() {
return "/plugin/gitlab/images/24x24/gitlab-log.png";
}
public String getDisplayName() {
return "GitLab Hook Log";
}
public String getUrlName() {
return "GitLabPollLog";
}
public String getLog() throws IOException {
return Util.loadFile(getLogFile());
}
public void writeLogTo(XMLOutput out) throws IOException {
new AnnotatedLargeText<GitLabWebHookPollingAction>(
getLogFile(), Charset.defaultCharset(), true, this).writeHtmlTo(0, out.asWriter());
}
}
public static class GitLabPushCause extends SCMTriggerCause {
private final String pushedBy;
public GitLabPushCause(String pushedBy) {
this.pushedBy = pushedBy;
}
public GitLabPushCause(String pushedBy, File logFile) throws IOException {
super(logFile);
this.pushedBy = pushedBy;
}
public GitLabPushCause(String pushedBy, String pollingLog) {
super(pollingLog);
this.pushedBy = pushedBy;
}
@Override
public String getShortDescription() {
if (pushedBy == null) {
return "Started by GitLab push";
} else {
return String.format("Started by GitLab push by %s", pushedBy);
}
}
}
@Extension
public static class DescriptorImpl extends TriggerDescriptor {
private transient final SequentialExecutionQueue queue = new SequentialExecutionQueue(Hudson.MasterComputer.threadPoolForRemoting);
private String hookUrl;
public DescriptorImpl() {
load();
}
private transient final SequentialExecutionQueue queue = new SequentialExecutionQueue(Jenkins.MasterComputer.threadPoolForRemoting);
@Override
public boolean isApplicable(Item item) {
@ -151,44 +201,9 @@ public class GitLabPushTrigger extends Trigger<AbstractProject<?,?>> implements
return "Build when a change is pushed to GitLab";
}
/**
* Returns the URL that GitLab should post.
*/
public URL getHookUrl() throws MalformedURLException {
return hookUrl!=null ? new URL(hookUrl) : new URL(Hudson.getInstance().getRootUrl()+GitLabWebHook.get().getUrlName()+'/');
}
public boolean hasOverrideURL() {
return hookUrl!=null;
}
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
JSONObject hookMode = json.getJSONObject("hookMode");
JSONObject o = hookMode.getJSONObject("c");
if (o!=null && !o.isNullObject()) {
hookUrl = o.getString("url");
} else {
hookUrl = null;
}
save();
return true;
}
public static DescriptorImpl get() {
return Trigger.all().get(DescriptorImpl.class);
}
public static boolean allowsHookUrlOverride() {
return ALLOW_HOOKURL_OVERRIDE;
}
}
/**
* Set to false to prevent the user from overriding the hook URL.
*/
public static boolean ALLOW_HOOKURL_OVERRIDE = !Boolean.getBoolean(GitLabPushTrigger.class.getName()+".disableOverride");
private static final Logger LOGGER = Logger.getLogger(GitLabPushTrigger.class.getName());
}

View File

@ -1,10 +1,26 @@
package com.dabsquared.gitlabjenkins;
import hudson.Extension;
import hudson.ExtensionPoint;
import hudson.model.AbstractProject;
import hudson.model.Hudson;
import hudson.model.RootAction;
import hudson.model.UnprotectedRootAction;
import hudson.security.ACL;
import hudson.security.csrf.CrumbExclusion;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
import org.acegisecurity.Authentication;
import org.acegisecurity.context.SecurityContextHolder;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.interceptor.RequirePOST;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
@ -12,6 +28,10 @@ import java.util.logging.Logger;
* @author Daniel Brooks
*/
public class GitLabWebHook implements UnprotectedRootAction {
public static final String WEBHOOK_URL = "gitlab-webhook";
public String getIconFileName() {
return null;
}
@ -21,32 +41,74 @@ public class GitLabWebHook implements UnprotectedRootAction {
}
public String getUrlName() {
return "/projects/";
return WEBHOOK_URL;
}
@RequirePOST
public void doIndex(StaplerRequest req) {
LOGGER.log(Level.FINE, "WebHook called.");
String payload = req.getParameter("payload");
if (payload == null) {
throw new IllegalArgumentException(
"Not intended to be browsed interactively (must specify payload parameter)");
}
//processPayload(payload);
}
private void processPayload(String payload) {
JSONObject json = JSONObject.fromObject(payload);
LOGGER.log(Level.FINE, "payload: {0}", json.toString(4));
GitLabPushRequest req = GitLabPushRequest.create(json);
String repositoryUrl = req.getRepository().getUrl();
if (repositoryUrl == null) {
LOGGER.log(Level.WARNING, "No repository url found.");
return;
}
Authentication old = SecurityContextHolder.getContext().getAuthentication();
SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);
try {
for (AbstractProject<?, ?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
GitLabPushTrigger trigger = job.getTrigger(GitLabPushTrigger.class);
if (trigger == null) {
continue;
}
//if (RepositoryUrlCollector.collect(job).contains(repositoryUrl.toLowerCase())) {
trigger.onPost(req);
//}
}
} finally {
SecurityContextHolder.getContext().setAuthentication(old);
}
}
@Extension
public static class GitLabWebHookCrumbExclusion extends CrumbExclusion {
@Override
public boolean process(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException {
String pathInfo = req.getPathInfo();
LOGGER.log(Level.FINE, "path: {0}", pathInfo);
if (pathInfo != null && pathInfo.equals(getExclusionPath())) {
chain.doFilter(req, resp);
return true;
}
return false;
}
private String getExclusionPath() {
return '/' + WEBHOOK_URL + '/';
}
}
private static final Logger LOGGER = Logger.getLogger(GitLabWebHook.class.getName());
public static GitLabWebHook get() {
return Hudson.getInstance().getExtensionList(RootAction.class).get(GitLabWebHook.class);
}
/**
* Other plugins may be interested in listening for these updates.
*
* @since 1.8
*/
public static abstract class Listener implements ExtensionPoint {
/**
* Called when there is a change notification on a specific repository.
*
* @param pusherName the pusher name.
* @param changedRepository the changed repository.
* @since 1.8
*/
public abstract void onPushRepositoryChanged(String pusherName, String changedRepository);
}
}

View File

@ -1,24 +0,0 @@
package com.dabsquared.gitlabjenkins;
import hudson.Extension;
import hudson.Util;
import hudson.model.AbstractProject;
import java.util.Collection;
import java.util.Set;
/**
* Optional interface that can be implemented by {@link hudson.triggers.Trigger} that watches out for a change in GitHub
* and triggers a build.
*
* @author Daniel Brooks
*/
public interface GitLabTrigger {
@Deprecated
public void onPost();
// TODO: document me
public void onPost(String triggeredByUser);
}

View File

@ -0,0 +1,44 @@
<!--
The MIT License
Copyright (c) 2014, Daniel Brooks
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<l:layout>
<st:include it="${it.owner}" page="sidepanel.jelly" />
<l:main-panel>
<h1>${%Last GitLab Push}</h1>
<j:set var="log" value="${it.log}" />
<j:choose>
<j:when test="${empty(log)}">
${%Polling has not run yet.}
</j:when>
<j:otherwise>
<pre>
<st:getOutput var="output" />
<j:whitespace>${it.writeLogTo(output)}</j:whitespace>
</pre>
</j:otherwise>
</j:choose>
</l:main-panel>
</l:layout>
</j:jelly>