Rework bwc snapshot projects to build up to two bwc versions (#24870)

Removes the `distribution:bwc` project in favor of
`distribution:bwc-release-snapshot` and
`distribution:bwc-stable-snapshot`.
`distribution:bwc-release-snapshot` builds a snapshot of the
latest release branch (5.4 now) if needed for backwards
compatibility. `distribution:bwc-stable-snapshot` builds a
snapshot of the latest stable branch (5.x now) if needed for
backwards compatibility.
This commit is contained in:
Nik Everett 2017-05-29 10:22:32 -04:00 committed by GitHub
parent dfdf496c1a
commit bc4df47a76
4 changed files with 50 additions and 11 deletions

View File

@ -218,12 +218,22 @@ subprojects {
"org.elasticsearch.plugin:aggs-matrix-stats-client:${version}": ':modules:aggs-matrix-stats',
"org.elasticsearch.plugin:percolator-client:${version}": ':modules:percolator',
]
if (wireCompatVersions[-1].snapshot) {
// if the most previous version is a snapshot, we need to connect that version to the
// bwc project which will checkout and build that snapshot version
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${wireCompatVersions[-1]}"] = ':distribution:bwc'
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${wireCompatVersions[-1]}"] = ':distribution:bwc'
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${wireCompatVersions[-1]}"] = ':distribution:bwc'
if (indexCompatVersions[-1].snapshot) {
/* The last and second to last versions can be snapshots. Rather than use
* snapshots built by CI we connect these versions to projects that build
* those those versions from the HEAD of the appropriate branch. */
if (indexCompatVersions[-1].bugfix == 0) {
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-stable-snapshot'
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-2]}"] = ':distribution:bwc-release-snapshot'
} else {
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${indexCompatVersions[-1]}"] = ':distribution:bwc-release-snapshot'
}
}
project.afterEvaluate {
configurations.all {

View File

@ -41,7 +41,7 @@ buildscript {
}
Collection distributions = project.subprojects.findAll {
it.path.contains(':tools') == false && it.name != 'bwc' }
it.path.contains(':tools') == false && it.path.contains(':bwc') == false }
/*****************************************************************************
* Notice file *

View File

@ -26,14 +26,35 @@ import org.elasticsearch.gradle.LoggedExec
* tests to test against the next unreleased version, closest to this version,
* without relying on snapshots.
*/
String bwcVersion
boolean enabled = true
if (project.name == 'bwc-stable-snapshot') {
/* bwc-stable is only used if the last version is on a stable branch instead
* of a bugfix branch */
enabled = indexCompatVersions[-1].bugfix == 0
bwcVersion = indexCompatVersions[-1]
} else if (project.name == 'bwc-release-snapshot') {
if (indexCompatVersions[-1].bugfix == 0) {
/* The last version is on a stable branch so it is handled by the bwc-stable
* project. This project will instead handle the version before that which
* *should* be on a stable branch. */
bwcVersion = indexCompatVersions[-2]
} else {
// The last version is on a release branch so it is handled by this project
bwcVersion = indexCompatVersions[-1]
}
} else {
throw new InvalidUserDataException("Unsupport project name ${project.name}")
}
String bwcVersion = wireCompatVersions[-1]
if (bwcVersion.endsWith('-SNAPSHOT')) {
if (enabled) {
apply plugin: 'distribution'
def (String major, String minor, String bugfix) = bwcVersion.split('\\.')
String bwcBranch = bugfix == '0-SNAPSHOT' ? "${major}.x" : "${major}.${minor}"
String bwcBranch =
project.name == 'bwc-stable-snapshot' ? "${major}.x" : "${major}.${minor}"
File checkoutDir = file("${buildDir}/bwc/checkout-${bwcBranch}")
task createClone(type: LoggedExec) {
onlyIf { checkoutDir.exists() == false }
commandLine = ['git', 'clone', rootDir, checkoutDir]

View File

@ -15,7 +15,8 @@ List projects = [
'client:benchmark',
'benchmarks',
'distribution:integ-test-zip',
'distribution:bwc',
'distribution:bwc-release-snapshot',
'distribution:bwc-stable-snapshot',
'distribution:zip',
'distribution:tar',
'distribution:deb',
@ -106,6 +107,13 @@ for (String example : examplePlugins) {
project(":example-plugins:${example}").projectDir = new File(rootProject.projectDir, "plugins/examples/${example}")
}
/* bwc and bwc-unreleased share the same build directory and build file, but
* apply to different backwards compatibility branches. */
project(':distribution:bwc-release-snapshot').projectDir =
new File(rootProject.projectDir, 'distribution/bwc')
project(':distribution:bwc-stable-snapshot').projectDir =
new File(rootProject.projectDir, 'distribution/bwc')
if (isEclipse) {
project(":core").projectDir = new File(rootProject.projectDir, 'core/src/main')
project(":core").buildFileName = 'eclipse-build.gradle'