Skip to content

Commit ccac370

Browse files
committed
Use explicit version for build-tools in example plugin integ tests (#37792)
The example plugins are currently built within the build-tools integ tests as a means to ensure the gradle plugin works for external plugin builds. These tests generate a dummy build.gradle, and a dummy local maven repository to find the local builds dependencies in. Currently that build-tools dependency uses "+" as the version. However, this allows gradle to find the "latest" version, and unfortunately gradle has its own plugin repository which is apparently connected to jcenter. This recently triggered a flood of CI failures when jcenter suddenly pulled alpha2, and all builds started trying to use that instead of the locally built build-tools. This commit uses the explicit version of build-tools that was build locally, which will cause resolution to stop when the local repo is first checked.
1 parent 3d91b16 commit ccac370

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

buildSrc/src/test/java/org/elasticsearch/gradle/BuildExamplePluginsIT.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@
4040

4141
public class BuildExamplePluginsIT extends GradleIntegrationTestCase {
4242

43-
private static List<File> EXAMPLE_PLUGINS = Collections.unmodifiableList(
43+
private static final List<File> EXAMPLE_PLUGINS = Collections.unmodifiableList(
4444
Arrays.stream(
4545
Objects.requireNonNull(System.getProperty("test.build-tools.plugin.examples"))
4646
.split(File.pathSeparator)
4747
).map(File::new).collect(Collectors.toList())
4848
);
4949

50+
private static final String BUILD_TOOLS_VERSION = Objects.requireNonNull(System.getProperty("test.version_under_test"));
51+
5052
@Rule
5153
public TemporaryFolder tmpDir = new TemporaryFolder();
5254

@@ -96,7 +98,8 @@ public void testCurrentExamplePlugin() throws IOException {
9698

9799
private void adaptBuildScriptForTest() throws IOException {
98100
// Add the local repo as a build script URL so we can pull in build-tools and apply the plugin under test
99-
// + is ok because we have no other repo and just want to pick up latest
101+
// we need to specify the exact version of build-tools because gradle automatically adds its plugin portal
102+
// which appears to mirror jcenter, opening us up to pulling a "later" version of build-tools
100103
writeBuildScript(
101104
"buildscript {\n" +
102105
" repositories {\n" +
@@ -105,7 +108,7 @@ private void adaptBuildScriptForTest() throws IOException {
105108
" }\n" +
106109
" }\n" +
107110
" dependencies {\n" +
108-
" classpath \"org.elasticsearch.gradle:build-tools:+\"\n" +
111+
" classpath \"org.elasticsearch.gradle:build-tools:" + BUILD_TOOLS_VERSION + "\"\n" +
109112
" }\n" +
110113
"}\n"
111114
);

0 commit comments

Comments
 (0)