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

Disable external configuration sources parsing in native-mode #42103

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.quarkus.deployment.builditem.StaticInitConfigBuilderBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.runtime.configuration.SystemOnlySourcesConfigBuilder;
import io.quarkus.runtime.graal.InetRunTime;
Expand Down Expand Up @@ -62,6 +63,16 @@ void systemOnlySources(BuildProducer<StaticInitConfigBuilderBuildItem> staticIni
runTimeConfigBuilder.produce(new RunTimeConfigBuilderBuildItem(SystemOnlySourcesConfigBuilder.class.getName()));
}

/**
* Disable external configuration sources parsing for native executables since they are not supported see
* https://github.com/quarkusio/quarkus/issues/41994
*/
@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
void nativeNoSources(BuildProducer<StaticInitConfigBuilderBuildItem> staticInitConfigBuilder,
BuildProducer<RunTimeConfigBuilderBuildItem> runTimeConfigBuilder) {
runTimeConfigBuilder.produce(new RunTimeConfigBuilderBuildItem(SystemOnlySourcesConfigBuilder.class.getName()));
Copy link
Member

Choose a reason for hiding this comment

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

I believe this is going to fail in the native build tests because this will disable the discovery of the external config folder:

https://github.com/smallrye/smallrye-config/blob/d61a0d7430adbd919121437f34b93b05d2a56f85/implementation/src/main/java/io/smallrye/config/SmallRyeConfigBuilder.java#L197-L220

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, that's not gonna work. Closing this and I will prepare another PR registering the necessary files as resources.

Copy link
Member

Choose a reason for hiding this comment

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

io.smallrye.config.PropertiesConfigSourceLoader#inFileSystem is public, so you can probably add a specific builder just for the native image with the inFileSystem registration.

}

private static class SystemOnlySources implements BooleanSupplier {
ConfigBuildTimeConfig configBuildTimeConfig;

Expand Down
Loading