spring-projects / spring-projects/spring-boot

Use a local builder image when the image does not exist in the remote repository

Open
#25,831 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

Issue

The maven plugin/goal spring-boot:build-image -Dspring-boot.build-image.builder= when executed cannot find the docker image within the local repo while pack build can

Maven error

mvn clean spring-boot:build-image -Dspring-boot.build-image.builder=redhat/buildpacks-builder-snowdrop-jvm:latest 
executing mvnw instead of mvn
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< dev.snowdrop:getting-started >--------------------
[INFO] Building getting-started 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ getting-started ---
[INFO] Deleting /Users/cmoullia/code/snowdrop/snowdrop-buildpacks/apps/snowdrop-sample-app/target
[INFO] 
[INFO] >>> spring-boot-maven-plugin:2.4.4:build-image (default-cli) > package @ getting-started >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ getting-started ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ getting-started ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/cmoullia/code/snowdrop/snowdrop-buildpacks/apps/snowdrop-sample-app/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ getting-started ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /Users/cmoullia/code/snowdrop/snowdrop-buildpacks/apps/snowdrop-sample-app/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ getting-started ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/cmoullia/code/snowdrop/snowdrop-buildpacks/apps/snowdrop-sample-app/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ getting-started ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running dev.snowdrop.gettingstarted.GettingStartedApplicationTests
18:29:06.741 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
18:29:06.750 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
...
[INFO] 
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ getting-started ---
[INFO] Building jar: /Users/cmoullia/code/snowdrop/snowdrop-buildpacks/apps/snowdrop-sample-app/target/getting-started-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.4.4:repackage (repackage) @ getting-started ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] <<< spring-boot-maven-plugin:2.4.4:build-image (default-cli) < package @ getting-started <<<
[INFO] 
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.4.4:build-image (default-cli) @ getting-started ---
[INFO] Building image 'docker.io/library/getting-started:0.0.1-SNAPSHOT'
[INFO] 
[INFO]  > Pulling builder image 'docker.io/redhat/buildpacks-builder-snowdrop-jvm:latest' 100%
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.149 s
[INFO] Finished at: 2021-03-30T18:29:12+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.4.4:build-image (default-cli) on project getting-started: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.4.4:build-image failed: Docker API call to 'localhost/v1.24/images/create?fromImage=docker.io%2Fredhat%2Fbuildpacks-builder-snowdrop-jvm%3Alatest' failed with status code 404 "Not Found" -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Pack build
pack build snowdrop/demo/hello --path . --builder redhat/buildpacks-builder-snowdrop-jvm
0.10.2: Pulling from buildpacksio/lifecycle
Digest: sha256:c3a070ed0eaf8776b66f9f7c285469edccf5299b3283c453dd45699d58d78003
Status: Image is up to date for buildpacksio/lifecycle:0.10.2
===> DETECTING
[detector] dev.snowdrop.buildpacks.buildpack 0.0.1
===> ANALYZING
[analyzer] Restoring metadata for "dev.snowdrop.buildpacks.buildpack:0-ubiconfig" from app image
[analyzer] Restoring metadata for "dev.snowdrop.buildpacks.buildpack:1-app" from app image
[analyzer] Restoring metadata for "dev.snowdrop.buildpacks.buildpack:2-app" from app image
[analyzer] Restoring metadata for "dev.snowdrop.buildpacks.buildpack:m2repo" from cache
===> RESTORING
[restorer] Restoring data for "dev.snowdrop.buildpacks.buildpack:m2repo" from cache
^CERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: context canceled

Info

Spring Boot version used: 2.4.4
Builder project and script used to build .... buildpacks: https://github.com/snowdrop/snowdrop-buildpacks/blob/2cf05844f35226c07a5df7fea88396caf4c955a2/create-buildpacks.sh

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the spring-boot:build-image Maven goal in Spring Boot 2.4.4 and compare its builder-image handling with the pack build command shown in the report. Use the referenced create-buildpacks.sh script for the builder context; done means a locally available builder is used without an unnecessary remote pull and the image build proceeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, spring-boot
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.