Skip to content

Commit f5f4073

Browse files
committed
DOCKER-462 Fixed broken build when adding tag
1 parent a137169 commit f5f4073

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ def calcTags(version) {
3434
tags += "${version.major}.${version.minor}.${version.rev}.${version.label}".toString()
3535
}
3636
// For non-master/non-release builds, change the tags to contain branch and build number
37-
def isTestBuild = ci.isCi() && ci.branch != "master" && ci.branch != "release"
38-
if (isTestBuild) {
39-
def branch = ci.branch.replace("/", ".") //slashes are not allowed in docker tags
40-
tags = tags.stream().map({ it + "-build-${branch}-${ci.buildNumber}" }).collect(Collectors.toList());
37+
def isReleaseBuild = ci.isCi() && ((ci.branch != null && (ci.branch.startsWith("master") || ci.branch.startsWith("release"))) || ci.tag != null)
38+
if (!isReleaseBuild) {
39+
def branch = ci.tag ? ci.tag : ci.branch ? ci.branch.replace("/", ".") : "1.0.0"
40+
tags = tags.stream().map({ it + "-build-${branch}-${ci.buildNumber}" }).collect(Collectors.toList())
4141
}
4242

4343
return tags

tomcat-base/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ subprojects {
5656
}
5757

5858
boolean isRelease = ci.branch?.equals("master")
59+
|| ci.branch?.equals("release")
60+
|| (ci.tag != null && ci.tag.toLowerCase().startsWith("v"))
5961
if (!isRelease) {
6062
version += "-SNAPSHOT"
6163
}
@@ -85,6 +87,10 @@ subprojects {
8587
}
8688
}
8789

90+
sourcesJar {
91+
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
92+
}
93+
8894
archivesBaseName = 'xenit-tomcat-embedded'
8995

9096
dockerBuild {

0 commit comments

Comments
 (0)