forked from sheehan/job-dsl-gradle-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BootstrapJobs.ps1
76 lines (73 loc) · 2.78 KB
/
BootstrapJobs.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$cliJarPath = '~/Downloads/jenkins-cli.jar'
Invoke-WebRequest `
-Uri 'http://localhost:8080/jnlpJars/jenkins-cli.jar' `
-OutFile $cliJarPath `
-Verbose
$jobDefinition = @"
<?xml version='1.1' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>file:////Users/ben/work/vibrato/job-dsl-gradle-example</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions/>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.plugins.gradle.Gradle plugin="[email protected]">
<switches></switches>
<tasks>libs</tasks>
<rootBuildScriptDir></rootBuildScriptDir>
<buildFile></buildFile>
<gradleName>(Default)</gradleName>
<useWrapper>true</useWrapper>
<makeExecutable>false</makeExecutable>
<useWorkspaceAsHome>false</useWorkspaceAsHome>
<wrapperLocation></wrapperLocation>
<passAllAsSystemProperties>false</passAllAsSystemProperties>
<projectProperties></projectProperties>
<passAllAsProjectProperties>false</passAllAsProjectProperties>
</hudson.plugins.gradle.Gradle>
<javaposse.jobdsl.plugin.ExecuteDslScripts plugin="[email protected]">
<targets>jobs/*.groovy</targets>
<usingScriptText>false</usingScriptText>
<sandbox>false</sandbox>
<ignoreExisting>false</ignoreExisting>
<ignoreMissingFiles>false</ignoreMissingFiles>
<failOnMissingPlugin>true</failOnMissingPlugin>
<unstableOnDeprecation>false</unstableOnDeprecation>
<removedJobAction>DELETE</removedJobAction>
<removedViewAction>DELETE</removedViewAction>
<removedConfigFilesAction>DELETE</removedConfigFilesAction>
<lookupStrategy>JENKINS_ROOT</lookupStrategy>
<additionalClasspath>src/main/groovy
lib/*.jar</additionalClasspath>
</javaposse.jobdsl.plugin.ExecuteDslScripts>
</builders>
<publishers/>
<buildWrappers/>
</project>
"@
$jobDefinition | java -jar $cliJarPath `
-s 'http://localhost:8080' `
-auth 'admin:admin' `
create-job 'seed_job'