Enable BWC testing against other remotes
This commit enables BWC testing against remotes on GitHub other than elastic/elasticsearch.git and elastic/x-pack-elasticsearch.git. Relates elastic/x-pack-elasticsearch#2707 Original commit: elastic/x-pack-elasticsearch@9028f2e089
This commit is contained in:
parent
615de68711
commit
70a38ec545
|
@ -47,6 +47,8 @@ subprojects {
|
||||||
File esCheckoutDir = file("${buildDir}/bwc/checkout-es-${bwcBranch}")
|
File esCheckoutDir = file("${buildDir}/bwc/checkout-es-${bwcBranch}")
|
||||||
File xpackCheckoutDir = file("${esCheckoutDir}-extra/x-pack-elasticsearch")
|
File xpackCheckoutDir = file("${esCheckoutDir}-extra/x-pack-elasticsearch")
|
||||||
|
|
||||||
|
final String remote = System.getProperty("tests.bwc.remote", "elastic")
|
||||||
|
|
||||||
task createElasticsearchClone(type: LoggedExec) {
|
task createElasticsearchClone(type: LoggedExec) {
|
||||||
onlyIf { esCheckoutDir.exists() == false }
|
onlyIf { esCheckoutDir.exists() == false }
|
||||||
commandLine = ['git', 'clone', rootDir, esCheckoutDir]
|
commandLine = ['git', 'clone', rootDir, esCheckoutDir]
|
||||||
|
@ -58,7 +60,7 @@ subprojects {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we use regular Exec here to ensure we always get output, regardless of logging level
|
// we use regular Exec here to ensure we always get output, regardless of logging level
|
||||||
task findElasticsearchUpstream(type: Exec) {
|
task findElasticsearchRemote(type: Exec) {
|
||||||
dependsOn createElasticsearchClone
|
dependsOn createElasticsearchClone
|
||||||
workingDir = esCheckoutDir
|
workingDir = esCheckoutDir
|
||||||
commandLine = ['git', 'remote', '-v']
|
commandLine = ['git', 'remote', '-v']
|
||||||
|
@ -70,16 +72,16 @@ subprojects {
|
||||||
output.toString('UTF-8').eachLine { line -> logger.error(line) }
|
output.toString('UTF-8').eachLine { line -> logger.error(line) }
|
||||||
execResult.assertNormalExitValue()
|
execResult.assertNormalExitValue()
|
||||||
}
|
}
|
||||||
project.ext.esUpstreamExists = false
|
project.ext.esRemoteExists = false
|
||||||
output.toString('UTF-8').eachLine {
|
output.toString('UTF-8').eachLine {
|
||||||
if (it.contains("upstream")) {
|
if (it.contains("${remote}\tgit@github.com:${remote}/elasticsearch.git")) {
|
||||||
project.ext.esUpstreamExists = true
|
project.ext.esRemoteExists = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task findXPackUpstream(type: Exec) {
|
task findXPackRemote(type: Exec) {
|
||||||
dependsOn createXPackClone
|
dependsOn createXPackClone
|
||||||
workingDir = xpackCheckoutDir
|
workingDir = xpackCheckoutDir
|
||||||
commandLine = ['git', 'remote', '-v']
|
commandLine = ['git', 'remote', '-v']
|
||||||
|
@ -91,37 +93,37 @@ subprojects {
|
||||||
output.toString('UTF-8').eachLine { line -> logger.error(line) }
|
output.toString('UTF-8').eachLine { line -> logger.error(line) }
|
||||||
execResult.assertNormalExitValue()
|
execResult.assertNormalExitValue()
|
||||||
}
|
}
|
||||||
project.ext.xpackUpstreamExists = false
|
project.ext.xpackRemoteExists = false
|
||||||
output.toString('UTF-8').eachLine {
|
output.toString('UTF-8').eachLine {
|
||||||
if (it.contains("upstream")) {
|
if (it.contains("${remote}\tgit@github.com:${remote}/x-pack-elasticsearch.git")) {
|
||||||
project.ext.xpackUpstreamExists = true
|
project.ext.xpackRemoteExists = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task addElasticsearchUpstream(type: LoggedExec) {
|
task addElasticsearchRemote(type: LoggedExec) {
|
||||||
dependsOn findElasticsearchUpstream
|
dependsOn findElasticsearchRemote
|
||||||
onlyIf { project.ext.esUpstreamExists == false }
|
onlyIf { project.ext.esRemoteExists == false }
|
||||||
workingDir = esCheckoutDir
|
workingDir = esCheckoutDir
|
||||||
commandLine = ['git', 'remote', 'add', 'upstream', 'git@github.com:elastic/elasticsearch.git']
|
commandLine = ['git', 'remote', 'add', "${remote}", "git@github.com:${remote}/elasticsearch.git"]
|
||||||
}
|
}
|
||||||
|
|
||||||
task addXPackUpstream(type: LoggedExec) {
|
task addXPackRemote(type: LoggedExec) {
|
||||||
dependsOn findXPackUpstream
|
dependsOn findXPackRemote
|
||||||
onlyIf { project.ext.xpackUpstreamExists == false }
|
onlyIf { project.ext.xpackRemoteExists == false }
|
||||||
workingDir = xpackCheckoutDir
|
workingDir = xpackCheckoutDir
|
||||||
commandLine = ['git', 'remote', 'add', 'upstream', 'git@github.com:elastic/x-pack-elasticsearch.git']
|
commandLine = ['git', 'remote', 'add', "${remote}", "git@github.com:${remote}/x-pack-elasticsearch.git"]
|
||||||
}
|
}
|
||||||
|
|
||||||
task fetchElasticsearchLatest(type: LoggedExec) {
|
task fetchElasticsearchLatest(type: LoggedExec) {
|
||||||
dependsOn addElasticsearchUpstream
|
dependsOn addElasticsearchRemote
|
||||||
workingDir = esCheckoutDir
|
workingDir = esCheckoutDir
|
||||||
commandLine = ['git', 'fetch', '--all']
|
commandLine = ['git', 'fetch', '--all']
|
||||||
}
|
}
|
||||||
|
|
||||||
task fetchXPackLatest(type: LoggedExec) {
|
task fetchXPackLatest(type: LoggedExec) {
|
||||||
dependsOn addXPackUpstream
|
dependsOn addXPackRemote
|
||||||
workingDir = xpackCheckoutDir
|
workingDir = xpackCheckoutDir
|
||||||
commandLine = ['git', 'fetch', '--all']
|
commandLine = ['git', 'fetch', '--all']
|
||||||
}
|
}
|
||||||
|
@ -129,7 +131,7 @@ subprojects {
|
||||||
String esBuildMetadataKey = "bwc_refspec_${project.path.substring(1)}_elasticsearch"
|
String esBuildMetadataKey = "bwc_refspec_${project.path.substring(1)}_elasticsearch"
|
||||||
task checkoutElasticsearchBwcBranch(type: LoggedExec) {
|
task checkoutElasticsearchBwcBranch(type: LoggedExec) {
|
||||||
dependsOn fetchElasticsearchLatest
|
dependsOn fetchElasticsearchLatest
|
||||||
def String refspec = System.getProperty("tests.bwc.refspec", buildMetadata.get(esBuildMetadataKey, "upstream/${bwcBranch}"))
|
def String refspec = System.getProperty("tests.bwc.refspec", buildMetadata.get(esBuildMetadataKey, "${remote}/${bwcBranch}"))
|
||||||
workingDir = esCheckoutDir
|
workingDir = esCheckoutDir
|
||||||
commandLine = ['git', 'checkout', refspec]
|
commandLine = ['git', 'checkout', refspec]
|
||||||
}
|
}
|
||||||
|
@ -137,7 +139,7 @@ subprojects {
|
||||||
String xpackBuildMetadataKey = "bwc_refspec_${project.path.substring(1)}_xpack"
|
String xpackBuildMetadataKey = "bwc_refspec_${project.path.substring(1)}_xpack"
|
||||||
task checkoutXPackBwcBranch(type: LoggedExec) {
|
task checkoutXPackBwcBranch(type: LoggedExec) {
|
||||||
dependsOn fetchXPackLatest
|
dependsOn fetchXPackLatest
|
||||||
def String refspec = System.getProperty("tests.bwc.refspec", buildMetadata.get(xpackBuildMetadataKey, "upstream/${bwcBranch}"))
|
def String refspec = System.getProperty("tests.bwc.refspec", buildMetadata.get(xpackBuildMetadataKey, "${remote}/${bwcBranch}"))
|
||||||
workingDir = xpackCheckoutDir
|
workingDir = xpackCheckoutDir
|
||||||
commandLine = ['git', 'checkout', refspec]
|
commandLine = ['git', 'checkout', refspec]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue