Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
822ae0da
Commit
822ae0da
authored
Dec 14, 2020
by
Madhura Bhave
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix detection of latest GA for SDKMAN
Fixes gh-24475
parent
60f526ad
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
19 deletions
+18
-19
PublishToSdkmanCommand.java
...course/releasescripts/command/PublishToSdkmanCommand.java
+1
-2
SdkmanService.java
...spring/concourse/releasescripts/sdkman/SdkmanService.java
+1
-1
PublishToSdkmanCommandTests.java
...e/releasescripts/command/PublishToSdkmanCommandTests.java
+6
-12
SdkmanServiceTests.java
...g/concourse/releasescripts/sdkman/SdkmanServiceTests.java
+7
-3
pipeline.yml
ci/pipeline.yml
+1
-0
publish-to-sdkman.sh
ci/scripts/publish-to-sdkman.sh
+1
-1
publish-to-sdkman.yml
ci/tasks/publish-to-sdkman.yml
+1
-0
No files found.
ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/command/PublishToSdkmanCommand.java
View file @
822ae0da
...
...
@@ -64,8 +64,7 @@ public class PublishToSdkmanCommand implements Command {
String
version
=
nonOptionArgs
.
get
(
2
);
boolean
makeDefault
=
false
;
if
(
nonOptionArgs
.
size
()
==
4
)
{
String
releaseBranch
=
nonOptionArgs
.
get
(
3
);
makeDefault
=
(
"master"
.
equals
(
releaseBranch
));
makeDefault
=
Boolean
.
parseBoolean
(
nonOptionArgs
.
get
(
3
));
}
this
.
service
.
publish
(
version
,
makeDefault
);
}
...
...
ci/images/releasescripts/src/main/java/io/spring/concourse/releasescripts/sdkman/SdkmanService.java
View file @
822ae0da
...
...
@@ -78,7 +78,7 @@ public class SdkmanService {
private
void
makeDefault
(
String
version
)
{
logger
.
debug
(
"Making this version the default"
);
Request
request
=
new
Request
(
version
);
RequestEntity
<
Request
>
requestEntity
=
RequestEntity
.
p
os
t
(
URI
.
create
(
SDKMAN_URL
+
"default"
))
RequestEntity
<
Request
>
requestEntity
=
RequestEntity
.
p
u
t
(
URI
.
create
(
SDKMAN_URL
+
"default"
))
.
header
(
CONSUMER_KEY_HEADER
,
this
.
properties
.
getConsumerKey
())
.
header
(
CONSUMER_TOKEN_HEADER
,
this
.
properties
.
getConsumerToken
())
.
contentType
(
MediaType
.
APPLICATION_JSON
).
body
(
request
);
...
...
ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/command/PublishToSdkmanCommandTests.java
View file @
822ae0da
...
...
@@ -51,42 +51,36 @@ class PublishToSdkmanCommandTests {
@Test
void
runWhenReleaseTypeNotSpecifiedShouldThrowException
()
throws
Exception
{
Assertions
.
assertThatIllegalStateException
()
.
isThrownBy
(()
->
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
GradlePlugi
n"
)));
.
isThrownBy
(()
->
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
ToSdkma
n"
)));
}
@Test
void
runWhenVersionNotSpecifiedShouldThrowException
()
throws
Exception
{
Assertions
.
assertThatIllegalStateException
()
.
isThrownBy
(()
->
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
GradlePlugi
n"
,
"RELEASE"
)));
.
isThrownBy
(()
->
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
ToSdkma
n"
,
"RELEASE"
)));
}
@Test
void
runWhenReleaseTypeMilestoneShouldDoNothing
()
throws
Exception
{
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
GradlePlugi
n"
,
"M"
,
"1.2.3"
));
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
ToSdkma
n"
,
"M"
,
"1.2.3"
));
verifyNoInteractions
(
this
.
service
);
}
@Test
void
runWhenReleaseTypeRCShouldDoNothing
()
throws
Exception
{
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
GradlePlugi
n"
,
"RC"
,
"1.2.3"
));
this
.
command
.
run
(
new
DefaultApplicationArguments
(
"publish
ToSdkma
n"
,
"RC"
,
"1.2.3"
));
verifyNoInteractions
(
this
.
service
);
}
@Test
void
runWhen
Branch
NotSpecifiedShouldCallServiceWithMakeDefaultFalse
()
throws
Exception
{
void
runWhen
LatestGA
NotSpecifiedShouldCallServiceWithMakeDefaultFalse
()
throws
Exception
{
DefaultApplicationArguments
args
=
new
DefaultApplicationArguments
(
"promote"
,
"RELEASE"
,
"1.2.3"
);
testRun
(
args
,
false
);
}
@Test
void
runWhenBranchNotMasterShouldCallServiceWithMakeDefaultFalse
()
throws
Exception
{
DefaultApplicationArguments
args
=
new
DefaultApplicationArguments
(
"promote"
,
"RELEASE"
,
"1.2.3"
,
"other"
);
testRun
(
args
,
false
);
}
@Test
void
runWhenReleaseTypeReleaseShouldCallService
()
throws
Exception
{
DefaultApplicationArguments
args
=
new
DefaultApplicationArguments
(
"promote"
,
"RELEASE"
,
"1.2.3"
,
"
master
"
);
DefaultApplicationArguments
args
=
new
DefaultApplicationArguments
(
"promote"
,
"RELEASE"
,
"1.2.3"
,
"
true
"
);
testRun
(
args
,
true
);
}
...
...
ci/images/releasescripts/src/test/java/io/spring/concourse/releasescripts/sdkman/SdkmanServiceTests.java
View file @
822ae0da
...
...
@@ -59,8 +59,8 @@ class SdkmanServiceTests {
void
publishWhenMakeDefaultTrue
()
throws
Exception
{
setupExpectation
(
"https://vendors.sdkman.io/release"
,
"{\"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\"}"
);
setupExpectation
(
"https://vendors.sdkman.io/default"
,
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\"}"
);
setupExpectation
(
"https://vendors.sdkman.io/default"
,
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\"}"
,
HttpMethod
.
PUT
);
setupExpectation
(
"https://vendors.sdkman.io/announce/struct"
,
"{\"candidate\": \"springboot\", \"version\": \"1.2.3\", \"hashtag\": \"springboot\"}"
);
this
.
service
.
publish
(
"1.2.3"
,
true
);
...
...
@@ -78,7 +78,11 @@ class SdkmanServiceTests {
}
private
void
setupExpectation
(
String
url
,
String
body
)
{
this
.
server
.
expect
(
requestTo
(
url
)).
andExpect
(
method
(
HttpMethod
.
POST
)).
andExpect
(
content
().
json
(
body
))
setupExpectation
(
url
,
body
,
HttpMethod
.
POST
);
}
private
void
setupExpectation
(
String
url
,
String
body
,
HttpMethod
method
)
{
this
.
server
.
expect
(
requestTo
(
url
)).
andExpect
(
method
(
method
)).
andExpect
(
content
().
json
(
body
))
.
andExpect
(
header
(
"Consumer-Key"
,
"sdkman-consumer-key"
))
.
andExpect
(
header
(
"Consumer-Token"
,
"sdkman-consumer-token"
))
.
andExpect
(
header
(
"Content-Type"
,
MediaType
.
APPLICATION_JSON
.
toString
())).
andRespond
(
withSuccess
());
...
...
ci/pipeline.yml
View file @
822ae0da
...
...
@@ -693,6 +693,7 @@ jobs:
<<
:
*sdkman-task-params
RELEASE_TYPE
:
RELEASE
BRANCH
:
((branch))
LATEST_GA
:
false
groups
:
-
name
:
"
builds"
jobs
:
[
"
build"
,
"
jdk11-build"
,
"
jdk15-build"
,
"
windows-build"
]
...
...
ci/scripts/publish-to-sdkman.sh
View file @
822ae0da
...
...
@@ -4,6 +4,6 @@ source $(dirname $0)/common.sh
version
=
$(
cat
artifactory-repo/build-info.json | jq
-r
'.buildInfo.modules[0].id'
|
sed
's/.*:.*:\(.*\)/\1/'
)
java
-jar
/spring-boot-release-scripts.jar publishToSdkman
$RELEASE_TYPE
$version
$
BRANCH
||
{
exit
1
;
}
java
-jar
/spring-boot-release-scripts.jar publishToSdkman
$RELEASE_TYPE
$version
$
LATEST_GA
||
{
exit
1
;
}
echo
"Push to SDKMAN complete"
ci/tasks/publish-to-sdkman.yml
View file @
822ae0da
...
...
@@ -6,6 +6,7 @@ inputs:
params
:
RELEASE_TYPE
:
BRANCH
:
LATEST_GA
:
SDKMAN_CONSUMER_KEY
:
SDKMAN_CONSUMER_TOKEN
:
run
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment