Spring Boot 3 migration (#255)
* It compiles * WIP * Upgraded jdk to 17: * Added tests for Github repo * Modified the sagan client * Updated versions
This commit is contained in:
committed by
GitHub
parent
a0b43f5ac6
commit
aa5d636de3
@@ -139,31 +139,31 @@ class SpringCloudMavenBomParser implements CustomBomParser {
|
||||
public Set<Project> setVersion(Set<Project> projects, String projectName, String version) {
|
||||
Set<Project> newProjects = new LinkedHashSet<>(projects);
|
||||
switch (projectName) {
|
||||
case SPRING_BOOT:
|
||||
case BOOT_STARTER_ARTIFACT_ID:
|
||||
case BOOT_STARTER_PARENT_ARTIFACT_ID:
|
||||
case BOOT_DEPENDENCIES_ARTIFACT_ID:
|
||||
updateBootVersions(newProjects, version);
|
||||
break;
|
||||
case BUILD_ARTIFACT_ID:
|
||||
case CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID:
|
||||
updateBuildVersions(newProjects, version);
|
||||
break;
|
||||
case CLOUD_ARTIFACT_ID:
|
||||
case CLOUD_DEPENDENCIES_ARTIFACT_ID:
|
||||
case CLOUD_RELEASE_ARTIFACT_ID:
|
||||
case CLOUD_STARTER_ARTIFACT_ID:
|
||||
case CLOUD_STARTER_PARENT_ARTIFACT_ID:
|
||||
case CLOUD_STARTER_BUILD_ARTIFACT_ID:
|
||||
updateSpringCloudVersions(newProjects, version);
|
||||
break;
|
||||
case STREAM_DEPS_ARTIFACT_ID:
|
||||
case STREAM_STARTER_ARTIFACT_ID:
|
||||
case STREAM_STARTER_BUILD_ARTIFACT_ID:
|
||||
case STREAM_STARTER_PARENT_ARTIFACT_ID:
|
||||
case STREAM_DOCS_ARTIFACT_ID:
|
||||
updateStreamVersions(newProjects, version);
|
||||
break;
|
||||
case SPRING_BOOT:
|
||||
case BOOT_STARTER_ARTIFACT_ID:
|
||||
case BOOT_STARTER_PARENT_ARTIFACT_ID:
|
||||
case BOOT_DEPENDENCIES_ARTIFACT_ID:
|
||||
updateBootVersions(newProjects, version);
|
||||
break;
|
||||
case BUILD_ARTIFACT_ID:
|
||||
case CLOUD_DEPENDENCIES_PARENT_ARTIFACT_ID:
|
||||
updateBuildVersions(newProjects, version);
|
||||
break;
|
||||
case CLOUD_ARTIFACT_ID:
|
||||
case CLOUD_DEPENDENCIES_ARTIFACT_ID:
|
||||
case CLOUD_RELEASE_ARTIFACT_ID:
|
||||
case CLOUD_STARTER_ARTIFACT_ID:
|
||||
case CLOUD_STARTER_PARENT_ARTIFACT_ID:
|
||||
case CLOUD_STARTER_BUILD_ARTIFACT_ID:
|
||||
updateSpringCloudVersions(newProjects, version);
|
||||
break;
|
||||
case STREAM_DEPS_ARTIFACT_ID:
|
||||
case STREAM_STARTER_ARTIFACT_ID:
|
||||
case STREAM_STARTER_BUILD_ARTIFACT_ID:
|
||||
case STREAM_STARTER_PARENT_ARTIFACT_ID:
|
||||
case STREAM_DOCS_ARTIFACT_ID:
|
||||
updateStreamVersions(newProjects, version);
|
||||
break;
|
||||
}
|
||||
return newProjects;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package releaser.cloud.github;
|
||||
|
||||
import com.jcabi.github.Github;
|
||||
import org.kohsuke.github.GitHub;
|
||||
import releaser.internal.ReleaserProperties;
|
||||
import releaser.internal.github.CustomGithubIssues;
|
||||
import releaser.internal.github.GithubIssueFiler;
|
||||
@@ -38,25 +38,41 @@ class SpringCloudGithubIssues implements CustomGithubIssues {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
SpringCloudGithubIssues(Github github, ReleaserProperties properties) {
|
||||
SpringCloudGithubIssues(GitHub github, ReleaserProperties properties) {
|
||||
this.githubIssueFiler = new GithubIssueFiler(github, properties);
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileIssueInSpringGuides(Projects projects, ProjectVersion version) {
|
||||
String user = "spring-guides";
|
||||
String repo = "getting-started-guides";
|
||||
String user = getGuidesOrg();
|
||||
String repo = getGuidesRepo();
|
||||
this.githubIssueFiler.fileAGitHubIssue(user, repo, version, issueTitle(), guidesIssueText(projects));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileIssueInStartSpringIo(Projects projects, ProjectVersion version) {
|
||||
String user = "spring-io";
|
||||
String repo = "start.spring.io";
|
||||
String user = getStartSpringIoOrg();
|
||||
String repo = getStartSpringIoRepo();
|
||||
this.githubIssueFiler.fileAGitHubIssue(user, repo, version, issueTitle(), startSpringIoIssueText(projects));
|
||||
}
|
||||
|
||||
String getGuidesOrg() {
|
||||
return "spring-guides";
|
||||
}
|
||||
|
||||
String getGuidesRepo() {
|
||||
return "getting-started-guides";
|
||||
}
|
||||
|
||||
String getStartSpringIoOrg() {
|
||||
return "spring-io";
|
||||
}
|
||||
|
||||
String getStartSpringIoRepo() {
|
||||
return "start.spring.io";
|
||||
}
|
||||
|
||||
private String issueTitle() {
|
||||
return String.format(GITHUB_ISSUE_TITLE, StringUtils.capitalize(parsedVersion()));
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@ releaser:
|
||||
update-release-train-wiki: true
|
||||
update-all-test-samples: true
|
||||
all-test-sample-urls:
|
||||
spring-cloud-sleuth:
|
||||
- https://github.com/spring-cloud-samples/sleuth-issues
|
||||
- https://github.com/spring-cloud-samples/sleuth-documentation-apps
|
||||
- https://github.com/spring-cloud-samples/spring-cloud-sleuth-samples
|
||||
spring-cloud-contract:
|
||||
- https://github.com/spring-cloud-samples/spring-cloud-contract-samples
|
||||
- https://github.com/spring-cloud-samples/the-legacy-app
|
||||
@@ -101,7 +97,7 @@ releaser:
|
||||
enabled: true
|
||||
template-folder: cloud
|
||||
versions:
|
||||
all-versions-file-url: https://raw.githubusercontent.com/spring-io/start.spring.io/master/start-site/src/main/resources/application.yml
|
||||
all-versions-file-url: https://raw.githubusercontent.com/spring-io/start.spring.io/main/start-site/src/main/resources/application.yml
|
||||
bom-name: spring-cloud
|
||||
# fixed-versions:
|
||||
meta-release:
|
||||
|
||||
@@ -23,8 +23,6 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -45,7 +43,7 @@ import org.springframework.util.FileSystemUtils;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
|
||||
File project;
|
||||
|
||||
@@ -61,7 +59,7 @@ public class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
ReleaserProperties properties = SpringCloudReleaserProperties.get();
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws IOException, URISyntaxException {
|
||||
void setup() throws IOException, URISyntaxException {
|
||||
this.project = new File(SpringCloudCustomProjectDocumentationUpdater.class
|
||||
.getResource("/projects/spring-cloud-static").toURI());
|
||||
TestUtils.prepareLocalRepo();
|
||||
@@ -73,19 +71,17 @@ public class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
Collections.singletonList(SpringCloudGithubIssuesAccessor.springCloud(this.properties)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private DocumentationUpdater projectDocumentationUpdater(ReleaserProperties properties) {
|
||||
return new DocumentationUpdater(this.handler, properties, templateGenerator(properties),
|
||||
Collections.singletonList(new SpringCloudCustomProjectDocumentationUpdater(this.handler, properties)));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TemplateGenerator templateGenerator(ReleaserProperties properties) {
|
||||
return new TemplateGenerator(properties, this.gitHubHandler);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_not_update_current_version_in_the_docs_if_current_release_starts_with_v_and_then_lower_letter_than_the_stored_release()
|
||||
void should_not_update_current_version_in_the_docs_if_current_release_starts_with_v_and_then_lower_letter_than_the_stored_release()
|
||||
throws URISyntaxException, IOException {
|
||||
ProjectVersion releaseTrainVersion = new ProjectVersion("spring-cloud-release", "Finchley.SR33");
|
||||
ReleaserProperties properties = new ReleaserProperties();
|
||||
@@ -114,7 +110,7 @@ public class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_not_commit_if_the_same_version_is_already_there() {
|
||||
void should_not_commit_if_the_same_version_is_already_there() {
|
||||
ProjectVersion releaseTrainVersion = new ProjectVersion("spring-cloud-release", "Dalston.SR3");
|
||||
ReleaserProperties properties = new ReleaserProperties();
|
||||
properties.getGit().setDocumentationUrl(this.clonedDocProject.toURI().toString());
|
||||
@@ -127,7 +123,7 @@ public class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_do_nothing_when_release_train_docs_update_happen_for_a_project_that_does_not_start_with_spring_cloud() {
|
||||
void should_do_nothing_when_release_train_docs_update_happen_for_a_project_that_does_not_start_with_spring_cloud() {
|
||||
ProjectVersion springBootVersion = new ProjectVersion("spring-boot", "2.2.5");
|
||||
ReleaserProperties properties = new ReleaserProperties();
|
||||
properties.getGit().setDocumentationUrl(this.clonedDocProject.toURI().toString());
|
||||
@@ -140,7 +136,7 @@ public class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_do_nothing_when_single_project_docs_update_happen_for_a_project_that_does_not_start_with_spring_cloud() {
|
||||
void should_do_nothing_when_single_project_docs_update_happen_for_a_project_that_does_not_start_with_spring_cloud() {
|
||||
ProjectVersion springBootVersion = new ProjectVersion("spring-boot", "2.2.5");
|
||||
ReleaserProperties properties = new ReleaserProperties();
|
||||
properties.getGit().setDocumentationUrl(this.clonedDocProject.toURI().toString());
|
||||
@@ -153,7 +149,7 @@ public class SpringCloudCustomProjectDocumentationUpdaterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_not_update_current_version_in_the_docs_if_current_release_starts_with_lower_letter_than_the_stored_release()
|
||||
void should_not_update_current_version_in_the_docs_if_current_release_starts_with_lower_letter_than_the_stored_release()
|
||||
throws IOException {
|
||||
ProjectVersion releaseTrainVersion = new ProjectVersion("spring-cloud-release", "Angel.SR33");
|
||||
ReleaserProperties properties = new ReleaserProperties();
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package releaser.cloud.github;
|
||||
|
||||
import com.jcabi.github.Github;
|
||||
import org.kohsuke.github.GitHub;
|
||||
import releaser.internal.ReleaserProperties;
|
||||
import releaser.internal.github.CustomGithubIssues;
|
||||
|
||||
public class SpringCloudGithubIssuesAccessor {
|
||||
|
||||
public static CustomGithubIssues springCloud(Github github, ReleaserProperties releaserProperties) {
|
||||
public static CustomGithubIssues springCloud(GitHub github, ReleaserProperties releaserProperties) {
|
||||
return new SpringCloudGithubIssues(github, releaserProperties);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package releaser.cloud.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.jcabi.github.Coordinates;
|
||||
import com.jcabi.github.Github;
|
||||
import com.jcabi.github.Issue;
|
||||
import com.jcabi.github.Repo;
|
||||
import com.jcabi.github.Repos;
|
||||
import com.jcabi.github.mock.MkGithub;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.BDDMockito;
|
||||
import releaser.cloud.SpringCloudReleaserProperties;
|
||||
import releaser.internal.ReleaserProperties;
|
||||
import releaser.internal.github.CustomGithubIssues;
|
||||
import releaser.internal.project.ProjectVersion;
|
||||
import releaser.internal.project.Projects;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.assertj.core.api.BDDAssertions.thenThrownBy;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public class SpringCloudGithubIssuesTests {
|
||||
|
||||
ReleaserProperties properties = SpringCloudReleaserProperties.get();
|
||||
|
||||
MkGithub github;
|
||||
|
||||
Repo repo;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws IOException {
|
||||
this.github = github("spring-guides");
|
||||
this.properties.getGit().setOauthToken("a");
|
||||
this.repo = createGettingStartedGuides(this.github);
|
||||
}
|
||||
|
||||
public void setupStartSpringIo() throws IOException {
|
||||
this.github = github("spring-io");
|
||||
this.repo = createStartSpringIo(this.github);
|
||||
}
|
||||
|
||||
private MkGithub github(String login) throws IOException {
|
||||
return new MkGithub(login);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_not_do_anything_for_non_release_train_version() {
|
||||
Github github = BDDMockito.mock(Github.class);
|
||||
CustomGithubIssues githubIssues = new SpringCloudGithubIssues(github, properties);
|
||||
|
||||
githubIssues.fileIssueInSpringGuides(
|
||||
new Projects(new ProjectVersion("foo", "1.0.0.BUILD-SNAPSHOT"),
|
||||
new ProjectVersion("spring-cloud-build", "2.0.0.BUILD-SNAPSHOT")),
|
||||
new ProjectVersion("sc-release", "Edgware.BUILD-SNAPSHOT"));
|
||||
|
||||
BDDMockito.then(github).shouldHaveNoInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_file_an_issue_for_release_version() throws IOException {
|
||||
CustomGithubIssues issues = new SpringCloudGithubIssues(github, properties);
|
||||
properties.getPom().setBranch("vEdgware.RELEASE");
|
||||
|
||||
issues.fileIssueInSpringGuides(
|
||||
new Projects(new ProjectVersion("spring-cloud-foo", "1.0.0.RELEASE"),
|
||||
new ProjectVersion("spring-cloud-build", "2.0.0.RELEASE"),
|
||||
new ProjectVersion("bar", "2.0.0.RELEASE"), new ProjectVersion("baz", "3.0.0.RELEASE")),
|
||||
new ProjectVersion("sc-release", "Edgware.RELEASE"));
|
||||
|
||||
Issue issue = this.github.repos().get(new Coordinates.Simple("spring-guides", "getting-started-guides"))
|
||||
.issues().get(1);
|
||||
then(issue.exists()).isTrue();
|
||||
Issue.Smart smartIssue = new Issue.Smart(issue);
|
||||
then(smartIssue.title()).isEqualTo("Upgrade to Spring Cloud Edgware.RELEASE");
|
||||
then(smartIssue.body()).contains(
|
||||
"Release train [spring-cloud-release] in version [Edgware.RELEASE] released with the following projects")
|
||||
.contains("spring-cloud-foo : `1.0.0.RELEASE`").contains("bar : `2.0.0.RELEASE`")
|
||||
.contains("baz : `3.0.0.RELEASE`");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_throw_exception_when_no_token_was_passed() {
|
||||
properties.getGit().setOauthToken("");
|
||||
CustomGithubIssues issues = new SpringCloudGithubIssues(github, properties);
|
||||
|
||||
thenThrownBy(() -> issues.fileIssueInSpringGuides(
|
||||
new Projects(Collections.singletonList(new ProjectVersion("spring-cloud-build", "2.0.0.RELEASE"))),
|
||||
nonGaSleuthProject())).isInstanceOf(IllegalArgumentException.class).hasMessageContaining(
|
||||
"You have to pass Github OAuth token for milestone closing to be operational");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_not_do_anything_for_non_release_train_version_when_updating_startspringio() throws IOException {
|
||||
setupStartSpringIo();
|
||||
Github github = BDDMockito.mock(Github.class);
|
||||
CustomGithubIssues issues = new SpringCloudGithubIssues(github, properties);
|
||||
|
||||
issues.fileIssueInStartSpringIo(
|
||||
new Projects(new ProjectVersion("foo", "1.0.0.BUILD-SNAPSHOT"),
|
||||
new ProjectVersion("spring-cloud-build", "2.0.0.RELEASE")),
|
||||
new ProjectVersion("sc-release", "Edgware.BUILD-SNAPSHOT"));
|
||||
|
||||
BDDMockito.then(github).shouldHaveNoInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_file_an_issue_for_release_version_when_updating_startspringio() throws IOException {
|
||||
setupStartSpringIo();
|
||||
CustomGithubIssues issues = new SpringCloudGithubIssues(github, properties);
|
||||
properties.getPom().setBranch("vEdgware.RELEASE");
|
||||
|
||||
issues.fileIssueInStartSpringIo(new Projects(new ProjectVersion("spring-cloud-foo", "1.0.0.RELEASE"),
|
||||
new ProjectVersion("spring-cloud-build", "2.0.0.RELEASE"), new ProjectVersion("bar", "2.0.0.RELEASE"),
|
||||
new ProjectVersion("baz", "3.0.0.RELEASE"), new ProjectVersion("spring-boot", "1.2.3.RELEASE")),
|
||||
new ProjectVersion("sc-release", "Edgware.RELEASE"));
|
||||
|
||||
Issue issue = this.github.repos().get(new Coordinates.Simple("spring-io", "start.spring.io")).issues().get(1);
|
||||
then(issue.exists()).isTrue();
|
||||
Issue.Smart smartIssue = new Issue.Smart(issue);
|
||||
then(smartIssue.title()).isEqualTo("Upgrade to Spring Cloud Edgware.RELEASE");
|
||||
then(smartIssue.body()).contains(
|
||||
"Release train [spring-cloud-release] in version [Edgware.RELEASE] released with the Spring Boot version [`1.2.3.RELEASE`]");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_throw_exception_when_no_token_was_passed_when_updating_startspringio() throws IOException {
|
||||
setupStartSpringIo();
|
||||
properties.getGit().setOauthToken("");
|
||||
CustomGithubIssues issues = new SpringCloudGithubIssues(github, properties);
|
||||
|
||||
thenThrownBy(() -> issues.fileIssueInStartSpringIo(
|
||||
new Projects(Collections.singletonList(new ProjectVersion("spring-cloud-build", "2.0.0.RELEASE"))),
|
||||
nonGaSleuthProject())).isInstanceOf(IllegalArgumentException.class).hasMessageContaining(
|
||||
"You have to pass Github OAuth token for milestone closing to be operational");
|
||||
}
|
||||
|
||||
private Repo createGettingStartedGuides(MkGithub github) throws IOException {
|
||||
return github.repos().create(new Repos.RepoCreate("getting-started-guides", false));
|
||||
}
|
||||
|
||||
private Repo createStartSpringIo(MkGithub github) throws IOException {
|
||||
return github.repos().create(new Repos.RepoCreate("start.spring.io", false));
|
||||
}
|
||||
|
||||
private ProjectVersion nonGaSleuthProject() {
|
||||
return new ProjectVersion("spring-cloud-sleuth", "0.2.0.BUILD-SNAPSHOT");
|
||||
}
|
||||
|
||||
ReleaserProperties withToken() {
|
||||
ReleaserProperties properties = SpringCloudReleaserProperties.get();
|
||||
properties.getGit().setOauthToken("foo");
|
||||
properties.getPom().setBranch("vEdgware.RELEASE");
|
||||
properties.getGit().setUpdateSpringGuides(true);
|
||||
properties.getGit().setUpdateStartSpringIo(true);
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user