Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a new extension for generating Dockerfiles #42316

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iocanel
Copy link
Contributor

@iocanel iocanel commented Aug 5, 2024

Updates:

  • Applied feedback from gsmet
  • Replaced String.format with Qute.fmt
  • dockerfiles command now forces quarkus-dockerfiles as dependency

@quarkus-bot quarkus-bot bot added the area/dependencies Pull requests that update a dependency file label Aug 5, 2024

This comment has been minimized.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from ad21261 to 1866652 Compare August 6, 2024 06:07

This comment has been minimized.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from 1866652 to 4092aca Compare August 6, 2024 08:17

This comment has been minimized.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from 4092aca to afcb767 Compare August 6, 2024 08:47

This comment has been minimized.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from afcb767 to 8b617f8 Compare August 6, 2024 10:01
@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation labels Aug 6, 2024

This comment has been minimized.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from 8b617f8 to 7ffcce4 Compare August 6, 2024 10:35

This comment has been minimized.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good over all, I spotted only micro issues.

Not sure who would have the time to test this one. @maxandersen do you have somebody in mind?

@gsmet
Copy link
Member

gsmet commented Aug 9, 2024

Hey @iocanel . The feature freeze for 3.14 and 3.15 LTS is next Tuesday so we should really try to finalize this as it's an awesome feature.

Someone asked about it here #42441 and I was thinking of asking them to test but... we need instructions on how to install it as I don't think it comes by default?

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some additional comments that need fixing.

I saw you asked for a review by @maxandersen and @cescoffier anyway so I will let it there until they have time to review it.

@gsmet
Copy link
Member

gsmet commented Aug 12, 2024

I'm also wondering if in the future we should generate the default Dockerfiles from there to be consistent.

@ia3andy
Copy link
Contributor

ia3andy commented Aug 20, 2024

@iocanel any reason not to continue on what you started with codestarts?

@ia3andy
Copy link
Contributor

ia3andy commented Aug 20, 2024

It should be possible to share the same templates as the existing codestarts and use a subset part of the codestart generator for generation.

Copy link
Member

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have missed something but where extensions can add packages and files to the generated docker files?

So far I only see the "from" customization.

@iocanel
Copy link
Contributor Author

iocanel commented Sep 3, 2024

I may have missed something but where extensions can add packages and files to the generated docker files?

So far I only see the "from" customization.

What I had in my mind is to deal with just #41772 and leave the rest for future prs. If you feel that this needs to be done in one go, please let me know.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from 7ffcce4 to ab5590e Compare September 30, 2024 08:23
@quarkus-bot quarkus-bot bot added area/cli Related to quarkus cli (not maven/gradle/etc.) area/core labels Sep 30, 2024

This comment has been minimized.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from ab5590e to 95984d7 Compare October 1, 2024 05:21
Copy link

github-actions bot commented Oct 1, 2024

🎊 PR Preview a98fb44 has been successfully built and deployed to https://quarkus-pr-main-42316-preview.surge.sh/version/main/guides/

  • Images of blog posts older than 3 months are not available.
  • Newsletters older than 3 months are not available.

This comment has been minimized.

This comment has been minimized.

@cescoffier
Copy link
Member

@iocanel Where are we on this?

@iocanel
Copy link
Contributor Author

iocanel commented Nov 11, 2024

@iocanel Where are we on this?
AFAIR, @gsmet and @ia3andy concerns have been addressed. So, we could possible or merge.

@iocanel iocanel requested review from gsmet and cescoffier November 11, 2024 06:16
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case it was a problem to have CLI be a quarkus app. Check you can build from scratch.

import picocli.CommandLine.Parameters;

@TopCommand
@Command(name = "dockerfiles", sortOptions = false, mixinStandardHelpOptions = false, header = "Generate Dockerfiles.", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", optionListHeading = "%nOptions:%n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Command(name = "dockerfiles", sortOptions = false, mixinStandardHelpOptions = false, header = "Generate Dockerfiles.", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", optionListHeading = "%nOptions:%n")
@Command(name = "dockerfiles", sortOptions = false, mixinStandardHelpOptions = false, header = "Generate Dockerfiles/Containerfiles.", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", optionListHeading = "%nOptions:%n")

@Option(names = { "--native" }, paramLabel = "", order = 5, description = "Flag to enable Native Dockerfile generation")
boolean generateNativeDockerfile;

@Parameters(arity = "0..1", paramLabel = "GENERATION_PATH", description = " The path to generate Dockerfiles")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@Parameters(arity = "0..1", paramLabel = "GENERATION_PATH", description = " The path to generate Dockerfiles")
@Parameters(arity = "0..1", paramLabel = "GENERATION_PATH", description = "The path to generate Dockerfiles")

private static final ArtifactDependency QUARKUS_DOCKERFILES_SPI = new ArtifactDependency("io.quarkus",
"quarkus-dockerfiles-spi", null, "jar", Dockerfiles.getVersion());

@Option(names = { "--jvm" }, paramLabel = "", order = 5, description = "Flag to enable JVM Dockerfile generation")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it generate all the variants or a single one (in this case, which one?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't. By default a jvm Dockerfile will be generated, unless the user implies native by option or Dockerfile suffix.
In such cases this option is available to also generate a jvm file:

  1. No options -> Jvm
  2. Native options -> Native
  3. Native options + Jvm Options -> Native + Jvm

@cescoffier
Copy link
Member

@iocanel ping.

@iocanel
Copy link
Contributor Author

iocanel commented Dec 2, 2024

I'll get back to it this week

@cescoffier
Copy link
Member

@iocanel Hey! Gently "happy new year" reminder :-)

@iocanel
Copy link
Contributor Author

iocanel commented Jan 17, 2025

I am now back at it.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch 2 times, most recently from 59ded5f to 13b326a Compare January 17, 2025 11:55

This comment has been minimized.

This comment has been minimized.

@iocanel iocanel force-pushed the gen-dockerfiles-from branch from 13b326a to fb049e5 Compare January 17, 2025 13:48
Copy link

quarkus-bot bot commented Jan 17, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit fb049e5.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Warning

There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

quarkus-bot bot commented Jan 17, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit fb049e5.

Failing Jobs

Status Name Step Failures Logs Raw logs Build scan
Native Tests - Misc4 Build Failures Logs Raw logs 🔍

Full information is available in the Build summary check run.
You can consult the Develocity build scans.

Failures

⚙️ Native Tests - Misc4 #

- Failing: integration-tests/gradle 

📦 integration-tests/gradle

io.quarkus.gradle.nativeimage.BasicJavaNativeBuildIT.shouldBuildNativeImage - History - More details - Source on GitHub

java.lang.AssertionError: Gradle build failed with exit code 137
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
	at app//io.quarkus.gradle.nativeimage.QuarkusNativeGradleITBase.runGradleWrapper(QuarkusNativeGradleITBase.java:36)
	at app//io.quarkus.gradle.nativeimage.BasicJavaNativeBuildIT.shouldBuildNativeImage(BasicJavaNativeBuildIT.java:24)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)

io.quarkus.gradle.nativeimage.BasicJavaNativeBuildIT.shouldBuildNativeImageWithCustomName - History - More details - Source on GitHub

java.lang.AssertionError: Gradle build failed with exit code 137
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
	at app//io.quarkus.gradle.nativeimage.QuarkusNativeGradleITBase.runGradleWrapper(QuarkusNativeGradleITBase.java:36)
	at app//io.quarkus.gradle.nativeimage.BasicJavaNativeBuildIT.shouldBuildNativeImageWithCustomName(BasicJavaNativeBuildIT.java:53)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)

io.quarkus.gradle.nativeimage.BasicJavaNativeBuildIT.shouldBuildNativeImageWithCustomNameWithoutSuffix - History - More details - Source on GitHub

java.lang.AssertionError: Gradle build failed with exit code 137
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
	at app//io.quarkus.gradle.nativeimage.QuarkusNativeGradleITBase.runGradleWrapper(QuarkusNativeGradleITBase.java:36)
	at app//io.quarkus.gradle.nativeimage.BasicJavaNativeBuildIT.shouldBuildNativeImageWithCustomNameWithoutSuffix(BasicJavaNativeBuildIT.java:84)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)

io.quarkus.gradle.nativeimage.CustomNativeTestSourceSetIT.runNativeTests - History - More details - Source on GitHub

java.lang.AssertionError: Gradle build failed with exit code 137
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
	at app//io.quarkus.gradle.nativeimage.QuarkusNativeGradleITBase.runGradleWrapper(QuarkusNativeGradleITBase.java:36)
	at app//io.quarkus.gradle.nativeimage.CustomNativeTestSourceSetIT.runNativeTests(CustomNativeTestSourceSetIT.java:17)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)

io.quarkus.gradle.nativeimage.NativeIntegrationTestIT.nativeTestShouldRunIntegrationTest - History - More details - Source on GitHub

java.lang.AssertionError: Gradle build failed with exit code 137
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
	at app//io.quarkus.gradle.nativeimage.QuarkusNativeGradleITBase.runGradleWrapper(QuarkusNativeGradleITBase.java:36)
	at app//io.quarkus.gradle.nativeimage.NativeIntegrationTestIT.nativeTestShouldRunIntegrationTest(NativeIntegrationTestIT.java:24)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)

io.quarkus.gradle.nativeimage.NativeIntegrationTestIT.runNativeTestsWithOutputName - History - More details - Source on GitHub

java.lang.AssertionError: Gradle build failed with exit code 137
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
	at app//io.quarkus.gradle.nativeimage.QuarkusNativeGradleITBase.runGradleWrapper(QuarkusNativeGradleITBase.java:36)
	at app//io.quarkus.gradle.nativeimage.NativeIntegrationTestIT.runNativeTestsWithOutputName(NativeIntegrationTestIT.java:35)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)

io.quarkus.gradle.nativeimage.NativeIntegrationTestIT.runNativeTestsWithoutRunnerSuffix - History - More details - Source on GitHub

java.lang.AssertionError: Gradle build failed with exit code 137
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:140)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:57)
	at app//io.quarkus.gradle.QuarkusGradleWrapperTestBase.runGradleWrapper(QuarkusGradleWrapperTestBase.java:52)
	at app//io.quarkus.gradle.nativeimage.QuarkusNativeGradleITBase.runGradleWrapper(QuarkusNativeGradleITBase.java:36)
	at app//io.quarkus.gradle.nativeimage.NativeIntegrationTestIT.runNativeTestsWithoutRunnerSuffix(NativeIntegrationTestIT.java:45)
	at [email protected]/java.lang.reflect.Method.invoke(Method.java:569)
	at [email protected]/java.util.ArrayList.forEach(ArrayList.java:1511)

Flaky tests - Develocity

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-reactive-messaging/deployment

io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector - History

  • Expecting actual: ["-4","-5","-6","-7","-8","-9","-10","-11"] to start with: ["-3", "-4", "-5", "-6"] - java.lang.AssertionError
java.lang.AssertionError: 

Expecting actual:
  ["-4","-5","-6","-7","-8","-9","-10","-11"]
to start with:
  ["-3", "-4", "-5", "-6"]

	at io.quarkus.smallrye.reactivemessaging.hotreload.ConnectorChangeTest.testUpdatingConnector(ConnectorChangeTest.java:36)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to quarkus cli (not maven/gradle/etc.) area/core area/dependencies Pull requests that update a dependency file area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation triage/flaky-test
Projects
Status: Review pending
4 participants