forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
179 lines (155 loc) · 6.26 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
plugins {
id 'java' // required by versioning
id 'docker-compose'
}
import com.avast.gradle.dockercompose.tasks.ComposeUp
import com.avast.gradle.dockercompose.tasks.ComposeDownForced
apply from: "../gradle/versioning/versioning.gradle"
ext {
compose_base = "profiles/docker-compose.yml"
project_name = "datahub"
backend_profile_modules = [
':docker:elasticsearch-setup',
':docker:mysql-setup',
':docker:kafka-setup',
':datahub-upgrade',
':metadata-service:war',
]
quickstart_modules = backend_profile_modules + [
':metadata-jobs:mce-consumer-job',
':metadata-jobs:mae-consumer-job',
':datahub-frontend'
]
debug_modules = quickstart_modules - [':metadata-jobs:mce-consumer-job',
':metadata-jobs:mae-consumer-job']
compose_args = ['-f', compose_base]
debug_reloadable = [
'datahub-gms-debug',
'system-update-debug',
'frontend-debug'
]
// Postgres
pg_quickstart_modules = quickstart_modules - [':docker:mysql-setup'] + [':docker:postgres-setup']
revision = 1 // increment to trigger rebuild
}
tasks.register('minDockerCompose2.20', Exec) {
executable 'bash'
args '-c', 'echo -e "$(docker compose version --short)\n2.20"|sort --version-sort --check=quiet --reverse'
}
tasks.register('quickstart') {}
tasks.register('quickstartSlim') {}
tasks.register('quickstartDebug') {}
tasks.register('quickstartPg') {}
tasks.register('quickstartStorage') {}
tasks.register('quickstartNuke') {
doFirst {
dockerCompose.quickstart.removeVolumes = true
dockerCompose.quickstartPg.removeVolumes = true
dockerCompose.quickstartSlim.removeVolumes = true
dockerCompose.quickstartDebug.removeVolumes = true
}
finalizedBy(tasks.withType(ComposeDownForced))
}
tasks.register('quickstartDown') {
finalizedBy(tasks.withType(ComposeDownForced))
}
dockerCompose {
quickstart {
isRequiredBy(tasks.named('quickstart'))
composeAdditionalArgs = ['--profile', 'quickstart-consumers']
environment.put 'DATAHUB_VERSION', "v${version}"
environment.put 'DATAHUB_TELEMETRY_ENABLED', 'false' // disabled when built locally
useComposeFiles = [compose_base]
projectName = project_name
projectNamePrefix = ''
buildBeforeUp = false
buildBeforePull = false
stopContainers = false
removeVolumes = false
captureContainersOutput = true
captureContainersOutputToFiles = project.file('build/container-logs')
}
quickstartPg {
isRequiredBy(tasks.named('quickstartPg'))
composeAdditionalArgs = ['--profile', 'quickstart-postgres']
environment.put 'DATAHUB_VERSION', "v${version}"
environment.put 'DATAHUB_TELEMETRY_ENABLED', 'false' // disabled when built locally
useComposeFiles = [compose_base]
projectName = project_name
projectNamePrefix = ''
buildBeforeUp = false
buildBeforePull = false
stopContainers = false
removeVolumes = false
}
/**
* The smallest disk footprint required for Spark integration tests
*
* No frontend, mae, mce, or other services
*/
quickstartSlim {
isRequiredBy(tasks.named('quickstartSlim'))
composeAdditionalArgs = ['--profile', 'quickstart-backend']
environment.put 'DATAHUB_VERSION', "v${version}"
environment.put "DATAHUB_ACTIONS_IMAGE", "acryldata/datahub-ingestion"
environment.put "ACTIONS_VERSION", "v${version}-slim"
environment.put "ACTIONS_EXTRA_PACKAGES", 'acryl-datahub-actions[executor] acryl-datahub-actions'
environment.put "ACTIONS_CONFIG", 'https://raw.githubusercontent.com/acryldata/datahub-actions/main/docker/config/executor.yaml'
environment.put 'DATAHUB_TELEMETRY_ENABLED', 'false' // disabled when built locally
// disabled for spark-lineage smoke-test
environment.put 'DATAHUB_LOCAL_COMMON_ENV', "${rootProject.project(':metadata-integration:java:spark-lineage-legacy').projectDir}/spark-smoke-test/smoke-gms.env"
useComposeFiles = [compose_base]
projectName = project_name
projectNamePrefix = ''
buildBeforeUp = false
buildBeforePull = false
stopContainers = false
removeVolumes = false
captureContainersOutput = true
captureContainersOutputToFiles = project.file('build/container-logs')
}
quickstartDebug {
isRequiredBy(tasks.named('quickstartDebug'))
composeAdditionalArgs = ['--profile', 'debug']
if (System.getenv().containsKey("DATAHUB_VERSION")) {
environment.put 'DATAHUB_VERSION', System.getenv("DATAHUB_VERSION")
}
environment.put 'DATAHUB_TELEMETRY_ENABLED', 'false' // disabled when built locally
useComposeFiles = [compose_base]
projectName = project_name
projectNamePrefix = ''
buildBeforeUp = false
buildBeforePull = false
stopContainers = false
removeVolumes = false
}
quickstartStorage {
isRequiredBy(tasks.named('quickstartStorage'))
composeAdditionalArgs = ['--profile', 'quickstart-storage']
useComposeFiles = [compose_base]
projectName = project_name
projectNamePrefix = ''
buildBeforeUp = false
buildBeforePull = false
stopContainers = false
removeVolumes = false
}
}
tasks.getByName('quickstartComposeUp').dependsOn(
quickstart_modules.collect { it + ':dockerTag' })
tasks.getByName('quickstartPgComposeUp').dependsOn(
pg_quickstart_modules.collect { it + ':dockerTag' })
tasks.getByName('quickstartSlimComposeUp').dependsOn(
([':docker:datahub-ingestion'] + backend_profile_modules)
.collect { it + ':dockerTag' })
tasks.getByName('quickstartDebugComposeUp').dependsOn(
debug_modules.collect { it + ':dockerTagDebug' }
)
tasks.withType(ComposeUp).configureEach {
shouldRunAfter('quickstartNuke')
dependsOn tasks.named("minDockerCompose2.20")
}
task debugReload(type: Exec) {
def cmd = ['docker compose -p datahub --profile debug'] + compose_args + ['restart'] + debug_reloadable
commandLine 'bash', '-c', cmd.join(" ")
}