From dad15b8d6c06911a075f1f1f7b1bed8b3881ffda Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 8 Jun 2017 11:40:45 -0600 Subject: [PATCH] Fix branch logic for bwc tests in the same major version When testing against the previous 5.x release, the bwc project incorrectly would checkout the 5.x branch instead of the 5.5 branch as it still had the logic that applies for major versions bwc. This change adds a check to compare the major version when making the decision on the branch to use. Original commit: elastic/x-pack-elasticsearch@b07aa78a7b0e775cd40b3f02318f4dca48f07f73 --- plugin/bwc/build.gradle | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin/bwc/build.gradle b/plugin/bwc/build.gradle index 76a6bfdfd22..0a35703ae97 100644 --- a/plugin/bwc/build.gradle +++ b/plugin/bwc/build.gradle @@ -33,8 +33,15 @@ subprojects { apply plugin: 'distribution' def (String major, String minor, String bugfix) = bwcVersion.split('\\.') - String bwcBranch = - project.name == 'stable-snapshot' ? "${major}.x" : "${major}.${minor}" + def (String currentMajor, String currentMinor, String currentBugfix) = version.split('\\.') + String bwcBranch + if (project.name == 'bwc-stable-snapshot') { + bwcBranch = "${major}.x" + } else if (major != currentMajor) { + bwcBranch = "${major}.x" + } else { + bwcBranch = "${major}.${minor}" + } File esCheckoutDir = file("${buildDir}/bwc/checkout-es-${bwcBranch}") File xpackCheckoutDir = file("${esCheckoutDir}-extra/x-pack-elasticsearch")