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
685b045c
Commit
685b045c
authored
Mar 18, 2021
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
bb38ee38
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
29 deletions
+31
-29
BuildRequest.java
...framework/boot/buildpack/platform/build/BuildRequest.java
+5
-0
Binding.java
...ramework/boot/buildpack/platform/docker/type/Binding.java
+19
-23
ContainerConfig.java
.../boot/buildpack/platform/docker/type/ContainerConfig.java
+1
-1
BindingTests.java
...ork/boot/buildpack/platform/docker/type/BindingTests.java
+3
-3
Image.java
...n/src/main/java/org/springframework/boot/maven/Image.java
+3
-2
No files found.
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildRequest.java
View file @
685b045c
...
@@ -211,6 +211,7 @@ public class BuildRequest {
...
@@ -211,6 +211,7 @@ public class BuildRequest {
* Return a new {@link BuildRequest} with an updated buildpacks setting.
* Return a new {@link BuildRequest} with an updated buildpacks setting.
* @param buildpacks a collection of buildpacks to use when building the image
* @param buildpacks a collection of buildpacks to use when building the image
* @return an updated build request
* @return an updated build request
* @since 2.5.0
*/
*/
public
BuildRequest
withBuildpacks
(
BuildpackReference
...
buildpacks
)
{
public
BuildRequest
withBuildpacks
(
BuildpackReference
...
buildpacks
)
{
Assert
.
notEmpty
(
buildpacks
,
"Buildpacks must not be empty"
);
Assert
.
notEmpty
(
buildpacks
,
"Buildpacks must not be empty"
);
...
@@ -221,6 +222,7 @@ public class BuildRequest {
...
@@ -221,6 +222,7 @@ public class BuildRequest {
* Return a new {@link BuildRequest} with an updated buildpacks setting.
* Return a new {@link BuildRequest} with an updated buildpacks setting.
* @param buildpacks a collection of buildpacks to use when building the image
* @param buildpacks a collection of buildpacks to use when building the image
* @return an updated build request
* @return an updated build request
* @since 2.5.0
*/
*/
public
BuildRequest
withBuildpacks
(
List
<
BuildpackReference
>
buildpacks
)
{
public
BuildRequest
withBuildpacks
(
List
<
BuildpackReference
>
buildpacks
)
{
Assert
.
notNull
(
buildpacks
,
"Buildpacks must not be null"
);
Assert
.
notNull
(
buildpacks
,
"Buildpacks must not be null"
);
...
@@ -232,6 +234,7 @@ public class BuildRequest {
...
@@ -232,6 +234,7 @@ public class BuildRequest {
* Return a new {@link BuildRequest} with updated bindings.
* Return a new {@link BuildRequest} with updated bindings.
* @param bindings a collection of bindings to mount to the build container
* @param bindings a collection of bindings to mount to the build container
* @return an updated build request
* @return an updated build request
* @since 2.5.0
*/
*/
public
BuildRequest
withBindings
(
Binding
...
bindings
)
{
public
BuildRequest
withBindings
(
Binding
...
bindings
)
{
Assert
.
notEmpty
(
bindings
,
"Bindings must not be empty"
);
Assert
.
notEmpty
(
bindings
,
"Bindings must not be empty"
);
...
@@ -242,6 +245,7 @@ public class BuildRequest {
...
@@ -242,6 +245,7 @@ public class BuildRequest {
* Return a new {@link BuildRequest} with updated bindings.
* Return a new {@link BuildRequest} with updated bindings.
* @param bindings a collection of bindings to mount to the build container
* @param bindings a collection of bindings to mount to the build container
* @return an updated build request
* @return an updated build request
* @since 2.5.0
*/
*/
public
BuildRequest
withBindings
(
List
<
Binding
>
bindings
)
{
public
BuildRequest
withBindings
(
List
<
Binding
>
bindings
)
{
Assert
.
notNull
(
bindings
,
"Bindings must not be null"
);
Assert
.
notNull
(
bindings
,
"Bindings must not be null"
);
...
@@ -343,6 +347,7 @@ public class BuildRequest {
...
@@ -343,6 +347,7 @@ public class BuildRequest {
/**
/**
* Return the collection of bindings to mount to the build container.
* Return the collection of bindings to mount to the build container.
* @return the bindings
* @return the bindings
* @since 2.5.0
*/
*/
public
List
<
Binding
>
getBindings
()
{
public
List
<
Binding
>
getBindings
()
{
return
this
.
bindings
;
return
this
.
bindings
;
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/Binding.java
View file @
685b045c
...
@@ -34,7 +34,25 @@ public final class Binding {
...
@@ -34,7 +34,25 @@ public final class Binding {
this
.
value
=
value
;
this
.
value
=
value
;
}
}
public
String
getValue
()
{
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(!(
obj
instanceof
Binding
))
{
return
false
;
}
Binding
binding
=
(
Binding
)
obj
;
return
Objects
.
equals
(
this
.
value
,
binding
.
value
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
this
.
value
);
}
@Override
public
String
toString
()
{
return
this
.
value
;
return
this
.
value
;
}
}
...
@@ -72,26 +90,4 @@ public final class Binding {
...
@@ -72,26 +90,4 @@ public final class Binding {
return
new
Binding
(
source
+
":"
+
destination
);
return
new
Binding
(
source
+
":"
+
destination
);
}
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(!(
obj
instanceof
Binding
))
{
return
false
;
}
Binding
binding
=
(
Binding
)
obj
;
return
Objects
.
equals
(
this
.
value
,
binding
.
value
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
this
.
value
);
}
@Override
public
String
toString
()
{
return
this
.
value
;
}
}
}
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ContainerConfig.java
View file @
685b045c
...
@@ -65,7 +65,7 @@ public class ContainerConfig {
...
@@ -65,7 +65,7 @@ public class ContainerConfig {
labels
.
forEach
(
labelsNode:
:
put
);
labels
.
forEach
(
labelsNode:
:
put
);
ObjectNode
hostConfigNode
=
node
.
putObject
(
"HostConfig"
);
ObjectNode
hostConfigNode
=
node
.
putObject
(
"HostConfig"
);
ArrayNode
bindsNode
=
hostConfigNode
.
putArray
(
"Binds"
);
ArrayNode
bindsNode
=
hostConfigNode
.
putArray
(
"Binds"
);
bindings
.
forEach
((
binding
)
->
bindsNode
.
add
(
binding
.
getValue
()));
bindings
.
forEach
((
binding
)
->
bindsNode
.
add
(
binding
.
toString
()));
this
.
json
=
objectMapper
.
writeValueAsString
(
node
);
this
.
json
=
objectMapper
.
writeValueAsString
(
node
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/type/BindingTests.java
View file @
685b045c
...
@@ -31,7 +31,7 @@ class BindingTests {
...
@@ -31,7 +31,7 @@ class BindingTests {
@Test
@Test
void
ofReturnsValue
()
{
void
ofReturnsValue
()
{
Binding
binding
=
Binding
.
of
(
"host-src:container-dest:ro"
);
Binding
binding
=
Binding
.
of
(
"host-src:container-dest:ro"
);
assertThat
(
binding
.
getValue
()).
isEqualTo
(
"host-src:container-dest:ro"
);
assertThat
(
binding
).
hasToString
(
"host-src:container-dest:ro"
);
}
}
@Test
@Test
...
@@ -43,7 +43,7 @@ class BindingTests {
...
@@ -43,7 +43,7 @@ class BindingTests {
@Test
@Test
void
fromReturnsValue
()
{
void
fromReturnsValue
()
{
Binding
binding
=
Binding
.
from
(
"host-src"
,
"container-dest"
);
Binding
binding
=
Binding
.
from
(
"host-src"
,
"container-dest"
);
assertThat
(
binding
.
getValue
()).
isEqualTo
(
"host-src:container-dest"
);
assertThat
(
binding
).
hasToString
(
"host-src:container-dest"
);
}
}
@Test
@Test
...
@@ -61,7 +61,7 @@ class BindingTests {
...
@@ -61,7 +61,7 @@ class BindingTests {
@Test
@Test
void
fromVolumeNameSourceReturnsValue
()
{
void
fromVolumeNameSourceReturnsValue
()
{
Binding
binding
=
Binding
.
from
(
VolumeName
.
of
(
"host-src"
),
"container-dest"
);
Binding
binding
=
Binding
.
from
(
VolumeName
.
of
(
"host-src"
),
"container-dest"
);
assertThat
(
binding
.
getValue
()).
isEqualTo
(
"host-src:container-dest"
);
assertThat
(
binding
).
hasToString
(
"host-src:container-dest"
);
}
}
@Test
@Test
...
...
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/Image.java
View file @
685b045c
...
@@ -31,6 +31,7 @@ import org.springframework.boot.buildpack.platform.docker.type.ImageName;
...
@@ -31,6 +31,7 @@ import org.springframework.boot.buildpack.platform.docker.type.ImageName;
import
org.springframework.boot.buildpack.platform.docker.type.ImageReference
;
import
org.springframework.boot.buildpack.platform.docker.type.ImageReference
;
import
org.springframework.boot.buildpack.platform.io.Owner
;
import
org.springframework.boot.buildpack.platform.io.Owner
;
import
org.springframework.boot.buildpack.platform.io.TarArchive
;
import
org.springframework.boot.buildpack.platform.io.TarArchive
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
/**
/**
...
@@ -182,11 +183,11 @@ public class Image {
...
@@ -182,11 +183,11 @@ public class Image {
if
(
this
.
publish
!=
null
)
{
if
(
this
.
publish
!=
null
)
{
request
=
request
.
withPublish
(
this
.
publish
);
request
=
request
.
withPublish
(
this
.
publish
);
}
}
if
(
this
.
buildpacks
!=
null
&&
!
this
.
buildpacks
.
isEmpty
(
))
{
if
(
!
CollectionUtils
.
isEmpty
(
this
.
buildpacks
))
{
request
=
request
request
=
request
.
withBuildpacks
(
this
.
buildpacks
.
stream
().
map
(
BuildpackReference:
:
of
).
collect
(
Collectors
.
toList
()));
.
withBuildpacks
(
this
.
buildpacks
.
stream
().
map
(
BuildpackReference:
:
of
).
collect
(
Collectors
.
toList
()));
}
}
if
(
this
.
bindings
!=
null
&&
!
this
.
bindings
.
isEmpty
(
))
{
if
(
!
CollectionUtils
.
isEmpty
(
this
.
bindings
))
{
request
=
request
.
withBindings
(
this
.
bindings
.
stream
().
map
(
Binding:
:
of
).
collect
(
Collectors
.
toList
()));
request
=
request
.
withBindings
(
this
.
bindings
.
stream
().
map
(
Binding:
:
of
).
collect
(
Collectors
.
toList
()));
}
}
return
request
;
return
request
;
...
...
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