Added a switch for samples

This commit is contained in:
Marcin Grzejszczak
2018-10-23 15:25:09 +02:00
parent 349cb0f88c
commit f9f8282539
2 changed files with 23 additions and 0 deletions

View File

@@ -218,6 +218,11 @@ public class ReleaserProperties implements Serializable {
*/
private boolean updateSpringProject = true;
/**
* If set to {@code false}, will not update the test samples
*/
private boolean runUpdatedSamples = true;
public String getReleaseTrainBomUrl() {
return this.releaseTrainBomUrl;
}
@@ -282,6 +287,14 @@ public class ReleaserProperties implements Serializable {
this.updateDocumentationRepo = updateDocumentationRepo;
}
public boolean isRunUpdatedSamples() {
return this.runUpdatedSamples;
}
public void setRunUpdatedSamples(boolean runUpdatedSamples) {
this.runUpdatedSamples = runUpdatedSamples;
}
public String getCloneDestinationDir() {
return this.cloneDestinationDir;
}

View File

@@ -2,6 +2,9 @@ package org.springframework.cloud.release.internal.post;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.release.internal.ReleaserProperties;
import org.springframework.cloud.release.internal.git.ProjectGitHandler;
import org.springframework.cloud.release.internal.pom.ProjectPomUpdater;
@@ -14,6 +17,8 @@ import org.springframework.cloud.release.internal.project.ProjectBuilder;
*/
public class PostReleaseActions {
private static final Logger log = LoggerFactory.getLogger(PostReleaseActions.class);
private final ProjectGitHandler projectGitHandler;
private final ProjectPomUpdater projectPomUpdater;
private final ProjectBuilder projectBuilder;
@@ -34,6 +39,11 @@ public class PostReleaseActions {
* @param projects - set of project with versions to assert agains
*/
public void runUpdatedTests(Projects projects) {
if (!this.properties.getGit().isRunUpdatedSamples()) {
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;
}
File file = this.projectGitHandler.cloneTestSamplesProject();
ProjectVersion projectVersion = new ProjectVersion(file);
Projects newProjects = addVersionForTestsProject(projects, projectVersion);