Add support for releaser.git.release-train-branch
This avoids guessing the branch
This commit is contained in:
@@ -479,6 +479,7 @@ public class ReleaserProperties implements Serializable {
|
||||
/**
|
||||
* Branch to check out for the release train project.
|
||||
*/
|
||||
// TODO: seems to only be for gh-docs? we guess when we could use this?
|
||||
private String springProjectBranch;
|
||||
|
||||
/**
|
||||
@@ -486,6 +487,11 @@ public class ReleaserProperties implements Serializable {
|
||||
*/
|
||||
private String testSamplesBranch;
|
||||
|
||||
/**
|
||||
* Branch to check out for the release train.
|
||||
*/
|
||||
private String releaseTrainBranch;
|
||||
|
||||
/**
|
||||
* Branch to check out for the release train docs.
|
||||
*/
|
||||
@@ -736,6 +742,14 @@ public class ReleaserProperties implements Serializable {
|
||||
this.updateSpringProject = updateSpringProject;
|
||||
}
|
||||
|
||||
public String getReleaseTrainBranch() {
|
||||
return this.releaseTrainBranch;
|
||||
}
|
||||
|
||||
public void setReleaseTrainBranch(String releaseTrainBranch) {
|
||||
this.releaseTrainBranch = releaseTrainBranch;
|
||||
}
|
||||
|
||||
public String getReleaseTrainDocsUrl() {
|
||||
return this.releaseTrainDocsUrl;
|
||||
}
|
||||
@@ -813,6 +827,7 @@ public class ReleaserProperties implements Serializable {
|
||||
return "Git{" + "releaseTrainBomUrl='" + this.releaseTrainBomUrl + '\''
|
||||
+ ", documentationUrl='" + this.documentationUrl + '\''
|
||||
+ ", documentationBranch='" + this.documentationBranch + '\''
|
||||
+ ", releaseTrainBranch='" + this.releaseTrainBranch + '\''
|
||||
+ ", releaseTrainWikiUrl='" + this.releaseTrainWikiUrl + '\''
|
||||
+ ", updateDocumentationRepo=" + this.updateDocumentationRepo
|
||||
+ ", springProjectUrl=" + this.springProjectUrl
|
||||
|
||||
@@ -152,6 +152,18 @@ public class ProjectGitHandler implements Closeable {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Successfully cloned the project to [{}]", clonedProject);
|
||||
}
|
||||
String releaseTrainBranch = this.properties.getGit().getReleaseTrainBranch();
|
||||
if (!StringUtils.isEmpty(releaseTrainBranch)) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Checking out configured release train branch {}",
|
||||
releaseTrainBranch);
|
||||
}
|
||||
if (gitRepo(clonedProject).hasBranch(releaseTrainBranch)) {
|
||||
log.info("Branch [{}] exists. Will check it out", releaseTrainBranch);
|
||||
checkout(clonedProject, releaseTrainBranch);
|
||||
}
|
||||
return clonedProject;
|
||||
}
|
||||
String version = this.properties.getFixedVersions().get(projectName);
|
||||
if (StringUtils.isEmpty(version)) {
|
||||
throw new IllegalStateException(
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ProjectVersionTests {
|
||||
then(projectVersion("2.0.1.RC1").major()).isEqualTo("2");
|
||||
then(projectVersion("Finchley.SR1").major()).isEqualTo("Finchley");
|
||||
then(projectVersion("2020.0.0.M1").major()).isEqualTo("2020");
|
||||
//then(projectVersion("2020.0.0").major()).isEqualTo("2020");
|
||||
// then(projectVersion("2020.0.0").major()).isEqualTo("2020");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -315,8 +315,8 @@ public class ProjectVersionTests {
|
||||
public void should_return_true_when_checking_ga_version_against_ga() {
|
||||
then(projectVersion("1.0.1.RELEASE").isReleaseOrServiceRelease()).isTrue();
|
||||
then(projectVersion("1.0.1.SR1").isReleaseOrServiceRelease()).isTrue();
|
||||
//then(projectVersion("1.0.0").isReleaseOrServiceRelease()).isTrue();
|
||||
//then(projectVersion("1.0.1").isReleaseOrServiceRelease()).isTrue();
|
||||
// then(projectVersion("1.0.0").isReleaseOrServiceRelease()).isTrue();
|
||||
// then(projectVersion("1.0.1").isReleaseOrServiceRelease()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -184,6 +184,19 @@ public class ProjectGitHandlerTests {
|
||||
then(this.gitRepo).should().checkout("Finchley");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_check_out_a_branch_if_it_exists_when_cloning_from_org_and_its_a_release_train_version_with_release_train_branch_set() {
|
||||
this.properties.getGit().setReleaseTrainBranch("2020.0.x");
|
||||
this.properties.getFixedVersions().put("spring-cloud-release", "2020.0.0-M1");
|
||||
given(this.gitRepo.hasBranch(anyString())).willReturn(false);
|
||||
given(this.gitRepo.hasBranch("2020.0.x")).willReturn(true);
|
||||
|
||||
this.updater.cloneProjectFromOrg("spring-cloud-release");
|
||||
|
||||
then(this.gitRepo).should().checkout("2020.0.x");
|
||||
this.properties.getGit().setReleaseTrainBranch(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_not_check_out_a_branch_if_it_does_not_exist_when_cloning_and_guessing_branch() {
|
||||
given(this.gitRepo.hasBranch(anyString())).willReturn(true);
|
||||
|
||||
Reference in New Issue
Block a user