Commit Graph

500 Commits

Author SHA1 Message Date
Moritz Halbritter 5ec099756f Fix potential NPE when passing 'null' as params 2025-03-07 08:17:37 +01:00
Moritz Halbritter dde9bfbeaa Merge branch '3.4.x'
Closes gh-44631
2025-03-06 17:41:08 +01:00
Moritz Halbritter 2e74ce8bf2 Merge branch '3.3.x' into 3.4.x
Closes gh-44630
2025-03-06 17:39:26 +01:00
Moritz Halbritter a807a07a59 Always try to deserialize message in case of Docker transport errors
Before this commit, if the status code was 4xx or 500, we tried to read the errors
object, consuming the http entity. When we tried to deserialize the message,
the http entity was already consumed, an IOException has been thrown and null
is returned for the message.

Now, we read the content in a byte[] and deserialize the errors and the message
from that. This ensures that we can read both the errors and the message.

Closes gh-44628
2025-03-06 17:27:00 +01:00
Moritz Halbritter 3be5e6cc3e Polish "Improve logging in DockerApi"
See gh-44412
2025-02-25 13:14:38 +01:00
Dmytro Nosan 9a940702bc Improve logging in DockerApi
This commit introduces a new constructor in `DockerApi`
that accepts `DockerLogger` as a parameter.

The `DockerLogger` is a pretty simple callback interface used to
provide DockerApi output logging.

See gh-44412

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
2025-02-25 13:07:23 +01:00
Moritz Halbritter ae16856bda Revert "Use noble buildpacks instead of jammy"
This reverts commit 4f672b9588.

See gh-42711
2025-02-19 16:00:27 +01:00
Moritz Halbritter 4f672b9588 Use noble buildpacks instead of jammy
Closes gh-42711
2025-02-19 13:59:21 +01:00
Phillip Webb 651a39b3f6 Merge branch '3.4.x' 2025-02-18 15:12:07 -08:00
Johnny Lim c9320de559 Use consistent exception messages in Assert calls
See gh-44044

Signed-off-by: Johnny Lim <izeye@naver.com>
2025-02-03 13:58:59 +01:00
Andy Wilkinson 1e43b0003f Merge branch '3.4.x'
Closes gh-43951
2025-01-24 08:54:50 +00:00
Andy Wilkinson 2f29a49a1d Remove APIs deprecated for removal in 3.5
Closes gh-43788
2025-01-14 13:59:24 +00:00
Phillip Webb a49719d73e Use consistent exception messages in Assert calls
Update `Assert` calls to consistently use messages of the form
"'item' must [not] ...".

Closes gh-43780
2025-01-11 21:18:47 -08:00
Phillip Webb f08188d5cf Change relevant Assert calls to throw IllegalStateException
Change certain Assert class from `assert...` to `assertState`
so that a more appropriate `IllegalStateException` is thrown.

Fixes gh-43779
2025-01-11 21:16:36 -08:00
Phillip Webb 123502b8d7 Restore use of fixed version when calling docker APIs
Update `DockerApi` so that calls are made using a fixed version. For
most calls this will be `v1.24`, however, for calls with a platform
we must use the `v1.41`.

When possible, we check that the Docker version in use meets the
required minimum, however, if we can't detect the running version
we now proceed and let the actual API call fail. This is due to the
fact that the `/_ping` endpoint may not always be available. For
example, it is restricted when building from a BitBucket CI pipeline.

Fixes gh-43452
2024-12-10 13:14:20 -08:00
Phillip Webb dd64b0648f Merge branch '3.3.x'
Closes gh-43356
2024-12-02 13:59:53 -08:00
Phillip Webb 0afbc0b23c Polish 'Accept Docker progress on numbers >2GB'
Restore `int` returns for existing methods and deprecate them in
favor of a new `asPercentage()` method.

See gh-43328
2024-12-02 13:58:03 -08:00
Wolfgang Kronberg d8565185e8 Accept Docker progress on numbers >2GB
Update `ProgressUpdateEvent` to support images of a file size
>2GB without provoking build failures.

See gh-43328
2024-12-02 13:56:09 -08:00
Andy Wilkinson 32433e84f3 Merge branch '3.3.x'
Closes gh-43270
2024-11-22 15:46:38 +00:00
Andy Wilkinson bb3651b7d1 Reduce warnings reported by Eclipse
Closes gh-43269
2024-11-22 15:39:35 +00:00
Phillip Webb f77c3bbd6b Merge branch '3.3.x'
Closes gh-43171
2024-11-14 15:50:15 -08:00
Phillip Webb 66ec6b32e3 Merge branch '3.2.x' into 3.3.x
Closes gh-43170
2024-11-14 15:50:04 -08:00
Phillip Webb 25b6477aa8 Support alternative media type format
Update `ExportedImageTar` media type detection to support `tar+gzip`
as well as `tar.gzip`. Recent updates to Docker Desktop appear to have
changed the format.

Fixes gh-43126
2024-11-14 15:25:15 -08:00
Phillip Webb a293560237 Support nested OCI indexes
Update `ExportedImageTar.IndexLayerArchiveFactory` to support nested
indexes. Nested indexes support a layer of interaction where the
`index.json` file points to a blob that contains the read index to use.

Prior to this commit, we only supported indexes provided directly by
the `index.json` file. This missing support results in "buildpack.toml:
no such file or directory" errors when referencing specific buildpacks
and using Docker Engine 27.3.1 or above.

See gh-43126
2024-11-14 15:24:47 -08:00
Andy Wilkinson c6e19517be Merge branch '3.3.x'
Closes gh-43070
2024-11-08 09:55:36 +00:00
Andy Wilkinson 81872afd53 Merge branch '3.2.x' into 3.3.x
Closes gh-43069
2024-11-08 09:55:22 +00:00
Andy Wilkinson 2fa28fb822 Improve error reporting when image loading fails
Closes gh-31243
2024-11-08 09:51:57 +00:00
Phillip Webb dbb5e05ebf Merge branch '3.3.x'
Closes gh-42992
2024-11-04 16:19:04 -08:00
Phillip Webb 189e49f6d6 Merge branch '3.2.x' into 3.3.x
Closes gh-42991
2024-11-04 15:56:29 -08:00
Phillip Webb c62a018830 Align buildpack certificate and key parsers with SSL versions
Closes gh-37969
2024-11-04 15:53:39 -08:00
Phillip Webb 269f18c0ca Merge branch '3.3.x'
Closes gh-42990
2024-11-04 14:34:39 -08:00
Phillip Webb 4a7c757945 Merge branch '3.2.x' into 3.3.x
Closes gh-42989
2024-11-04 14:34:17 -08:00
Phillip Webb 202db9b7f4 Update copyright year of changed files 2024-11-04 14:28:23 -08:00
Andy Wilkinson a3168e3a2f Centralize dependency management of Commons Compress
Closes gh-39368
2024-11-04 11:45:41 +00:00
Phillip Webb 2fa1180332 Make NamedPipeSocket.connect a no-op to fix connection exceptions
Update `NamedPipeSocket` so that `connect` methods are now no-ops. This
restores the behavior of Spring Boot 3.3 which previously handled the
case by overriding `ConnectionSocketFactory.connectSocket`. The newer
HTTP client code uses the `DetachedSocketFactory` interface which
doesn't offer a method that we can override, so instead we must change
the socket implementation itself.

Fixes gh-42952
2024-11-01 13:22:07 -07:00
Phillip Webb bc5a25bf16 Polish 2024-11-01 13:14:05 -07:00
Moritz Halbritter 8f6aabc15b Merge branch '3.3.x'
Closes gh-42960
2024-10-31 15:07:11 +01:00
Moritz Halbritter 6470748d6d Merge branch '3.2.x' into 3.3.x
Closes gh-42959
2024-10-31 15:07:02 +01:00
Moritz Halbritter 90b920a410 Use default address if null address is given
Closes gh-42958
2024-10-31 14:34:30 +01:00
Stéphane Nicoll cc443366fa Merge branch '3.3.x'
Closes gh-42915
2024-10-29 13:28:42 +09:00
Stéphane Nicoll 4401673d6d Merge branch '3.2.x' into 3.3.x
Closes gh-42914
2024-10-29 13:27:06 +09:00
Stéphane Nicoll d4010d3be0 Polish "Prevent auth header to be included in Docker API call"
See gh-42910
2024-10-29 13:24:09 +09:00
YiXuan Ding 351018ea65 Prevent auth header to be included in Docker API call
See gh-42910
2024-10-29 13:16:08 +09:00
Moritz Halbritter c018c43886 Merge branch '3.3.x'
Closes gh-42736
2024-10-17 13:44:25 +02:00
Moritz Halbritter 8efe6e02d9 Merge branch '3.2.x' into 3.3.x
Closes gh-42735
2024-10-17 13:38:03 +02:00
Moritz Halbritter a3060652f8 Call String.toLowerCase and .toUppercase with explicit locale
Closes gh-42719
2024-10-17 13:20:39 +02:00
Moritz Halbritter d1976a48dc Upgrade to HttpClient5 5.4
Closes gh-42675
2024-10-17 09:51:39 +02:00
Phillip Webb 0a6d3f312e Polish 2024-10-16 13:08:21 -07:00
Moritz Halbritter 957e2f8b7f Add warning if sensitive container paths are bound
Closes gh-41643
2024-10-14 10:18:34 +02:00
Anthony Dahanne 416413957a Use builder-jammy-java-tiny when using Buildpacks
See gh-42508
2024-10-07 13:30:41 +02:00
Phillip Webb 7b3077280c Merge branch '3.3.x'
Closes gh-42441
2024-09-24 14:32:48 -07:00
Phillip Webb 100bedc07d Merge branch '3.2.x' into 3.3.x
Closes gh-42440
2024-09-24 14:29:09 -07:00
Phillip Webb ad72411e2b Apply conventions plugin to all subprojects
Closes gh-42438
2024-09-24 14:26:32 -07:00
Phillip Webb 7fc5c4bb6c Merge branch '3.3.x'
Closes gh-42082
2024-09-01 18:51:45 -07:00
Phillip Webb b29bc2dc2e Merge branch '3.2.x' into 3.3.x
Closes gh-42081
2024-09-01 18:51:33 -07:00
Johnny Lim a8452b54b5 Polish
See gh-42069
2024-09-01 18:50:38 -07:00
Phillip Webb c30a5572f3 Polish 2024-08-19 16:44:43 -07:00
Scott Frederick 9e3e067a4c Add support for CNB platform API version 0.14
Closes gh-41549
2024-08-01 17:10:41 -05:00
Scott Frederick dfab18c965 Add imagePlatform option for image building
An `imagePlatform` option for the Maven and Gradle image-building
goal/task can be used to specify the os/architecture of any
builder, run, and buildpack images that are pulled during image
building.

Closes gh-40944
2024-07-30 14:19:40 -05:00
Phillip Webb 88480664d7 Polish 2024-07-22 19:59:27 +01:00
Scott Frederick 7b8364d248 Fix LifecycleTests on Windows
See gh-gh-41352
2024-07-11 17:07:23 -05:00
Scott Frederick 224b06982e Add support for untrusted CNB builders
A `trustBuilder` configuration option has been added to the Maven and
Gradle CNB integration image building goal and task. A known set of
builders published by Paketo, Heroku, and Google are trusted by default,
all other builders are untrusted by default.

Closes gh-41352
2024-07-11 13:51:54 -05:00
Scott Frederick 26b59ae912 Use Paketo tiny builder by default for JVM and native apps
Closes gh-40859
2024-06-28 11:45:54 -05:00
Andy Wilkinson 5b7365b63b Merge branch '3.3.x'
Closes gh-41258
2024-06-27 10:25:32 +01:00
Andy Wilkinson b0d4f1d356 Merge branch '3.2.x' into 3.3.x
Closes gh-41257
2024-06-27 10:16:36 +01:00
Scott Frederick 9da2d1e089 Revert "Use Paketo tiny builder by default for JVM and native apps"
This reverts commit 6d2ebc0713.
2024-06-26 15:25:37 -05:00
Scott Frederick 8623c92a29 Change spring-boot-buildpack-platform api deps to implementation
Closes gh-40935
2024-06-26 14:12:43 -05:00
Scott Frederick 267956cf5c Replace JNI domain sockets implementation with one that uses JDK support
Closes gh-41050
2024-06-26 14:09:19 -05:00
Andy Wilkinson 654016af7f Move Docker-related test support into a separate module
See gh-41228
2024-06-26 19:47:35 +01:00
Andy Wilkinson d5ef5e9c9d Update spring-boot-buildpack-platform to use docker-test plugin
See gh-41228
2024-06-26 19:46:08 +01:00
Scott Frederick 6d2ebc0713 Use Paketo tiny builder by default for JVM and native apps
Closes gh-40859
2024-06-26 13:42:23 -05:00
Phillip Webb f5eb6e95ce Merge branch '3.3.x'
Closes gh-41235
2024-06-25 12:43:15 -07:00
Phillip Webb eb9f16e7e6 Merge branch '3.2.x' into 3.3.x
Closes gh-41234
2024-06-25 12:42:53 -07:00
Phillip Webb 85f6641a7e Allow 'npipe://' prefix in Docker host address
Update `LocalHttpClientTransport` to support explicit `npipe://` prefix
in the host name. This is the format used in the Docker config from
v4.31.1 onward.

Fixes gh-41199
2024-06-25 12:40:11 -07:00
Andy Wilkinson 28a887ad0f Raise minimum supported version of Gradle
Closes gh-41180
2024-06-21 14:52:22 +01:00
Phillip Webb 9dda006a18 Merge branch '3.2.x' 2024-06-19 22:55:00 -07:00
Phillip Webb 2a4582b084 Update copyright year of changed files 2024-06-19 22:54:40 -07:00
Phillip Webb 905d6b96d0 Merge branch '3.2.x'
Closes gh-41166
2024-06-19 22:30:58 -07:00
Andy Wilkinson 491f34d25c Improve container test code
Replace `DockerImageNames` with a enum and relocate it from the
`testcontainers` to `container` package. The enum now also
becomes a common location that we can use to apply container
configuration such as timeouts.

Closes gh-41164

Co-authored-by: Phillip Webb <phil.webb@broadcom.com>
2024-06-19 20:10:03 -07:00
Scott Frederick 84956ad56b Merge branch '3.2.x'
Closes gh-41091
2024-06-12 15:16:26 -05:00
Scott Frederick e228ed39b3 Support CNB builders that do not specify a stack
Fixes gh-41046
2024-06-12 15:16:21 -05:00
Phillip Webb 147240aa0c Merge branch '3.2.x'
Closes gh-41080
2024-06-11 13:32:30 -07:00
Ahmed Ashour 207327d97c Use method references when possible in test code
See gh-40974
2024-06-11 12:58:00 -07:00
Scott Frederick 87094edab0 Merge branch '3.2.x'
Closes gh-41049
2024-06-10 17:32:46 -05:00
Scott Frederick 2bb74b261c Disable stale checking for local Docker daemon connections
Fixes gh-40697
2024-06-10 17:27:02 -05:00
Andy Wilkinson cf447e3aa6 Merge branch '3.2.x'
Closes gh-40931
2024-05-28 16:52:32 +01:00
Andy Wilkinson 5ee0580339 Upgrade to the latest Framework 6.0.x release
Closes gh-40929
2024-05-28 16:52:00 +01:00
Scott Frederick 190b120628 Merge branch '3.2.x' 2024-05-16 21:20:10 -05:00
Scott Frederick bdc6508b62 Catch any exception when deleting image building workspace
See gh-40760
2024-05-16 21:19:51 -05:00
Scott Frederick 5f4d7f41bc Merge branch '3.2.x'
Closes gh-40799
2024-05-16 17:38:07 -05:00
Scott Frederick cd441130bd Warn when image building workspace directories cannot be deleted
When the `buildWorkspace` location in the
`spring-boot:build-image` Maven goal or `bootBuildImage` Gradle
task is configured to use a local bind source, the location
is passed to the CNB lifecycle without further processing by
Spring Boot. The lifecycle is in control of creating any files
in the specified location. Spring Boot tries to remove the
directories at the specified location after an image is
successfully created, but should not fail the image build
if the lifecycle has created files or directories with
permissions that keep them from being deleted successfully.

Fixes gh-40760
2024-05-16 17:37:44 -05:00
Moritz Halbritter d98987f11e Merge branch '3.2.x'
Closes gh-40701
2024-05-13 11:31:55 +02:00
Moritz Halbritter 364af04377 Merge branch '3.1.x' into 3.2.x
Closes gh-40700
2024-05-13 11:30:42 +02:00
Yanming Zhou 0e450d602d Use CollectionUtils.isEmpty() and StringUtils.hasLength()
See gh-40645
2024-05-13 11:26:56 +02:00
Moritz Halbritter 760bc9237d Merge branch '3.2.x' 2024-04-26 09:20:47 +02:00
Moritz Halbritter f13e487724 Close streams in test before deleting file 2024-04-26 09:20:36 +02:00
Phillip Webb abdff95ad0 Merge branch '3.2.x'
Closes gh-40526
2024-04-25 12:54:13 -07:00
Phillip Webb 9e40970280 Support gzip compressed image layers
Update buildpack support to allow gzip compressed image layers to be
used when returned by the Docker engine. This update is restores
buildpack support when using Docker Desktop with the "Use containerd
for pulling and storing images" option enabled.

This commit introduces a new `ExportedImageTar` class to deal with the
intricacies of determining the mimetype of a layer. The class deals with
the parsing of `index.json' and related manifest blobs in order to
obtain layer information. The legacy `manifest.json` format is also
supported should `index.json` be missing.

Tests have been added to ensure that export archives from Docker Engine,
Docker Desktop (with and without containerd), and Podman can be used.

Fixes gh-40100

Co-authored-by: Moritz Halbritter <moritz.halbritter@broadcom.com>
Co-authored-by: Scott Frederick <scott.frederick@broadcom.com>
2024-04-25 11:51:59 -07:00
Moritz Halbritter 3ab21ce146 Merge branch '3.2.x'
Closes gh-40118
2024-03-27 09:42:59 +01:00
Moritz Halbritter 957facf1cc Merge branch '3.1.x' into 3.2.x
Closes gh-40117
2024-03-27 09:35:44 +01:00