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

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

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@quarkus-bot

This comment has been minimized.

@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
@quarkus-bot

This comment has been minimized.

@quarkus-bot
Copy link

quarkus-bot bot commented Aug 6, 2024

Status for workflow Quarkus CI

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

✅ 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.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 17

📦 integration-tests/opentelemetry

io.quarkus.it.opentelemetry.MetricsTest.directCounterTest - History

  • Condition with Lambda expression in io.quarkus.it.opentelemetry.MetricsTest was not fulfilled within 5 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: Condition with Lambda expression in io.quarkus.it.opentelemetry.MetricsTest was not fulfilled within 5 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:26)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1006)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:975)
	at io.quarkus.it.opentelemetry.MetricsTest.directCounterTest(MetricsTest.java:54)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-reactive-messaging/deployment

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

  • Expecting actual: ["-6","-8","-9","-10","-11","-12","-13","-14"] to start with: ["-6", "-7", "-8", "-9"] - java.lang.AssertionError
java.lang.AssertionError: 

Expecting actual:
  ["-6","-8","-9","-10","-11","-12","-13","-14"]
to start with:
  ["-6", "-7", "-8", "-9"]

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

📦 integration-tests/opentelemetry

io.quarkus.it.opentelemetry.MetricsTest.directCounterTest - History

  • Condition with Lambda expression in io.quarkus.it.opentelemetry.MetricsTest was not fulfilled within 5 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: Condition with Lambda expression in io.quarkus.it.opentelemetry.MetricsTest was not fulfilled within 5 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:26)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1006)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:975)
	at io.quarkus.it.opentelemetry.MetricsTest.directCounterTest(MetricsTest.java:54)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)

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?

Comment on lines +48 to +83
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-impl</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-spi</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-connector-basic</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-transport-file</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-transport-http</artifactId>
<version>1.1.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Copy link
Member

Choose a reason for hiding this comment

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

The indentation is off here.

Comment on lines +13 to +26
static final String DEFAULT_JVM_FROM = "registry.access.redhat.com/ubi8/openjdk-21:1.19";
static final String DEFAULT_NATIVE_FROM = "registry.access.redhat.com/ubi8/ubi-minimal:8.9";

/**
* The from image to use for JVM based Dockerfiles
*/
@ConfigItem(defaultValue = "registry.access.redhat.com/ubi8/openjdk-21:1.19")
String jvmFrom;

/**
* The from image to use for native based Dockerfiles
*/
@ConfigItem(defaultValue = "registry.access.redhat.com/ubi8/ubi-minimal:8.9")
String nativeFrom;
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR but we need to centralize all these images reference somewhere. We have them spread all over our code and it's a recipe for disaster.

I will create an issue about this so that we discuss it when @cescoffier is back.

metadata:
keywords:
- "dockerfiles"
guide: "https://quarkus.io/guides/dockerfiles"
Copy link
Member

Choose a reason for hiding this comment

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

Please only reference a guide here when you have one or @holly-cummins will be unhappy :).

Comment on lines +74 to +105
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
<configuration>
<skipOriginalJarRename>true</skipOriginalJarRename>
<environmentVariables>
<MAVEN_REPO_LOCAL>${settings.localRepository}</MAVEN_REPO_LOCAL>
<GRADLE_OPTS>${env.MAVEN_OPTS}</GRADLE_OPTS>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
Copy link
Member

Choose a reason for hiding this comment

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

Could you indent that part with 4 spaces too.

And yes, we need an XML formatter...

@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.

Comment on lines +19 to +25
@ConfigItem(defaultValue = "registry.access.redhat.com/ubi8/openjdk-21:1.19")
String jvmFrom;

/**
* The from image to use for native based Dockerfiles
*/
@ConfigItem(defaultValue = "registry.access.redhat.com/ubi8/ubi-minimal:8.9")
Copy link
Member

Choose a reason for hiding this comment

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

BTW, the constants should be used here.

@ConfigRoot
public class DockerfilesConfiguration {

static final String DEFAULT_JVM_FROM = "registry.access.redhat.com/ubi8/openjdk-21:1.19";
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
static final String DEFAULT_JVM_FROM = "registry.access.redhat.com/ubi8/openjdk-21:1.19";
static final String DEFAULT_JVM_FROM = "registry.access.redhat.com/ubi8/openjdk-21:1.20";

public class DockerfilesConfiguration {

static final String DEFAULT_JVM_FROM = "registry.access.redhat.com/ubi8/openjdk-21:1.19";
static final String DEFAULT_NATIVE_FROM = "registry.access.redhat.com/ubi8/ubi-minimal:8.9";
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
static final String DEFAULT_NATIVE_FROM = "registry.access.redhat.com/ubi8/ubi-minimal:8.9";
static final String DEFAULT_NATIVE_FROM = "registry.access.redhat.com/ubi8/ubi-minimal:8.10";

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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