Created
January 28, 2013 08:51
-
-
Save kiy0taka/4654002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.5.2' ) | |
import groovyx.net.http.HTTPBuilder | |
import static groovyx.net.http.ContentType.* | |
def jobName = 'hello2' | |
def contentXml = ''' | |
<?xml version='1.0' encoding='UTF-8'?> | |
<project> | |
<actions/> | |
<description></description> | |
<keepDependencies>false</keepDependencies> | |
<properties/> | |
<scm class="hudson.scm.NullSCM"/> | |
<canRoam>true</canRoam> | |
<disabled>false</disabled> | |
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> | |
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> | |
<triggers class="vector"/> | |
<concurrentBuild>false</concurrentBuild> | |
<builders> | |
<hudson.tasks.Shell> | |
<command>echo hello</command> | |
</hudson.tasks.Shell> | |
</builders> | |
<publishers/> | |
<buildWrappers/> | |
</project> | |
''' | |
def http = new HTTPBuilder("http://localhost:8080") | |
http.post(requestContentType:XML, path:'createItem', query:[name: jobName], body:contentXml) { res -> | |
println "Done!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment