Updated docs

This commit is contained in:
Marcin Grzejszczak
2018-10-30 11:58:25 +01:00
parent 874824be16
commit 2a33b26a3c
7 changed files with 58 additions and 17 deletions

View File

@@ -63,7 +63,9 @@ 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`)
- Will update and run smoke test samples (for Spring Cloud it will be `https://github.com/spring-cloud/spring-cloud-core-tests`)
- Will clone provided test samples and will update all versions to the latest ones
- Will clone the release train wiki and update it with the latest release versions (for Spring Cloud it will be `https://github.com/spring-projects/spring-cloud.wiki.git`)
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`.
@@ -288,10 +290,17 @@ The following properties are used for both meta release and a release of an indi
- `releaser.git.update-documentation-repo` - If `true` then will update documentation repository with the `current` URL. Defaults to `true`.
- `releaser.git.spring-project-url` - URL to the documentation Git repository. Defaults to `https://github.com/spring-projects/spring-cloud`.
- `releaser.git.spring-project-branch` - Branch to check out for the documentation project. Defaults to `gh-pages`.
- `releaser.git.update-spring-project` - If `true` then will update Spring Project page with the current release train values. Defaults to `true`.
- `releaser.sagan.update-sagan` - Branch to check out for the documentation project. Defaults to `gh-pages`.
- `releaser.git.update-spring-project` - If `true` then will update Project Sagan with the current release train values. Defaults to `true`.
- `releaser.git.test-samples-project-url` - URL to the test samples to be checked against the given release train. Defaults to `https://github.com/spring-cloud/spring-cloud-core-tests`.
- `releaser.git.test-samples-project-branch` - Branch to check out for test samples. Defaults to `master`.
- `releaser.git.release-train-wiki-url` - URL to the project's release train wiki page. Defaults to `https://github.com/spring-projects/spring-cloud.wiki.git`.
- `releaser.git.update-release-train-wiki` - If `true` then will update the release train wiki page with the current release train values. Defaults to `true`.
- `releaser.git.run-updated-samples` - If `true` then will update samples and run the the build. Defaults to `true`.
- `releaser.git.all-test-samples-urls` - URLs to the test samples to be cloned and updated with proper snapshot versions.
E.g. `"--releaser.git.all-test-samples-urls[spring-cloud-sleuth]=https://github.com/spring-cloud-samples/sleuth-issues/,https://github.com/spring-cloud-samples/sleuth-documentation-apps/"`.
Defaults to Sleuth and Contract samples.
- `releaser.git.update-all-test-samples` - If `true` then will update samples and run the the build. Defaults to `true`.
- `releaser.git.release-train-docs-url` - URL to the release train documentation. Defaults to `https://github.com/spring-cloud-sample/scripts`.
- `releaser.git.release-train-docs-branch` - Branch to check out for release train documentation. Defaults to `master`.
- `releaser.git.update-release-train-docs` - If `true` then will update the release train documentation project and run the generation. Defaults to `true`.

View File

@@ -55,6 +55,7 @@ After project release
- Performs the post release tasks at the end of the release
- Will update and run smoke test samples (for Spring Cloud it will be `https://github.com/spring-cloud/spring-cloud-core-tests`)
- Will clone provided test samples and will update all versions to the latest ones
- Will clone the release train wiki and update it with the latest release versions (for Spring Cloud it will be `https://github.com/spring-projects/spring-cloud.wiki.git`)
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`.
@@ -279,9 +280,12 @@ The following properties are used for both meta release and a release of an indi
- `releaser.git.update-documentation-repo` - If `true` then will update documentation repository with the `current` URL. Defaults to `true`.
- `releaser.git.spring-project-url` - URL to the documentation Git repository. Defaults to `https://github.com/spring-projects/spring-cloud`.
- `releaser.git.spring-project-branch` - Branch to check out for the documentation project. Defaults to `gh-pages`.
- `releaser.git.update-spring-project` - If `true` then will update Spring Project page with the current release train values. Defaults to `true`.
- `releaser.sagan.update-sagan` - Branch to check out for the documentation project. Defaults to `gh-pages`.
- `releaser.git.update-spring-project` - If `true` then will update Project Sagan with the current release train values. Defaults to `true`.
- `releaser.git.test-samples-project-url` - URL to the test samples to be checked against the given release train. Defaults to `https://github.com/spring-cloud/spring-cloud-core-tests`.
- `releaser.git.test-samples-project-branch` - Branch to check out for test samples. Defaults to `master`.
- `releaser.git.release-train-wiki-url` - URL to the project's release train wiki page. Defaults to `https://github.com/spring-projects/spring-cloud.wiki.git`.
- `releaser.git.update-release-train-wiki` - If `true` then will update the release train wiki page with the current release train values. Defaults to `true`.
- `releaser.git.run-updated-samples` - If `true` then will update samples and run the the build. Defaults to `true`.
- `releaser.git.all-test-samples-urls` - URLs to the test samples to be cloned and updated with proper snapshot versions.
E.g. `"--releaser.git.all-test-samples-urls[spring-cloud-sleuth]=https://github.com/spring-cloud-samples/sleuth-issues/,https://github.com/spring-cloud-samples/sleuth-documentation-apps/"`.

View File

@@ -734,6 +734,12 @@ public class ReleaserProperties implements Serializable {
}
public static class Sagan implements Serializable {
/**
* If set to {@code false} will not update Sagan
*/
private boolean updateSagan = true;
/**
* URL to the Sagan API
*/
@@ -747,6 +753,14 @@ public class ReleaserProperties implements Serializable {
this.baseUrl = baseUrl;
}
public boolean isUpdateSagan() {
return this.updateSagan;
}
public void setUpdateSagan(boolean updateSagan) {
this.updateSagan = updateSagan;
}
@Override public String toString() {
return "Sagan{" + "baseUrl='" + this.baseUrl + '\'' + '}';
}

View File

@@ -4,6 +4,8 @@ import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.release.internal.ReleaserProperties;
import org.springframework.cloud.release.internal.pom.ProjectVersion;
import edu.emory.mathcs.backport.java.util.Collections;
@@ -16,12 +18,19 @@ public class SaganUpdater {
private static final Logger log = LoggerFactory.getLogger(SaganUpdater.class);
private final SaganClient saganClient;
private final ReleaserProperties releaserProperties;
public SaganUpdater(SaganClient saganClient) {
public SaganUpdater(SaganClient saganClient, ReleaserProperties releaserProperties) {
this.saganClient = saganClient;
this.releaserProperties = releaserProperties;
}
public void updateSagan(String branch, ProjectVersion originalVersion, ProjectVersion version) {
if (!releaserProperties.getSagan().isUpdateSagan()) {
log.info("Will not update sagan, since the switch to do so "
+ "is off. Set [releaser.sagan.update-sagan] to [true] to change that");
return;
}
ReleaseUpdate update = releaseUpdate(branch, originalVersion, version);
updateSaganForNonSnapshot(branch, originalVersion, version);
log.info("Updating Sagan with \n\n{}", update);

View File

@@ -3,16 +3,13 @@ package org.springframework.cloud.release.internal.sagan;
import java.util.Arrays;
import java.util.List;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatcher;
import org.mockito.BDDMockito;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.Mockito;
import org.springframework.cloud.release.internal.ReleaserProperties;
import org.springframework.cloud.release.internal.pom.ProjectVersion;
import static org.mockito.BDDMockito.then;
@@ -22,11 +19,11 @@ import static org.mockito.Mockito.never;
/**
* @author Marcin Grzejszczak
*/
@RunWith(MockitoJUnitRunner.class)
public class SaganUpdaterTest {
@Mock SaganClient saganClient;
@InjectMocks SaganUpdater saganUpdater;
SaganClient saganClient = Mockito.mock(SaganClient.class);
ReleaserProperties properties = new ReleaserProperties();
SaganUpdater saganUpdater = new SaganUpdater(this.saganClient, this.properties);
@Before
public void setup() {
@@ -47,6 +44,14 @@ public class SaganUpdaterTest {
return release;
}
@Test public void should_not_update_sagan_when_switch_is_off() throws Exception {
this.properties.getSagan().setUpdateSagan(false);
this.saganUpdater.updateSagan("master", version("1.0.0.M1"), version("1.0.0.M1"));
then(this.saganClient).shouldHaveZeroInteractions();
}
@Test public void should_update_sagan_for_milestone() throws Exception {
this.saganUpdater.updateSagan("master", version("1.0.0.M1"), version("1.0.0.M1"));

View File

@@ -72,8 +72,8 @@ class ReleaserConfiguration {
}
@Bean
SaganUpdater saganUpdater(SaganClient saganClient) {
return new SaganUpdater(saganClient);
SaganUpdater saganUpdater(SaganClient saganClient, ReleaserProperties releaserProperties) {
return new SaganUpdater(saganClient, releaserProperties);
}
@Bean

View File

@@ -628,7 +628,7 @@ public class AcceptanceTests {
expectedVersion, projectName);
TemplateGenerator templateGenerator = new TemplateGenerator(properties, handler);
GradleUpdater gradleUpdater = new GradleUpdater(properties);
SaganUpdater saganUpdater = new SaganUpdater(this.saganClient);
SaganUpdater saganUpdater = new SaganUpdater(this.saganClient, releaserProperties);
DocumentationUpdater documentationUpdater = new TestDocumentationUpdater(properties,
new TestDocumentationUpdater.TestProjectDocumentationUpdater(properties, handler, "Brixton.SR1"),
new TestDocumentationUpdater.TestReleaseContentsUpdater(properties, handler, templateGenerator)) {
@@ -651,7 +651,7 @@ public class AcceptanceTests {
NonAssertingTestProjectGitHandler handler = new NonAssertingTestProjectGitHandler(properties);
TemplateGenerator templateGenerator = Mockito.spy(new TemplateGenerator(properties, handler));
GradleUpdater gradleUpdater = new GradleUpdater(properties);
SaganUpdater saganUpdater = Mockito.spy(new SaganUpdater(this.saganClient));
SaganUpdater saganUpdater = Mockito.spy(new SaganUpdater(this.saganClient, releaserProperties));
DocumentationUpdater documentationUpdater = Mockito.spy(new TestDocumentationUpdater(properties,
new TestDocumentationUpdater.TestProjectDocumentationUpdater(properties, handler, "Brixton.SR1"),
new TestDocumentationUpdater.TestReleaseContentsUpdater(properties, handler, templateGenerator) {