-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Expand file tree
/
Copy pathsettings.gradle
More file actions
280 lines (265 loc) · 12.6 KB
/
Copy pathsettings.gradle
File metadata and controls
280 lines (265 loc) · 12.6 KB
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
apply from: 'gradle/validation/url-validation.gradle'
// Resolve Maven repository URLs: legacy single-word properties take precedence for backward
// compatibility, then the new namespaced properties (whose defaults live in gradle.properties).
// Stored in gradle.ext so they're available to buildSrc's buildscript phase, which runs before root
// project properties propagate (buildSrc is a separate standalone build).
def mavenCentralUrl = hasProperty('apacheMavenRepositoryUrl') ? getProperty('apacheMavenRepositoryUrl') :
hasProperty('mavenCentralRepositoryUrl') ? getProperty('mavenCentralRepositoryUrl') :
getProperty('datahub.dependencies.maven.central')
def confluentUrl = hasProperty('confluentMavenRepositoryUrl') ? getProperty('confluentMavenRepositoryUrl') : getProperty('datahub.dependencies.maven.confluent')
def linkedinUrl = hasProperty('linkedinOpenSourceRepositoryUrl') ? getProperty('linkedinOpenSourceRepositoryUrl') : getProperty('datahub.dependencies.maven.linkedinOpenSource')
// node-gradle plugin resolves Node.js binaries from an Ivy repository; Legacy nodeDistBaseUrl takes precedence for
// backward compatibility, then the new namespaced property (default lives in gradle.properties).
def nodeDistUrl = hasProperty('nodeDistBaseUrl') ? getProperty('nodeDistBaseUrl') : getProperty('datahub.dependencies.node.distBaseUrl')
def apkRepoUrl = getProperty('datahub.dependencies.apkrepo.url')
def githubBaseUrl = hasProperty('githubMirrorUrl') ? getProperty('githubMirrorUrl') : getProperty('datahub.dependencies.github.baseURL')
def pipMirrorUrl = hasProperty('pipMirrorUrl') ? getProperty('pipMirrorUrl') : getProperty('datahub.dependencies.python.pipMirrorUrl')
def pipExtraIndexUrl = hasProperty('pipExtraIndexUrls') ? getProperty('pipExtraIndexUrls') : getProperty('datahub.dependencies.python.pipExtraIndexUrl')
// UV profile resolution (shared by gradle/python/python-uv.gradle and
// gradle/docker/python-docker.gradle). Precedence (highest first):
// 1. CLI -P (explicit) — startParameter.projectProperties is CLI-only, so it
// excludes gradle.properties defaults and ORG_GRADLE_PROJECT_*.
// 2. UV_DOCKER_PROFILE / UV_INSTALL_PROFILE env var (e.g. from mise / shell).
// 3. gradle.properties default — getProperty also picks up ORG_GRADLE_PROJECT_*.
def cliProps = gradle.startParameter.projectProperties
def resolveProfile = { String name, String envVar ->
cliProps[name] ?: System.getenv(envVar) ?: getProperty(name)
}
def uvDockerProfile = resolveProfile('datahub.dependencies.python.uvDockerProfile', 'UV_DOCKER_PROFILE')
def uvInstallProfile = resolveProfile('datahub.dependencies.python.uvInstallProfile', 'UV_INSTALL_PROFILE')
// Validate all URL overrides before storing — catches typos and blocks non-http(s) values.
def validate = gradle.ext.validateUrl
def validateMultiple = gradle.ext.validateUrls
validate(mavenCentralUrl)
validate(confluentUrl)
validate(linkedinUrl)
validate(nodeDistUrl)
validate(apkRepoUrl)
validate(githubBaseUrl)
validate(pipMirrorUrl)
validateMultiple(pipExtraIndexUrl)
gradle.ext['datahub.dependencies.maven.central'] = mavenCentralUrl
gradle.ext['datahub.dependencies.maven.confluent'] = confluentUrl
gradle.ext['datahub.dependencies.maven.linkedinOpenSource'] = linkedinUrl
gradle.ext['datahub.dependencies.node.distBaseUrl'] = nodeDistUrl
gradle.ext['datahub.dependencies.apkrepo.url'] = apkRepoUrl
gradle.ext['datahub.dependencies.github.baseURL'] = githubBaseUrl
gradle.ext['datahub.dependencies.python.pipMirrorUrl'] = pipMirrorUrl
gradle.ext['datahub.dependencies.python.pipExtraIndexUrl'] = pipExtraIndexUrl
gradle.ext['datahub.dependencies.python.uvDockerProfile'] = uvDockerProfile
gradle.ext['datahub.dependencies.python.uvInstallProfile'] = uvInstallProfile
// Shared file-existence check for UV profiles. Returns the absolute path to
// profiles/<name>.toml, or null for 'custom' when allowCustom is true. Throws a
// GradleException when the profile is not 'custom' and its file is missing, and
// when 'custom' is passed with allowCustom=false (install side: custom can't be
// honored on the runner — no generate-config step, and pipMirrorUrl/pipExtraIndexUrl
// are docker-only).
gradle.ext['resolveUvProfileFile'] = { String profile, boolean allowCustom = false ->
if (profile == 'custom') {
if (allowCustom) return null
throw new GradleException(
"UV profile 'custom' is not supported for runner-side installs (no generate-config step on the runner; pipMirrorUrl/pipExtraIndexUrl are only honored for Docker builds). Use an existing profile (default/chainguard/chainguard-ci) or set UV_CONFIG_FILE directly."
)
}
def f = new File(new File(rootDir, 'docker/snippets/uv/profiles'), "${profile}.toml")
if (!f.isFile()) {
throw new GradleException(
"UV profile '${profile}' has no profile file at ${f}. Set datahub.dependencies.python.uv(Docker|Install)Profile to 'custom' or an existing profile (default/chainguard/chainguard-ci)."
)
}
return f.absolutePath
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
gradlePluginPortal()
mavenLocal()
maven { url mavenCentralUrl }
maven { url confluentUrl }
maven { url linkedinUrl }
}
}
include 'datahub-web-react'
include 'datahub-frontend'
include 'datahub-graphql-core'
include 'metadata-service:war'
include 'metadata-service:servlet'
include 'metadata-service:factories'
include 'metadata-service:auth-config'
include 'metadata-service:auth-impl'
include 'metadata-service:auth-filter'
include 'metadata-service:auth-servlet-impl'
include 'metadata-service:restli-api'
include 'metadata-service:restli-client-api'
include 'metadata-service:restli-client'
include 'metadata-service:restli-servlet-impl'
include 'metadata-service:graphql-servlet-impl'
include 'metadata-service:openapi-servlet'
include 'metadata-service:openapi-entity-servlet'
include 'metadata-service:openapi-entity-servlet:generators'
include 'metadata-service:openapi-analytics-servlet'
include 'metadata-service:plugin'
include 'metadata-service:plugin:src:test:sample-test-plugins'
include 'metadata-dao-impl:kafka-producer'
include 'metadata-events:mxe-avro'
include 'metadata-events:mxe-registration'
include 'metadata-events:mxe-schemas'
include 'metadata-events:mxe-utils-avro'
include 'metadata-ingestion'
include 'metadata-jobs:mae-consumer'
include 'metadata-jobs:mce-consumer'
include 'metadata-jobs:pe-consumer'
include 'metadata-jobs:mae-consumer-job'
include 'metadata-jobs:mce-consumer-job'
include ':docker'
include ':docker:postgres'
include ':docker:datahub-ingestion'
include ':docker:datahub-ingestion-base'
include 'metadata-models'
include 'metadata-models-validator'
include 'entity-registry'
include 'metadata-io'
include 'metadata-io:metadata-io-api'
include 'datahub-upgrade'
include 'metadata-utils'
include 'li-utils'
include 'test-models'
include 'docs-website'
include 'metadata-models-custom'
include 'entity-registry:custom-test-model'
include 'metadata-integration:java:datahub-client'
include 'metadata-integration:java:custom-plugin-lib'
include 'metadata-integration:java:datahub-event'
include 'metadata-integration:java:datahub-protobuf'
include 'metadata-integration:java:openlineage-converter'
include 'metadata-integration:java:acryl-spark-lineage'
include 'ingestion-scheduler'
include 'metadata-ingestion-modules:airflow-plugin'
include 'metadata-ingestion-modules:gx-plugin'
include 'metadata-ingestion-modules:dagster-plugin'
include 'metadata-ingestion-modules:prefect-plugin'
include 'python-build'
include 'smoke-test'
include 'e2e-test:ui:playwright'
include 'scripts:dev'
include 'metadata-auth:auth-api'
include 'metadata-service:schema-registry-api'
include 'metadata-service:schema-registry-servlet'
include 'metadata-integration:java:examples'
include 'mock-entity-registry'
include 'metadata-service:services'
include 'metadata-service:configuration'
include 'metadata-service:rate-limit'
include ':metadata-jobs:common'
include ':metadata-operation-context'
include ':metadata-service:openapi-servlet:models'
include ':metadata-integration:java:datahub-schematron:lib'
include ':metadata-integration:java:datahub-schematron:cli'
include ':metadata-service:iceberg-catalog'
include ':metadata-service:events-service'
include ':datahub-actions'
include ':datahub-agent-context'
// CVE-patched fork of com.linkedin.avroutil1:helper-all (in-repo JAR; see build.gradle dependencySubstitution)
include 'vendor:avroutil1-helper-all-fork'
buildCache {
def depotSecret = System.getenv('DEPOT_TOKEN');
def isCi = System.getenv('CI');
remote(HttpBuildCache) {
url = 'https://cache.depot.dev'
// Truthiness, not a null check: GitHub sets secrets that are unavailable
// (fork PRs) to the empty string, not to nothing. `"" != null` is true, so
// a null check enables the cache with an empty password and every build
// opens with a 403 that Gradle swallows before disabling the cache.
enabled = depotSecret ? true : false
// Push only from master. PR runs pull but never write: with push enabled
// on any CI run, code executing in a same-repo PR could populate cache
// entries that trusted master builds later consume (cache poisoning).
// Master-only writes match every other cache in this repo.
push = isCi && System.getenv('GITHUB_REF') == 'refs/heads/master'
credentials {
username = ''
password = depotSecret
}
}
}
def installPreCommitHooks() {
if (System.getenv("CI") == "true") {
println("Skipping pre-commit hooks in CI")
return
}
// In a git worktree, .git is a file (not a directory) pointing to the main repo's worktrees dir.
// Pre-commit hooks only need to be installed once in the main worktree.
if (new File(rootDir, ".git").isFile()) {
println("Skipping pre-commit hooks in git worktree")
return
}
def preCommitInstalled = false
try {
def process = ["which", "pre-commit"].execute()
def stdout = new StringBuilder()
def stderr = new StringBuilder()
process.waitForProcessOutput(stdout, stderr)
preCommitInstalled = (process.exitValue() == 0)
println "Pre-commit check: ${stdout}"
} catch (Exception e) {
println "Error checking pre-commit: ${e.message}"
return
}
if (!preCommitInstalled) {
try {
def installProcess = ["python", "-m", "pip", "install", "pre-commit"].execute()
def stdout = new StringBuilder()
def stderr = new StringBuilder()
installProcess.waitForProcessOutput(stdout, stderr)
if (installProcess.exitValue() != 0) {
println "Failed to install pre-commit: ${stderr}"
return
}
println "Install output: ${stdout}"
preCommitInstalled = true
} catch (Exception e) {
println "Error installing pre-commit: ${e.message}"
return
}
}
if(preCommitInstalled) {
try {
def installHooksProcess = ["pre-commit", "install"].execute()
def stdout = new StringBuilder()
def stderr = new StringBuilder()
installHooksProcess.waitForProcessOutput(stdout, stderr)
if (installHooksProcess.exitValue() != 0) {
println "Failed to install hooks: ${stdout}"
return
}
println "Hooks output: ${stdout}"
} catch (Exception e) {
println "Error installing hooks: ${e.message}"
return
}
// Also install the pre-push stage so hooks declared with
// stages: [pre-push] (self-correcting formatters + the push file-count
// guard) actually run on `git push`. See PFP-5002.
try {
def installPushProcess = ["pre-commit", "install", "--hook-type", "pre-push"].execute()
def stdout = new StringBuilder()
def stderr = new StringBuilder()
installPushProcess.waitForProcessOutput(stdout, stderr)
if (installPushProcess.exitValue() != 0) {
println "Failed to install pre-push hooks: ${stdout}"
return
}
println "Pre-push hooks output: ${stdout}"
} catch (Exception e) {
println "Error installing pre-push hooks: ${e.message}"
return
}
}
}
installPreCommitHooks()