forked from armory-io/halyard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
194 lines (176 loc) · 7.69 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id 'io.spinnaker.project' version "$spinnakerGradleVersion" apply false
id 'com.google.protobuf' version "0.8.12" apply false
id "com.jfrog.artifactory" version "4.13.0"
}
ext {
buildVersion = calculateVersion()
}
subprojects {
group = "io.spinnaker.halyard"
apply plugin: 'io.spinnaker.project'
apply plugin: 'java-library'
apply plugin: 'groovy'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
test {
testLogging {
showStandardStreams = false
exceptionFormat = 'full'
}
minHeapSize = "512m"
maxHeapSize = "512m"
}
if ([korkVersion, fiatVersion, clouddriverVersion, front50Version].any { it.endsWith("-SNAPSHOT") }) {
logger.info("Enabling mavenLocal")
repositories {
mavenLocal()
}
}
dependencies {
implementation platform("io.spinnaker.kork:kork-bom:$korkVersion")
annotationProcessor platform("io.spinnaker.kork:kork-bom:$korkVersion")
annotationProcessor "org.projectlombok:lombok"
testAnnotationProcessor platform("io.spinnaker.kork:kork-bom:$korkVersion")
testAnnotationProcessor "org.projectlombok:lombok"
api(platform("org.springframework.boot:spring-boot-dependencies:2.7.11"))
api(platform("org.springframework.cloud:spring-cloud-dependencies:2021.0.3"))
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
artifactory {
contextUrl = "https://armory.jfrog.io/armory"
//The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = "gradle-dev"
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications('mavenJava')
publishArtifacts = true
publishPom = true
}
}
configurations.all {
resolutionStrategy {
force group: 'com.github.ben-manes.caff eine', name: 'caffeine', version: '2.8.+' // Remove SONATYPE-2019-0282, upgrade caffeine dependency
force group: 'com.hubspot.jinjava', name: 'jinjava', version: '2.5.+' // Remove CVE-2018-18893, upgrade jinjava dependency
force group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '7.9'// Remove CVE-2019-17195
force group: 'com.squareup.okhttp', name: 'okhttp', version: '2.7.+' // Remove CVE-2016-2402
force group: 'com.squareup.okhttp', name: 'okhttp-apache', version: '2.7.+'
force group: 'com.squareup.okhttp', name: 'okhttp-urlconnection', version: '2.7.+'
force group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.+' // Remove CVE-2019-10173, upgrade xstream dependency
force group: 'commons-codec', name: 'commons-codec', version: '1.+' // Remove CVE SONATYPE-2012-0050, upgrade commons-codec dependency
force group: 'commons-collections', name: 'commons-collections4', version:'4.+'
force group: 'commons-io', name: 'commons-io', version: '2.6'
force group: 'commons-net', name: 'commons-net', version: '3.+' // Remove apache issue NET-579, upgrade commons-net dependency
force group: 'io.netty', name: 'netty-codec-http', version: '4.1.+' // Remove CVE-2019-16869, upgrade netty-codec dependency
force group: 'io.netty', name: 'netty-codec-http2', version: '4.1.+' // Remove CVE-2019-9518, upgrade netty-codec-http2 dependency
force group: 'io.netty', name: 'netty-handler-proxy', version: '4.1.+' // Remove CVE-2019-9518, upgrade netty-handler-proxy dependency
force group: 'org.apache.ant', name: 'ant', version: '1.10.+' // Remove CVE-2020-1945
force group: 'org.apache.ant', name: 'ant-launcher', version: '1.10.+'
force group: 'org.apache.commons', name: 'commons-compress', version: '1.+' // Remove CVE-2019-12402, upgrade commons-compress dependency
force group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
force group: 'org.apache.tomcat.embed', name: 'tomcat-embed-core', version: '9.0.41' // Remove CVE-2020-13934, CVE-2020-9484
force group: 'org.codehaus.plexus', name: 'plexus-utils', version: '3.3.+' // Remove CVEs SONATYPE-2015-0173 and SONATYPE-2016-0398, upgrade plexus-utils dependency
force group: 'org.hibernate.validator', name: 'hibernate-validator', version: '6.1.+' // Remove CVE-2019-10219, upgrade hibernate-validator depende force group: 'org.testng', name: 'testng', version: '7.1.+' // Remove CVE SONATYPE-2019-0115, upgrade testng dependency
force group: 'org.javassist', name: 'javassist', version: '3.19.0-GA'
force group: 'org.jboss.logging', name: 'jboss-logging', version: '3.4.+' // Remove CVE-2017-2595, upgrade jboss-logging
force group: 'org.springframework.security', name: 'spring-security-crypto', version: '5.2.4.RELEASE' // Remove CVE-2020-5408
force group: 'org.testng', name: 'testng', version: '7.1.+' // Remove CVE SONATYPE-2019-0115, upgrade testng dependency
force group: 'org.yaml', name: 'snakeyaml', version: '2.0' // CVE-2022-1471
force group: 'org.apache.ivy', name: 'ivy', version: '2.5.1' // CVE-2022-37865
force group: 'org.spockframework', name:'spock-core', version:'2.0-groovy-3.0'
}
}
}
task setVersion() {
logger.info "Setting project version to: ${buildVersion}"
project.setVersion(buildVersion)
}
}
task version() {
exec {
workingDir projectDir
commandLine 'mkdir', '-p', 'build'
}
def so = new FileOutputStream("build/version")
exec {
workingDir projectDir
commandLine 'echo', "${version.toString().trim()}"
standardOutput = so
}
println version
}
defaultTasks ':halyard-web:run'
// Creates scripts for entry points
// Subproject must apply application plugin to be able to call this method.
def createScript(project, mainClass, name) {
project.tasks.create(name: name, type: CreateStartScripts) {
outputDir = new File(project.buildDir, 'scripts')
mainClassName = mainClass
applicationName = name
classpath = project.tasks[JavaPlugin.JAR_TASK_NAME].outputs.files + project.configurations.runtime
}
project.tasks[name].dependsOn(project.jar)
project.applicationDistribution.with {
into("bin") {
from(project.tasks[name])
fileMode = 0755
}
}
}
def calculateVersion() {
if (version != 'unspecified') {
logger.info "Version already present: ${version}"
return version
}
// get git hash
def gitHash = new ByteArrayOutputStream().withStream { soHash ->
exec {
workingDir projectDir
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = soHash
}
return soHash.toString().trim()
}.toString()
// determine if the re are uncommitted changes
def gitStatus = new ByteArrayOutputStream().withStream { soStatus ->
exec {
workingDir projectDir
commandLine 'git', 'status', '--porcelain'
standardOutput = soStatus
}
return soStatus.toString().trim()
}.toString()
def newVersion = "operator-${gitHash}"
if (gitStatus != '') {
newVersion += '-uncommitted'
}
logger.info "Calculated version: ${newVersion}"
project.setVersion(newVersion)
return newVersion
}