-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
87 lines (65 loc) · 2.15 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
82
83
84
85
86
plugins {
id 'docker-compose'
id 'java'
id 'distribution'
}
version "1.0"
def dashboardSourceLocation = "$buildDir/dashboards"
def dashboardOutput = "$dashboardSourceLocation/com/thelastpickle/dashboards"
task startDependencies(type:Exec) {
group = "dashboard"
description = "Start Cassandra and wait for it to be up"
environment "DASHBOARD_DIR", dashboardOutput
environment "BUILD_DIR", dashboardOutput
commandLine "docker-compose", "--compatibility", "run", "start_dependencies"
}
task preview(type:Exec) {
group = "dashboard"
description = "Start the dashboard dev environment"
commandLine "docker-compose", "--compatibility", "up"
environment "DASHBOARD_DIR", dashboardOutput
environment "BUILD_DIR", dashboardOutput
dependsOn startDependencies
}
task stopPreview(type:Exec) {
group = "dashboard"
description = "Stops the docker compose environment"
environment "DASHBOARD_DIR", dashboardOutput
environment "BUILD_DIR", dashboardOutput
commandLine "docker-compose", "stop"
}
task generateDashboards(type: Exec) {
commandLine "docker-compose", "up", "--exit-code-from", "grafonnet", "grafonnet"
dependsOn(":docker-grafonnet:buildDocker")
standardOutput = new ByteArrayOutputStream()
errorOutput = new ByteArrayOutputStream()
group = "dashboard"
description = "Regenerate the Grafana Dashboards using Docker."
inputs.files(project.fileTree(dir: "dashboards"))
outputs.dir(dashboardOutput)
.withPropertyName("dashboards")
environment "BUILD_DIR", dashboardOutput
environment "DASHBOARD_DIR", dashboardOutput
ignoreExitValue true
doLast {
logger.info(standardOutput.toString())
logger.error(errorOutput.toString())
if (execResult.getExitValue() != 0) {
print(standardOutput)
throw new GradleScriptException("non zero exit code")
}
}
}
sourceSets {
main {
output.dir(dashboardSourceLocation , builtBy: 'generateDashboards')
}
}
distributions {
main {
baseName = "tlp-dashboards"
contents {
from dashboardOutput
}
}
}