Skip to content

Commit edf67e5

Browse files
committed
Merge branch '2.4.x'
Closes gh-24502
2 parents f9e44cd + 923ddd3 commit edf67e5

File tree

7 files changed

+18
-19
lines changed

7 files changed

+18
-19
lines changed

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/PublishToSdkmanCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public void run(ApplicationArguments args) throws Exception {
6464
String version = nonOptionArgs.get(2);
6565
boolean makeDefault = false;
6666
if (nonOptionArgs.size() == 4) {
67-
String releaseBranch = nonOptionArgs.get(3);
68-
makeDefault = ("master".equals(releaseBranch));
67+
makeDefault = Boolean.parseBoolean(nonOptionArgs.get(3));
6968
}
7069
this.service.publish(version, makeDefault);
7170
}

ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/sdkman/SdkmanService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private void broadcast(String version) {
7878
private void makeDefault(String version) {
7979
logger.debug("Making this version the default");
8080
Request request = new Request(version);
81-
RequestEntity<Request> requestEntity = RequestEntity.post(URI.create(SDKMAN_URL + "default"))
81+
RequestEntity<Request> requestEntity = RequestEntity.put(URI.create(SDKMAN_URL + "default"))
8282
.header(CONSUMER_KEY_HEADER, this.properties.getConsumerKey())
8383
.header(CONSUMER_TOKEN_HEADER, this.properties.getConsumerToken())
8484
.contentType(MediaType.APPLICATION_JSON).body(request);

ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/command/PublishToSdkmanCommandTests.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,42 +51,36 @@ void setup() {
5151
@Test
5252
void runWhenReleaseTypeNotSpecifiedShouldThrowException() throws Exception {
5353
Assertions.assertThatIllegalStateException()
54-
.isThrownBy(() -> this.command.run(new DefaultApplicationArguments("publishGradlePlugin")));
54+
.isThrownBy(() -> this.command.run(new DefaultApplicationArguments("publishToSdkman")));
5555
}
5656

5757
@Test
5858
void runWhenVersionNotSpecifiedShouldThrowException() throws Exception {
5959
Assertions.assertThatIllegalStateException()
60-
.isThrownBy(() -> this.command.run(new DefaultApplicationArguments("publishGradlePlugin", "RELEASE")));
60+
.isThrownBy(() -> this.command.run(new DefaultApplicationArguments("publishToSdkman", "RELEASE")));
6161
}
6262

6363
@Test
6464
void runWhenReleaseTypeMilestoneShouldDoNothing() throws Exception {
65-
this.command.run(new DefaultApplicationArguments("publishGradlePlugin", "M", "1.2.3"));
65+
this.command.run(new DefaultApplicationArguments("publishToSdkman", "M", "1.2.3"));
6666
verifyNoInteractions(this.service);
6767
}
6868

6969
@Test
7070
void runWhenReleaseTypeRCShouldDoNothing() throws Exception {
71-
this.command.run(new DefaultApplicationArguments("publishGradlePlugin", "RC", "1.2.3"));
71+
this.command.run(new DefaultApplicationArguments("publishToSdkman", "RC", "1.2.3"));
7272
verifyNoInteractions(this.service);
7373
}
7474

7575
@Test
76-
void runWhenBranchNotSpecifiedShouldCallServiceWithMakeDefaultFalse() throws Exception {
76+
void runWhenLatestGANotSpecifiedShouldCallServiceWithMakeDefaultFalse() throws Exception {
7777
DefaultApplicationArguments args = new DefaultApplicationArguments("promote", "RELEASE", "1.2.3");
7878
testRun(args, false);
7979
}
8080

81-
@Test
82-
void runWhenBranchNotMasterShouldCallServiceWithMakeDefaultFalse() throws Exception {
83-
DefaultApplicationArguments args = new DefaultApplicationArguments("promote", "RELEASE", "1.2.3", "other");
84-
testRun(args, false);
85-
}
86-
8781
@Test
8882
void runWhenReleaseTypeReleaseShouldCallService() throws Exception {
89-
DefaultApplicationArguments args = new DefaultApplicationArguments("promote", "RELEASE", "1.2.3", "master");
83+
DefaultApplicationArguments args = new DefaultApplicationArguments("promote", "RELEASE", "1.2.3", "true");
9084
testRun(args, true);
9185
}
9286

ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/sdkman/SdkmanServiceTests.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ void tearDown() {
5959
void publishWhenMakeDefaultTrue() throws Exception {
6060
setupExpectation("https://vendors.sdkman.io/release",
6161
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"url\": \"https://repo.spring.io/simple/libs-release-local/org/springframework/boot/spring-boot-cli/1.2.3/spring-boot-cli-1.2.3-bin.zip\"}");
62-
setupExpectation("https://vendors.sdkman.io/default",
63-
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\"}");
62+
setupExpectation("https://vendors.sdkman.io/default", "{\"candidate\": \"springboot\", \"version\": \"1.2.3\"}",
63+
HttpMethod.PUT);
6464
setupExpectation("https://vendors.sdkman.io/announce/struct",
6565
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"hashtag\": \"springboot\"}");
6666
this.service.publish("1.2.3", true);
@@ -78,7 +78,11 @@ void publishWhenMakeDefaultFalse() throws Exception {
7878
}
7979

8080
private void setupExpectation(String url, String body) {
81-
this.server.expect(requestTo(url)).andExpect(method(HttpMethod.POST)).andExpect(content().json(body))
81+
setupExpectation(url, body, HttpMethod.POST);
82+
}
83+
84+
private void setupExpectation(String url, String body, HttpMethod method) {
85+
this.server.expect(requestTo(url)).andExpect(method(method)).andExpect(content().json(body))
8286
.andExpect(header("Consumer-Key", "sdkman-consumer-key"))
8387
.andExpect(header("Consumer-Token", "sdkman-consumer-token"))
8488
.andExpect(header("Content-Type", MediaType.APPLICATION_JSON.toString())).andRespond(withSuccess());

ci/pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ jobs:
613613
<<: *sdkman-task-params
614614
RELEASE_TYPE: RELEASE
615615
BRANCH: ((branch))
616+
LATEST_GA: false
616617
groups:
617618
- name: "builds"
618619
jobs: ["build", "jdk11-build", "jdk15-build", "windows-build"]

ci/scripts/publish-to-sdkman.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ source $(dirname $0)/common.sh
44

55
version=$( cat artifactory-repo/build-info.json | jq -r '.buildInfo.modules[0].id' | sed 's/.*:.*:\(.*\)/\1/' )
66

7-
java -jar /spring-boot-release-scripts.jar publishToSdkman $RELEASE_TYPE $version $BRANCH || { exit 1; }
7+
java -jar /spring-boot-release-scripts.jar publishToSdkman $RELEASE_TYPE $version $LATEST_GA || { exit 1; }
88

99
echo "Push to SDKMAN complete"

ci/tasks/publish-to-sdkman.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ inputs:
66
params:
77
RELEASE_TYPE:
88
BRANCH:
9+
LATEST_GA:
910
SDKMAN_CONSUMER_KEY:
1011
SDKMAN_CONSUMER_TOKEN:
1112
run:

0 commit comments

Comments
 (0)