From 9874345551f141d9d07d0f7ea3d9bf03392f4ba8 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Tue, 23 Oct 2018 16:15:16 +0200 Subject: [PATCH] Running samples only for meta release --- README.adoc | 2 +- .../main/asciidoc/spring-cloud-release-tools.adoc | 2 +- .../release/internal/post/PostReleaseActions.java | 3 ++- .../internal/post/PostReleaseActionsTests.java | 14 +++++++++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index 014139a7..a4a6a90d 100644 --- a/README.adoc +++ b/README.adoc @@ -54,7 +54,6 @@ After project release - For `GA`/ `SR` release will create an issue in Spring Guides under https://github.com/spring-guides/getting-started-guides/issues/ - For `GA`/ `SR` release will update the links under https://github.com/spring-cloud/spring-cloud-static/tree/gh-pages/current - Will update the release train project page (for Spring Cloud it will be `https://github.com/spring-projects/spring-cloud`) -- Will update and run samples (for Spring Cloud it will be `https://github.com/spring-cloud/spring-cloud-core-tests`) ==== Meta-release @@ -64,6 +63,7 @@ After project release ** for `spring-cloud-sleuth`'s `2.1.0.RELEASE` version will resolve `2.1.x` branch - Performs the release tasks per each project - Performs the post release tasks at the end of the release +- Will update and run samples (for Spring Cloud it will be `https://github.com/spring-cloud/spring-cloud-core-tests`) IMPORTANT: For the meta-releaser to work we assume that the path to the custom configuration file for each project is always `config/releaser.yml`. diff --git a/docs/src/main/asciidoc/spring-cloud-release-tools.adoc b/docs/src/main/asciidoc/spring-cloud-release-tools.adoc index 59746edd..afa40ef4 100644 --- a/docs/src/main/asciidoc/spring-cloud-release-tools.adoc +++ b/docs/src/main/asciidoc/spring-cloud-release-tools.adoc @@ -44,7 +44,6 @@ After project release - For `GA`/ `SR` release will create an issue in Spring Guides under https://github.com/spring-guides/getting-started-guides/issues/ - For `GA`/ `SR` release will update the links under https://github.com/spring-cloud/spring-cloud-static/tree/gh-pages/current - Will update the release train project page (for Spring Cloud it will be `https://github.com/spring-projects/spring-cloud`) -- Will update and run samples (for Spring Cloud it will be `https://github.com/spring-cloud/spring-cloud-core-tests`) ==== Meta-release @@ -54,6 +53,7 @@ After project release ** for `spring-cloud-sleuth`'s `2.1.0.RELEASE` version will resolve `2.1.x` branch - Performs the release tasks per each project - Performs the post release tasks at the end of the release +- Will update and run samples (for Spring Cloud it will be `https://github.com/spring-cloud/spring-cloud-core-tests`) IMPORTANT: For the meta-releaser to work we assume that the path to the custom configuration file for each project is always `config/releaser.yml`. diff --git a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/post/PostReleaseActions.java b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/post/PostReleaseActions.java index ed075654..ed870c9b 100644 --- a/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/post/PostReleaseActions.java +++ b/spring-cloud-release-tools-core/src/main/java/org/springframework/cloud/release/internal/post/PostReleaseActions.java @@ -39,7 +39,8 @@ public class PostReleaseActions { * @param projects - set of project with versions to assert agains */ public void runUpdatedTests(Projects projects) { - if (!this.properties.getGit().isRunUpdatedSamples()) { + if (!this.properties.getGit().isRunUpdatedSamples() || + !this.properties.getMetaRelease().isEnabled()) { log.info("Will not update and run test samples, since the switch to do so " + "is off. Set [releaser.git.run-updated-samples] to [true] to change that"); return; diff --git a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/post/PostReleaseActionsTests.java b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/post/PostReleaseActionsTests.java index af6be01c..5bafa989 100644 --- a/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/post/PostReleaseActionsTests.java +++ b/spring-cloud-release-tools-core/src/test/java/org/springframework/cloud/release/internal/post/PostReleaseActionsTests.java @@ -50,7 +50,18 @@ public class PostReleaseActionsTests { } @Test - public void should_do_nothing_when_the_switch_is_off() { + public void should_do_nothing_when_is_not_meta_release() { + this.properties.getMetaRelease().setEnabled(false); + PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler, + this.updater, this.builder, this.properties); + + actions.runUpdatedTests(currentGa()); + + BDDAssertions.then(clonedTestSamples).isNull(); + } + + @Test + public void should_do_nothing_when_the_switch_for_sample_check_is_off() { this.properties.getGit().setRunUpdatedSamples(false); PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler, this.updater, this.builder, this.properties); @@ -62,6 +73,7 @@ public class PostReleaseActionsTests { @Test public void should_update_project_and_run_tests() { + this.properties.getMetaRelease().setEnabled(true); this.properties.getGit().setTestSamplesProjectUrl(tmpFile("spring-cloud-core-tests/").getAbsolutePath() + "/"); this.properties.getMaven().setBuildCommand("touch build.log"); PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,