Should fix issues ith post processing

This commit is contained in:
Marcin Grzejszczak
2020-02-03 09:42:13 +01:00
parent 987e800213
commit 7497446dfe
5 changed files with 30 additions and 22 deletions

View File

@@ -66,8 +66,8 @@ class SpringCloudCustomProjectDocumentationUpdater
ProjectVersion releaseTrainProject = new ProjectVersion(
this.releaserProperties.getMetaRelease().getReleaseTrainProjectName(),
branchToReleaseVersion(bomBranch));
File currentReleaseFolder = new File(clonedDocumentationProject, currentFolder(
releaseTrainProject.projectName, releaseTrainProject.version));
File currentReleaseFolder = new File(clonedDocumentationProject,
currentFolder(releaseTrainProject));
// remove the old way
removeAFolderWithRedirection(currentReleaseFolder);
File docsRepo = updateTheDocsRepo(releaseTrainProject, clonedDocumentationProject,
@@ -93,19 +93,20 @@ class SpringCloudCustomProjectDocumentationUpdater
}
log.info("Updating link to documentation for project [{}]",
currentProject.projectName);
ProjectVersion projectVersion = projects.forName(currentProject.projectName);
ProjectVersion currentProjectVersion = projects
.forName(currentProject.projectName);
File currentProjectReleaseFolder = new File(clonedDocumentationProject,
currentFolder(projectVersion.projectName, projectVersion.version));
currentFolder(currentProjectVersion));
removeAFolderWithRedirection(currentProjectReleaseFolder);
try {
updateTheDocsRepo(projectVersion, clonedDocumentationProject,
updateTheDocsRepo(currentProjectVersion, clonedDocumentationProject,
currentProjectReleaseFolder);
log.info("Processed [{}] for project with name [{}]",
currentProjectReleaseFolder, projectVersion.projectName);
currentProjectReleaseFolder, currentProjectVersion.projectName);
}
catch (Exception ex) {
log.warn("Exception occurred while trying o update the symlink of a project ["
+ projectVersion.projectName + "]", ex);
+ currentProjectVersion.projectName + "]", ex);
}
return pushChanges(clonedDocumentationProject);
}
@@ -120,9 +121,17 @@ class SpringCloudCustomProjectDocumentationUpdater
return Files.isSymbolicLink(currentFolder.toPath());
}
private String currentFolder(String projectName, String projectVersion) {
boolean releaseTrain = new ProjectVersion(projectName, projectVersion)
.isReleaseTrain();
private String currentFolder(ProjectVersion currentProjectVersion) {
String projectName = currentProjectVersion.projectName;
boolean releaseTrain;
try {
releaseTrain = currentProjectVersion.isReleaseTrain();
}
catch (IllegalStateException ex) {
log.warn("Exception occurred while trying to resolve if version ["
+ currentProjectVersion + "] is a release train", ex);
releaseTrain = false;
}
// release train -> static/current
// project -> static/spring-cloud-sleuth/current
return releaseTrain ? "current"

View File

@@ -402,8 +402,8 @@ public class Releaser implements ReleaserPropertiesAware {
public ExecutionResult updateDocumentationRepositoryForSingleProject(
Projects projects, ProjectVersion releaseVersion) {
if (releaseVersion.projectName.equals(
this.releaserProperties.getMetaRelease().getReleaseTrainProjectName())) {
if (releaseVersion.projectName
.equals(projects.releaseTrain(this.releaserProperties).projectName)) {
log.info("Will not update documentation for project that is a BOM project");
return ExecutionResult.skipped();
}

View File

@@ -218,8 +218,7 @@ public class PostReleaseActions implements Closeable {
private void commitUpdatedProject(Projects projects, String key,
ProjectVersion projectVersionForReleaseTrain, Projects postRelease,
String url) {
String releaseTrainVersion = projects.forName(
this.properties.getMetaRelease().getReleaseTrainProjectName()).version;
String releaseTrainVersion = projects.releaseTrain(this.properties).version;
String projectVersion = projects.forName(key).version;
log.info(
"Running version update for project [{}], url [{}], "

View File

@@ -498,8 +498,8 @@ public class ProjectVersion implements Comparable<ProjectVersion>, Serializable
private void assertIfValid() {
if (isInvalid()) {
throw new IllegalStateException(
"Version is invalid. Should be of format [1.2.3.A] / [1.2.3-A] or [A.B] / [A-B]");
throw new IllegalStateException("Version [" + print()
+ "] is invalid. Should be of format [1.2.3.A] / [1.2.3-A] or [A.B] / [A-B]");
}
}

View File

@@ -86,8 +86,8 @@ public class ProjectVersionTests {
String version = "1.0";
thenThrownBy(() -> projectVersion(version).bumpedVersion())
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Version is invalid");
.isInstanceOf(IllegalStateException.class).hasMessageContaining(
"Version [1.0] is invalid. Should be of format [1.2.3.A] / [1.2.3-A] or [A.B] / [A-B]");
}
@Test
@@ -126,8 +126,8 @@ public class ProjectVersionTests {
String version = "1.0";
thenThrownBy(() -> projectVersion(version).postReleaseSnapshotVersion())
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Version is invalid");
.isInstanceOf(IllegalStateException.class).hasMessageContaining(
"Version [1.0] is invalid. Should be of format [1.2.3.A] / [1.2.3-A] or [A.B] / [A-B]");
}
@Test
@@ -135,8 +135,8 @@ public class ProjectVersionTests {
String version = "1.0";
thenThrownBy(() -> projectVersion(version).major())
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Version is invalid");
.isInstanceOf(IllegalStateException.class).hasMessageContaining(
"Version [1.0] is invalid. Should be of format [1.2.3.A] / [1.2.3-A] or [A.B] / [A-B]");
}
@Test