Add the ability to skip specific versions for muzzle
This makes it much easier to bypass bad versions than splitting out the muzzle definition.
MODIFY
buildSrc/src/main/groovy/MuzzlePlugin.groovy
buildSrc/src/main/groovy/MuzzlePlugin.groovy
@@ -206,7 +206,7 @@ class MuzzlePlugin implements Plugin<Project> {
rangeRequest.setArtifact(directiveArtifact)
final VersionRangeResult rangeResult = system.resolveVersionRange(session, rangeRequest)
- final List<Artifact> allVersionArtifacts = filterVersion(rangeResult.versions).collect { version ->
+ final List<Artifact> allVersionArtifacts = filterVersion(rangeResult.versions, muzzleDirective.skipVersions).collect { version ->
new DefaultArtifact(muzzleDirective.group, muzzleDirective.module, "jar", version.toString())
}
@@ -237,7 +237,7 @@ class MuzzlePlugin implements Plugin<Project> {
rangeRequest.setArtifact(directiveArtifact)
final VersionRangeResult rangeResult = system.resolveVersionRange(session, rangeRequest)
- filterVersion(allRangeResult.versions).collect { version ->
+ filterVersion(allRangeResult.versions, muzzleDirective.skipVersions).collect { version ->
if (!rangeResult.versions.contains(version)) {
final MuzzleDirective inverseDirective = new MuzzleDirective()
inverseDirective.group = muzzleDirective.group
@@ -351,7 +351,7 @@ class MuzzlePlugin implements Plugin<Project> {
/**
* Filter out snapshot-type builds from versions list.
*/
- private static filterVersion(List<Version> list) {
+ private static filterVersion(List<Version> list, Set<String> skipVersions) {
list.removeIf {
def version = it.toString().toLowerCase()
return version.contains("rc") ||
@@ -363,6 +363,7 @@ class MuzzlePlugin implements Plugin<Project> {
version.contains("-m") ||
version.contains("-dev") ||
version.contains("public_draft") ||
+ skipVersions.contains(version) ||
version.matches(GIT_SHA_PATTERN)
}
return list
@@ -388,6 +389,7 @@ class MuzzleDirective {
String group
String module
String versions
+ Set<String> skipVersions = new HashSet<>()
List<String> additionalDependencies = new ArrayList<>()
boolean assertPass
boolean assertInverse = false
@@ -443,6 +445,7 @@ class MuzzleExtension {
void pass(Action<? super MuzzleDirective> action) {
final MuzzleDirective pass = objectFactory.newInstance(MuzzleDirective)
action.execute(pass)
+ postConstruct(pass)
pass.assertPass = true
directives.add(pass)
}
@@ -450,7 +453,15 @@ class MuzzleExtension {
void fail(Action<? super MuzzleDirective> action) {
final MuzzleDirective fail = objectFactory.newInstance(MuzzleDirective)
action.execute(fail)
+ postConstruct(fail)
fail.assertPass = false
directives.add(fail)
}
+
+ private postConstruct(MuzzleDirective directive) {
+ // Make skipVersions case insensitive.
+ directive.skipVersions = directive.skipVersions.collect {
+ it.toLowerCase()
+ }
+ }
}

MODIFY
dd-java-agent/instrumentation/commons-httpclient-2/commons-httpclient-2.gradle
dd-java-agent/instrumentation/commons-httpclient-2/commons-httpclient-2.gradle
@@ -3,6 +3,7 @@ muzzle {
group = "commons-httpclient"
module = "commons-httpclient"
versions = "[2.0,]"
+ skipVersions += "3.1-jenkins-1" // odd version in jcenter
assertInverse = true
}
}

MODIFY
dd-java-agent/instrumentation/elasticsearch/rest-6.4/rest-6.4.gradle
dd-java-agent/instrumentation/elasticsearch/rest-6.4/rest-6.4.gradle
@@ -45,9 +45,8 @@ dependencies {
testCompile group: 'org.elasticsearch.plugin', name: 'transport-netty4-client', version: '6.4.0'
// TODO: The tests are incompatible with 7.x. The instrumentation may be as well.
- // FIXME: Lock to specific version due to bad deploy rollout.
- latestDepTestCompile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-client', version: '6.8.3'
- latestDepTestCompile group: 'org.elasticsearch.client', name: 'transport', version: '6.8.3'
- latestDepTestCompile group: 'org.elasticsearch', name: 'elasticsearch', version: '6.8.3'
- latestDepTestCompile group: 'org.elasticsearch.plugin', name: 'transport-netty4-client', version: '6.8.3'
+ latestDepTestCompile group: 'org.elasticsearch.client', name: 'elasticsearch-rest-client', version: '6.+'
+ latestDepTestCompile group: 'org.elasticsearch.client', name: 'transport', version: '6.+'
+ latestDepTestCompile group: 'org.elasticsearch', name: 'elasticsearch', version: '6.+'
+ latestDepTestCompile group: 'org.elasticsearch.plugin', name: 'transport-netty4-client', version: '6.+'
}

MODIFY
dd-java-agent/instrumentation/elasticsearch/transport-5.3/transport-5.3.gradle
dd-java-agent/instrumentation/elasticsearch/transport-5.3/transport-5.3.gradle
@@ -8,8 +8,7 @@ muzzle {
group = "org.elasticsearch.client"
module = "transport"
versions = "[5.3.0,6.0.0)"
- // Work around for a bad release of 6.8.4
-// assertInverse = true
+ assertInverse = true
}
pass {
group = "org.elasticsearch"

MODIFY
dd-java-agent/instrumentation/elasticsearch/transport-5/transport-5.gradle
dd-java-agent/instrumentation/elasticsearch/transport-5/transport-5.gradle
@@ -8,8 +8,7 @@ muzzle {
group = "org.elasticsearch.client"
module = "transport"
versions = "[5.0.0,5.3.0)"
- // Work around for a bad release of 6.8.4
-// assertInverse = true
+ assertInverse = true
}
pass {
group = "org.elasticsearch"

MODIFY
dd-java-agent/instrumentation/elasticsearch/transport-6/transport-6.gradle
dd-java-agent/instrumentation/elasticsearch/transport-6/transport-6.gradle
@@ -8,8 +8,7 @@ muzzle {
group = "org.elasticsearch.client"
module = "transport"
versions = "[6.0.0,6.8.4)"
- // Work around for a bad release of 6.8.4
-// assertInverse = true
+ assertInverse = true
}
pass {
group = "org.elasticsearch"

MODIFY
dd-java-agent/instrumentation/play-ws-2.1/play-ws-2.1.gradle
dd-java-agent/instrumentation/play-ws-2.1/play-ws-2.1.gradle
@@ -14,45 +14,27 @@ testSets {
}
muzzle {
- // 2.0.5 was a bad release
fail {
group = 'com.typesafe.play'
module = 'play-ahc-ws-standalone_2.11'
- versions = '[,2.0.4]'
- }
- fail {
- group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.11'
- versions = '[2.0.6,)'
+ versions = '[,]'
}
- fail {
- group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.12'
- versions = '[,2.0.4]'
- }
- fail {
- group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.12'
- versions = '[2.0.6,2.1.0)'
- }
pass {
group = 'com.typesafe.play'
module = 'play-ahc-ws-standalone_2.12'
versions = '[2.1.0,]'
+ skipVersions += '2.0.5' // Bad release
+ assertInverse = true
}
- // No Scala 2.13 versions below 2.0.6 exist
- fail {
- group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.13'
- versions = '[2.0.6,2.1.0)'
- }
pass {
group = 'com.typesafe.play'
module = 'play-ahc-ws-standalone_2.13'
versions = '[2.1.0,]'
+ skipVersions += '2.0.5' // Bad release
+ assertInverse = true
}
}

MODIFY
dd-java-agent/instrumentation/play-ws-2/play-ws-2.gradle
dd-java-agent/instrumentation/play-ws-2/play-ws-2.gradle
@@ -14,38 +14,20 @@ testSets {
}
muzzle {
- // 2.0.5 was a bad release
- fail {
- group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.11'
- versions = '[,2.0.0)'
- }
pass {
- group = 'com.typesafe.play'
module = 'play-ahc-ws-standalone_2.11'
- versions = '[2.0.0,2.0.4]'
- }
- pass {
group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.11'
- versions = '[2.0.6,]'
+ versions = '[2.0.0,]'
+ assertInverse = true
}
- fail {
- group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.12'
- versions = '[,2.0.0)'
- }
pass {
group = 'com.typesafe.play'
module = 'play-ahc-ws-standalone_2.12'
- versions = '[2.0.0,2.0.4]'
- }
- pass {
- group = 'com.typesafe.play'
- module = 'play-ahc-ws-standalone_2.12'
- versions = '[2.0.6,2.1.0)'
+ versions = '[2.0.0,2.1.0)'
+ skipVersions += '2.0.5' // Bad release
+ assertInverse = true
}
// No Scala 2.13 versions below 2.0.6 exist

MODIFY
dd-java-agent/instrumentation/spring-webmvc-3.1/spring-webmvc-3.1.gradle
dd-java-agent/instrumentation/spring-webmvc-3.1/spring-webmvc-3.1.gradle
muzzle {
- fail {
- group = 'org.springframework'
- module = 'spring-webmvc'
- versions = "[,1.2.1)"
- extraDependency "javax.servlet:javax.servlet-api:3.0.1"
- }
- // 1.2.1-1.2.4 have broken dependencies.
- fail {
- group = 'org.springframework'
- module = 'spring-webmvc'
- versions = "(1.2.4,3.1.0.RELEASE)"
- extraDependency "javax.servlet:javax.servlet-api:3.0.1"
- }
- pass {
- group = 'org.springframework'
- module = 'spring-webmvc'
- versions = "[3.1.0.RELEASE,3.2.1.RELEASE)"
- extraDependency "javax.servlet:javax.servlet-api:3.0.1"
- }
- // 3.2.1.RELEASE is missing a required class. (bad release?)
pass {
group = 'org.springframework'
module = 'spring-webmvc'
- versions = "(3.2.1.RELEASE,]"
+ versions = "[3.1.0.RELEASE,]"
+ skipVersions += ['1.2.1', '1.2.2', '1.2.3', '1.2.4'] // broken releases... missing dependencies
+ skipVersions += '3.2.1.RELEASE' // missing a required class. (bad release?)
extraDependency "javax.servlet:javax.servlet-api:3.0.1"
+ assertInverse = true
}
// FIXME: webmvc depends on web, so we need a separate integration for spring-web specifically.
fail {
group = 'org.springframework'
module = 'spring-web'
- versions = "(1.2.4,]"
+ versions = "[,]"
+ skipVersions += ['1.2.1', '1.2.2', '1.2.3', '1.2.4'] // broken releases... missing dependencies
extraDependency "javax.servlet:javax.servlet-api:3.0.1"
}
}

Add the ability to skip specific versions for muzzle

This makes it much easier to bypass bad versions than splitting out the muzzle definition.