118 Commits

Author SHA1 Message Date
Andy Wilkinson
2cec3971d7 Prohibit unwanted dependencies in all modules not just starters
Closes gh-28658
2021-11-12 20:04:35 +00:00
Stephane Nicoll
1b3f52d609 Harmonize line endings
See gh-27615
2021-10-28 15:22:57 +02:00
Andy Wilkinson
c5d45585d9 Remove unnecessary overrides of finalize
Closes gh-28209
2021-10-08 12:39:00 +01:00
Scott Frederick
c8ff874e91 Add builderFor label to ephemeral builder image
Adding a label to the ephemeral builder image cloned from the base
builder image eliminates contention between builds that are run
concurrently. Without this label, concurrent builds could result in
a race condition in the Docker daemon if the ephemeral builder image
shared by builds was deleted by both builds at exactly the same time.

Fixes gh-27888
2021-09-14 15:22:23 -05:00
Andy Wilkinson
ffbd28b60a Polish "Polish access modifiers for test classes"
See gh-27736
2021-08-18 17:52:42 +01:00
izeye
8a425dedfd Polish access modifiers for test classes
See gh-27736
2021-08-18 17:38:40 +01:00
Phillip Webb
49d3ecc2b2 Merge branch '2.3.x' into 2.4.x
Closes gh-26702
2021-05-28 14:53:12 -07:00
Phillip Webb
617f7b9587 Improve ImageName/ImageReference parse performance
Update `ImageName` and `ImageReference` to use distinct regex patterns
to parse specific parts of the value. Prior to this commit a single
regex pattern was used which could hang given certain input strings.

Fixes gh-23115
2021-05-28 14:52:27 -07:00
Scott Frederick
9108b81bb2 Merge branch '2.3.x' into 2.4.x
Closes gh-25937
2021-04-08 13:03:26 -05:00
Scott Frederick
0ad7f76263 Preserve file permissions in images built by Gradle
This commit copies the file mode along with other attributes when
copying files from the source archive to the build container while
building an image using the Gradle plugin. This preserves file
permissions on any resources included in the source archive.

Fixes gh-25915
2021-04-08 12:56:41 -05:00
Phillip Webb
a28a3ae090 Merge branch '2.3.x' into 2.4.x 2021-03-30 09:25:46 -07:00
Phillip Webb
363f5829d1 Merge branch '2.3.x' into 2.4.x
Closes gh-25825
2021-03-29 15:46:50 -07:00
Andy Wilkinson
788a42d694 Merge branch '2.3.x' into 2.4.x
See gh-25076
2021-02-02 15:12:27 +00:00
Andy Wilkinson
67479b6380 Add junit-platform-launcher dependency by convention
Closes gh-25074
2021-02-02 13:03:21 +00:00
Phillip Webb
257608a3a3 Merge branch '2.3.x' into 2.4.x
Closes gh-25076
2021-02-01 16:03:43 -08:00
Phillip Webb
939b5dfc26 Add junit-platform-launcher dependency
Update `build.gradle` files to ensure that `junit-platform-launcher` is
a `testRuntimeOnly` dependency. This ensures that tests can be run from
Eclipse.

Closes gh-25074
2021-02-01 15:31:28 -08:00
Scott Frederick
a9e711e503 Enforce builder and run images in the same registry
Previously, when an authenticated Docker builder registry was
configured in the Maven or Gradle plugin and the builder and run
images specified different registries, the authentication credentials
would be sent to both registries. This could cause confusion if both
registries don't recognize the same credentials. This commit enforces
that both images are in the same registry when authentication
is configured.

Fixes gh-24552
2021-01-12 17:50:28 -06:00
Scott Frederick
04a40a4c68 Provide content-length header to Docker API calls
Docker daemon authorization plugins reject POST or PUT requests that have a
content type `application/json` header but no content length header. This
commit ensures that a content length header is provided in these cases.

This is a cherry-pick of the changes in d5b2836ec90c5a94b2201c074db5e3fcc99a9204
which were lost in a forward-merge.

Fixes gh-23957
2020-10-28 17:31:27 -05:00
Scott Frederick
d5b2836ec9 Provide content-length header to Docker API calls
Docker daemon authorization plugins reject POST or PUT requests that have a
content type `application/json` header but no content length header. This
commit ensures that a content length header is provided in these cases.

Fixes gh-22840
2020-10-28 15:15:32 -05:00
Andy Wilkinson
2d8528d5bd Adapt to deprecation of StringUtils.isEmpty(Object)
See gh-23774
2020-10-22 17:09:33 +01:00
Scott Frederick
38984985d4 Add support for CNB platform API 0.4
This commit adds support for platform API 0.4 when invoking a CNB
builder in the Maven and Gradle plugins. If the builder advertises
that it supports platform API 0.4 then that version will be
requested when invoking lifecycle phases. Otherwise the plugins
will fall back to requesting platform API 0.3.

Requesting platform API 0.4 when invoking builder lifecycle phases
has the primary benefit of making it easier to pass command-line
arguments to the default process in the generated image.

Fixes gh-23692
2020-10-19 17:33:40 -05:00
Scott Frederick
5b1b03c56c Set platform API version when invoking image builder
The CNB specifications allow builders to support multiple platform
API versions. The supported versions are published in the builder
image metadata as an array of version numbers, while a single
supported version number was published in earlier builder metadata.

These changes read the supported versions from the builder metadata
and fall back to the single version if the array is not present.
A CNB_PLATFORM_API environment variable is set on each lifecycle
phase invocation to request a specific version as recommended in
the CNB platform spec.

Fixes gh-23682
2020-10-14 11:49:34 -05:00
Scott Frederick
0e7ab88491 Polish "Update default builder image"
See gh-23628
2020-10-12 17:07:33 -05:00
Emily Casey
461dc23c0c Update default builder image
This commit updates the default builder image used by the Maven
and Gradle plugins image-building goal and task to use the latest
Paketo builder image. The builder image is pulled from Docker Hub
instead of Google Container Registry by default.

See gh-23628
2020-10-12 17:06:42 -05:00
Scott Frederick
09b627d232 Add support for publishing docker images to a registry
This commit adds options to the Maven and Gradle plugins to publish
to a Docker registry the image generated by the image-building goal
and task.

The Docker registry auth configuration added in an earlier commit
was modified to accept separate auth configs for the builder/run
image and the generated image, since it is likely these images will
be stored in separate registries or repositories with distinct
auth required for each.

Fixes gh-21001
2020-10-07 16:51:33 -05:00
Scott Frederick
54288678d1 Configure Docker host in build plugins
This commit adds the ability to configure the Maven and Gradle
plugins to use a remote Docker daemon using build file
configuration, as an alternative to setting environment variables
to specify remote host connection details.

Fixes gh-23400
2020-09-18 13:51:20 -05:00
Phillip Webb
27095d9043 Polish 2020-09-17 00:31:00 -07:00
Scott Frederick
86fa8144f5 Polish "Support authentication to private Docker registry"
See gh-22972
2020-09-16 16:04:21 -05:00
姜为
e8f555e13d Support authentication to private docker registry
This commit adds the ability to configure Docker image registry
authentication credentials in the Maven and Gradle plugins. The
authentication credentials are passed to the Docker daemon with
all daemon API calls, and the daemon forwards the credentials to the
image registry when necessary. This makes it possible to use
builder and run images stored in a private Docker registry.

See gh-22972
2020-09-16 16:03:40 -05:00
Scott Frederick
b70d0dd5ac Merge branch '2.3.x'
Closes gh-23134
2020-08-28 17:04:57 -05:00
Scott Frederick
bc1834bfdf Ensure layer digest hashes contain 64 characters
This commit ensures that encoded digest hashes for Docker image
layers are zero-padded to the required 64 characters length.

Fixes gh-23132
2020-08-28 17:04:34 -05:00
Scott Frederick
ccabc1a4c9 Merge branch '2.3.x'
Closes gh-23133
2020-08-28 15:18:30 -05:00
Scott Frederick
4f1b4c98ae Fail on Docker image load with empty response
In some cases, a call to the Docker image load API will fail but
return a 200 OK response status code and an empty response. This
commit detects that the response from this call is empty and
treats this condition as an error instead of a silent failure.

Fixes gh-23130
2020-08-28 15:18:02 -05:00
dreis2211
33cd875cb8 Simplify InputStream assertions
See gh-23052
2020-08-24 11:35:17 +02:00
Scott Frederick
ee41d71ea8 Merge branch '2.3.x'
Closes gh-23016
2020-08-19 16:12:44 -05:00
Scott Frederick
56bc0eb9e0 Use canonical path for CNB builder lifecycle binaries
This commit changes the path used to invoke lifecycle binaries in
CNB builders from `/lifecycle` to `/cnb/lifecycle` to conform to
the CNB spec. This will ensure the build plugin image-building
goals and tasks are compatible with future versions of builders
that may not support both paths.

See gh-23009
2020-08-19 16:11:59 -05:00
Scott Frederick
6b15822cb1 Polish "Add pullPolicy option for image building"
See gh-22736
2020-08-12 15:16:38 -05:00
anshlykov
c7449b57ce Add pullPolicy option for image building
This commit adds a pullPolicy option to the configuration of the Maven
plugin spring-boot:build-image goal and the Gradle plugin bootBuildImage
task. The new option gives users control over pulling the builder image
and run image from a remote image registry to the local Docker daemon.

See gh-22736
2020-08-12 15:16:38 -05:00
Andy Wilkinson
969dd35e45 Upgrade to Mockito 3.4.6
Closes gh-22838
2020-08-10 15:22:03 +01:00
Scott Frederick
f247fec310 Merge branch '2.3.x'
Closes gh-22735
2020-08-04 15:30:17 -05:00
Scott Frederick
21b2dd2740 Allow empty env entries when building an image
Prior to this commit, an entry in the environment map provided to the
build plugin image building goal or task that had a null value would
result in a failure with a message that was difficult to diagnose.

This commit treats env map entries with a null value as an empty
entry to prevent the failure and also make it easier to provide an
explicit empty entry in the Maven XML.

Fixes gh-22703
2020-08-04 15:29:29 -05:00
dreis2211
e49e2dfff1 Use Supplier variants of Assert methods
See gh-22699
2020-08-03 15:06:13 +02:00
Phillip Webb
da69286838 Merge branch '2.3.x' 2020-07-22 17:39:27 -07:00
Phillip Webb
d2a7808098 Polish 2020-07-22 17:25:04 -07:00
Scott Frederick
e6318f83b2 Merge branch '2.3.x'
Closes gh-22349
2020-07-15 15:17:16 -05:00
Scott Frederick
bc88af8e53 Restore accidentally deleted line 2020-07-15 15:14:23 -05:00
Scott Frederick
210282260e Fail on bootBuildImage with launch script
This commit adds a check to the support code for the Gradle plugin
bootBuildImage task to ensure that the jar file that will be passed
to a builder is readable and has a valid directory. This prevents a
situation where the jar file cannot be read because it is prepended
with a launch script, and the builder does not receive any files to
process.

Notes have also been added to the Gradle plugin documentation to warn
against using a bootJar launchScript configuration and bootBuildImage
together, as well as caveats about launchScript that match the Maven
plugin documentation.

Fixes gh-22223
2020-07-15 14:58:11 -05:00
Andy Wilkinson
3d2f67f0be Merge branch '2.3.x'
Closes gh-22304
2020-07-10 15:36:49 +01:00
Andy Wilkinson
f18b657ff9 Fix handling of DOCKER_HOST that begins with unix://
Fixes gh-22300
2020-07-10 15:31:55 +01:00
Andy Wilkinson
160d8e49e3 Merge branch '2.3.x'
Closes gh-22180
2020-07-01 11:44:00 +01:00