paketo-buildpacks / health-checker

A Cloud Native Buildpack that provides a health check binary compatible with Docker health checks
Apache License 2.0
6 stars 0 forks source link

Error when building a spring boot application with spring-boot-maven-plugin #106

Closed spyse closed 4 months ago

spyse commented 4 months ago

I am building a spring boot application with spring-boot-maven-plugin which internally used buildpacks. Currently I am trying to add a healtcheck to the image.

Expected Behavior

Health-Checker should correctly be put into the image.

Current Behavior

Getting an error when building the image: ERROR: failed to initialize detector: open /cnb/buildpacks/paketo-buildpacks_health-checker/1.12.0/buildpack.toml: no such file or directory

Steps to Reproduce

Using a Mac with M2.

The maven configuration looks like this and was copied from this article: [Spring Boot Build Image with Health Check](https://stackoverflow.com/questions/75885269/spring-boot-build-image-with-health-check)

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <image>
            <name>${docker.image.prefix}:${project.version}</name>
            <createdDate>now</createdDate>
            <env>
                <BP_HEALTH_CHECKER_ENABLED>true</BP_HEALTH_CHECKER_ENABLED>
            </env>
            <buildpacks>
                <buildpack>urn:cnb:builder:paketo-buildpacks/java</buildpack>
                <buildpack>gcr.io/paketo-buildpacks/health-checker</buildpack>
            </buildpacks>
        </image>
        <docker>
            <publishRegistry>
                <url>${docker.publishRegistry.url}</url>
                <username>${docker.publishRegistry.username}</username>
                <password>${docker.publishRegistry.password}</password>
            </publishRegistry>
        </docker>
        <layers>
            <enabled>true</enabled>
        </layers>
        <excludes>
            <exclude>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
            </exclude>
        </excludes>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>build-image-no-fork</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The maven build output:

[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 0%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 1%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 2%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 3%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 4%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 5%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 6%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 6%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 8%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 9%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 9%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 10%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 11%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 12%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 13%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 14%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 14%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 15%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 16%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 17%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 18%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 20%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 22%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 22%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 23%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 24%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 25%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 42%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 56%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 57%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 58%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 59%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 60%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 64%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 73%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 79%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 83%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 85%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 86%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 90%
[INFO]  > Pulling builder image 'docker.io/paketobuildpacks/builder-jammy-base:latest' 100%
[INFO]  > Pulled builder image 'paketobuildpacks/builder-jammy-base@sha256:0e4429ea36ba53aa285e111a4d2ee45a011e2fe4fa18a384551338d09be9caf8'
[INFO]  > Pulling run image 'docker.io/paketobuildpacks/run-jammy-base:latest' 100%
[INFO]  > Pulled run image 'paketobuildpacks/run-jammy-base@sha256:650a1959aa0d79221cd7afdd77bda0ec4602561dce1a23f91cc594d9c8388482'
[INFO]  > Pulling buildpack image 'gcr.io/paketo-buildpacks/health-checker:latest' 44%
[INFO]  > Pulling buildpack image 'gcr.io/paketo-buildpacks/health-checker:latest' 100%
[INFO]  > Pulled buildpack image 'gcr.io/paketo-buildpacks/health-checker@sha256:600704e10e3623fc7775ce32eecb1de1629b515c0240a474745f5293510f747a'
[INFO]  > Executing lifecycle version v0.18.5
[INFO]  > Using build cache volume 'pack-cache-bea492d2f00d.build'
[INFO]
[INFO]  > Running creator
[INFO]     [creator]     ===> ANALYZING
[INFO]     [creator]     Restoring data for SBOM from previous image
[INFO]     [creator]     ===> DETECTING
[INFO]     [creator]     ERROR: failed to initialize detector: open /cnb/buildpacks/paketo-buildpacks_health-checker/1.12.0/buildpack.toml: no such file or directory

Any ideas? Rather a local problem or a general?

farkasmate commented 4 months ago

I can confirm, this is not a local problem. I face the same issue.

EDIT: Seems to be related to https://github.com/spring-projects/spring-boot/issues/39323

spyse commented 4 months ago

Thanks for the hint! I did not find your linked thread until now...

So it is actually a spring boot maven plugin problem and should be fixed soon: According to this response

dmikusa commented 4 months ago

Yes, please follow up with the Spring Boot team. In the meantime, you can pack build images and that should be OK.