-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
executable file
·81 lines (73 loc) · 2.24 KB
/
build.gradle
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
77
78
79
80
81
import org.apache.tools.ant.filters.ReplaceTokens
project.ext {
packer = 'packer'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
task processResources(type: Copy) {
from('unattended') {
include '**/*.xml'
include '**/*.cfg'
into "unattended"
}
from('packerfiles') {
include '**/*.hcl'
include '**/*.ps1'
include '**/*.sh'
into 'packerfiles'
}
filter(ReplaceTokens, tokens: [
'username': username,
'password': password,
'rootpassword': rootpassword
])
into(buildDir)
}
task buildWindowsBase(type:Exec) {
println "Task buildWindowsBase"
workingDir = buildDir
executable = project.ext.packer
args = ["build",
"-var-file=./packerfiles/iso/$configFile",
"-var-file=./packerfiles/variables.pkrvars.hcl",
"./packerfiles/windows_1_base.pkr.hcl" ]
commandLine
}
task buildWindowsUpdates(type:Exec, dependsOn: "buildWindowsBase") {
println "Task buildWindowsUpdates"
workingDir = buildDir
executable = project.ext.packer
args = ["build",
"-var-file=./packerfiles/iso/$configFile",
"-var-file=./packerfiles/variables.pkrvars.hcl",
"./packerfiles/windows_2_updates.pkr.hcl"]
commandLine
}
task buildWindowsPackages(type:Exec, dependsOn: "buildWindowsUpdates") {
println "Task buildWindowsPackages"
workingDir = buildDir
executable = project.ext.packer
args = ["build",
"-var-file=./packerfiles/iso/$configFile",
"-var-file=./packerfiles/variables.pkrvars.hcl",
"./packerfiles/windows_3_package.pkr.hcl" ]
commandLine
}
task buildWindows() {
println 'Task buildWindows'
dependsOn 'processResources'
dependsOn 'buildWindowsPackages'
tasks.findByName('buildWindowsPackages').mustRunAfter 'processResources'
}
task buildLinux(type:Exec) {
dependsOn 'processResources'
workingDir = buildDir
executable = project.ext.packer
println "Building Linux $configFile at $workingDir"
args = ["build",
"-var-file=./packerfiles/iso/$configFile",
"-var-file=./packerfiles/variables.pkrvars.hcl",
"./packerfiles/linux.pkr.hcl" ]
commandLine
}