@@ -4,6 +4,16 @@ import com.moowork.gradle.node.task.NodeTask
4
4
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
5
5
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
6
6
7
+ buildscript {
8
+ repositories {
9
+ if (gitLabCICD) {
10
+ maven { url = uri(" https://artifacts.ncei.noaa.gov/artifactory/gradle-plugins/" ) }
11
+ }
12
+ }
13
+ extra.apply { set(" gitLabCICD" , gitLabCICD) }
14
+ }
15
+
16
+
7
17
plugins {
8
18
`kotlin- dsl`
9
19
@@ -52,7 +62,7 @@ plugins {
52
62
// https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/
53
63
// - A Gradle plugin that allows you to package executable jar or war archives,
54
64
// run Spring Boot applications, and use the dependency management provided by spring-boot-dependencies
55
- id(" org.springframework.boot" ).version(" 2.7.9 " ).apply (false )
65
+ id(" org.springframework.boot" ).version(" 2.7.12 " ).apply (false )
56
66
57
67
// Gogradle plugin
58
68
// https://github.com/gogradle/gogradle
@@ -61,9 +71,13 @@ plugins {
61
71
62
72
}
63
73
64
- // resolve build dependencies from Bintray
65
74
repositories {
66
- mavenCentral()
75
+ if (gitLabCICD) {
76
+ maven(url = uri(" https://artifacts.ncei.noaa.gov/artifactory/gradle.mavencentral/" ))
77
+ maven(url = uri(" https://artifacts.ncei.noaa.gov/artifactory/gradle-plugins/" ))
78
+ } else {
79
+ mavenCentral()
80
+ }
67
81
}
68
82
69
83
subprojects {
@@ -138,11 +152,22 @@ dependencyCheck {
138
152
}
139
153
140
154
allprojects {
141
- // resolve all subproject dependencies from these repos
155
+ // resolve subproject dependencies through repos based on build environment
142
156
repositories {
157
+ if (gitLabCICD) {
158
+ maven(url = " https://artifacts.ncei.noaa.gov/artifactory/spring-milestone/" )
159
+ maven(url = " https://artifacts.ncei.noaa.gov/artifactory/confluent-maven/" )
160
+
161
+ maven(url = " https://artifacts.ncei.noaa.gov/artifactory/gradle.mavencentral/" )
162
+ maven(url = " https://artifacts.ncei.noaa.gov/artifactory/gradle-plugins/" )
163
+ } else {
143
164
mavenCentral()
144
- maven(url= " https://repo.spring.io/milestone" )
165
+ maven(url = " https://repo.spring.io/milestone" )
145
166
maven(url = " https://packages.confluent.io/maven/" )
167
+ }
168
+ // Switch based on artifactory access. Check logs during build to ensure jitpack isn't used on-prem.
169
+ if (System .getenv(" ARTIFACTORY_API_KEY" ) != null ) {
170
+ project.logger.lifecycle(" Using NCEI Artifactory for dependency resolution" )
146
171
maven {
147
172
name = " NCEI_MAVEN_PROD"
148
173
url = uri(" https://artifacts.ncei.noaa.gov/artifactory/ncei-maven/" )
@@ -154,7 +179,10 @@ allprojects {
154
179
create<HttpHeaderAuthentication >(" header" )
155
180
}
156
181
}
157
-
182
+ } else {
183
+ project.logger.lifecycle(" *** WARNING: using jitpack for dependency resolution. This is NOT allowed for NCEI on-prem builds ***" )
184
+ maven(url = " https://jitpack.io" )
185
+ }
158
186
}
159
187
}
160
188
@@ -249,7 +277,14 @@ subprojects {
249
277
// apply a common node/npm version to all projects using node
250
278
configure< com.moowork.gradle.node.NodeExtension > {
251
279
version = Versions .NODE
252
- npmVersion = Versions .NPM
280
+ // pull the node dist from artifactory if in GitLab CI/CD
281
+ if (gitLabCICD) {
282
+ distBaseUrl = " https://artifacts.ncei.noaa.gov/artifactory/node-dist"
283
+ // npmVersion is intentionally not set; use the one bundled with node
284
+ // since we cannot set the url to artifactory for the npm dist
285
+ } else {
286
+ npmVersion = Versions .NPM
287
+ }
253
288
workDir = file(" ${rootProject.buildDir} /nodejs" )
254
289
npmWorkDir = file(" ${rootProject.buildDir} /npm" )
255
290
nodeModulesDir = file(" ${project.projectDir} " )
@@ -305,6 +340,16 @@ subprojects {
305
340
configurations.all {
306
341
resolutionStrategy.eachDependency {
307
342
343
+ if (requested.group == " org.xerial.snappy" && requested.name == " snappy-java" ) {
344
+ useVersion(" 1.1.10.1" )
345
+ because(" override version since kafka-clients only use up to version 1.1.8.4" )
346
+ }
347
+
348
+ if (requested.group == " org.mozilla" && requested.name == " rhino" ) {
349
+ useVersion(" 1.7.14" )
350
+ because(" override version since json-schema-validator only uses up to version 1.7.7.2" )
351
+ }
352
+
308
353
if (requested.group == " com.github.everit-org.json-schema" && requested.name == " org.everit.json.schema" ) {
309
354
useTarget(" com.github.erosb:everit-json-schema:1.14.2" )
310
355
}
@@ -400,14 +445,14 @@ subprojects {
400
445
}
401
446
if (requested.group.startsWith(" org.apache.tomcat" ) &&
402
447
requested.name.contains(" tomcat" ) &&
403
- requested.version!! < " 9.0.68 " ) {
404
- useVersion(" 9.0.68 " )
448
+ requested.version!! < " 9.0.75 " ) {
449
+ useVersion(" 9.0.75 " )
405
450
because(" Enforce tomcat 9.0.58+ to avoid vulnerabilities CVE-2022-23181\n " +
406
451
" 9.0.68+ to avoid CVE-2022-34305" )
407
452
}
408
453
if (requested.group.startsWith(" org.apache.tomcat.embed" ) &&
409
- requested.version!! < " 9.0.58 " ) {
410
- useVersion(" 9.0.58 " )
454
+ requested.version!! < " 9.0.75 " ) {
455
+ useVersion(" 9.0.75 " )
411
456
because(" Fixes CVE-2022-23181" )
412
457
}
413
458
if (requested.group.startsWith(" io.netty.incubator" ) &&
0 commit comments