-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.gradle
181 lines (149 loc) · 4.51 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
/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you 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 REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
plugins {
id 'base'
id 'java'
id 'maven-publish'
id 'com.palantir.git-version' version '0.12.3'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'project-report'
id 'org.unbroken-dome.helm' version '1.1.1'
id 'org.unbroken-dome.helm-publish' version '1.1.1'
id 'com.bmuschko.docker-remote-api' version '6.4.0'
}
description = "kafka-connect-s3"
apply from: 'dependencies.gradle'
version = System.getenv("PROJECT_VERSION") ?: getProjectVersion()
ext {
pomHumanName = 'Kafka Connect S3'
pomDesc = 'S3 Source and Sink Connectors for Kafka Connect'
dockerRegistry = System.getenv("DOCKER_REGISTRY_URL")
baseDockerTag = "$dockerRegistry/kafka-s3-backup-libs"
}
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
group = 'com.spredfast.kafka.connect.s3'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
maven { url "https://repo.maven.apache.org/maven2" }
}
test {
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
}
configurations {
javaagent
}
dependencies {
compile project(':sink')
compile project(':source')
javaagent libraries.javaagent
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from subprojects*.tasks.javadoc.destinationDir
}
task sourcesJar(type: Jar) {
from subprojects*.sourceSets.main.allSource
classifier = 'sources'
}
jar {
from subprojects*.sourceSets.main.output
}
artifacts {
archives javadocJar, sourcesJar
}
task libs {
dependsOn 'shadowJar'
doLast {
copy {
from(shadowJar)
into("$buildDir/dependencies/connectors")
}
copy {
from(configurations.compileClasspath)
into("$buildDir/dependencies/compile")
}
copy {
from(configurations.javaagent)
into("$buildDir/dependencies/javaagent")
rename("(jmx_prometheus_javaagent)-(.+)(\\.jar)", '$1$3')
}
}
}
shadowJar {
dependencies {
// provided in the connect classpath
exclude(dependency('org.apache.kafka:connect-api'))
exclude(dependency('org.apache.kafka:kafka-clients'))
exclude(dependency('org.lz4:lz4-java'))
exclude(dependency('org.xerial.snappy:.*:.*'))
exclude(dependency('org.slf4j:.*:.*'))
}
relocate 'com.amazonaws', 'com.spredfast.shade.amazonaws'
relocate 'com.fasterxml', 'com.spredfast.shade.fasterxml'
relocate 'org.apache.commons', 'com.spredfast.shade.apache.commons'
relocate 'org.apache.http', 'com.spredfast.shade.apache.http'
relocate 'org.joda', 'com.spredfast.shade.joda'
}
helm {
xdgCacheHome = file("$buildDir/helm/cache")
filtering.enabled = false
lint {
strict = false
}
charts {
pipeline {
chartName = "kafka-s3-backup"
sourceDir = file("$rootDir/helm/kafka-s3-backup")
}
}
publishing {
repositories {
custom {
url = uri(System.getenv("HELM_ARTIFACTORY_URL") ?: "")
uploadMethod = 'PUT'
uploadPath = '/{name}/{filename}'
credentials {
username = System.getenv("AWS_ARTIFACTORY_USER")
password = System.getenv("AWS_ARTIFACTORY_PASS")
}
}
}
}
}
docker {
registryCredentials {
url = dockerRegistry
username = System.getenv("AWS_ARTIFACTORY_USER")
password = System.getenv("AWS_ARTIFACTORY_PASS")
}
}
task dockerBuildImage(type: DockerBuildImage, dependsOn: 'libs') {
inputDir = file("$rootDir")
images = ["$baseDockerTag:$version"]
}
task dockerPushImage(type: DockerPushImage, dependsOn: dockerBuildImage) {
images = ["$baseDockerTag:$version"]
}
def getProjectVersion() {
def tag = 'git describe --abbrev=0 --tags'.execute().text.trim()
def sha = 'git rev-parse --verify --short HEAD'.execute().text.trim()
return tag + '-' + sha
}