Avoid reading System Properties during configuration phase with disableCreatingBuildConfigDuringConfiguration property#52507
Conversation
This comment has been minimized.
This comment has been minimized.
|
@aloubyansky @radcortez can you please take a look at this? Thanks |
|
I'll have a look. |
|
Being discussed in #52506. |
This comment has been minimized.
This comment has been minimized.
|
Please rebase this onto Thanks |
5f9012b to
55116ed
Compare
|
my mistake @geoand, fixed |
|
🙏 |
Status for workflow
|
radcortez
left a comment
There was a problem hiding this comment.
Based on our discussion in #52506 (comment), we recommend providing a new Map of values containing the configurations from PackageConfig and NativeConfig, and using that in the relevant tasks, instead of the full map of configuration values.
You should be able to use io.smallrye.config.ConfigMappings#propertyNamesMatcher, which takes the config classes and then use it to iterate the list of available configurations and match the properties to build a list of the names provided by the mapping classes.
|
@radcortez Thanks for the clarifications. I think I have a clear path to follow, but I would need some guidance to cover the next case: Using the new map and iterating over the different configurations works fine when operating in the task action or outputs. However, there is a case with getBuildInputFiles in the QuarkusBuild task: Because this is an input, iterating over the configurations would resolve the different properties during configuration time. In this PR, I covered the case by iterating "manually" over the configurations for system properties and application properties, but other cases such as environment variables or YAML files are not covered yet. I’m seeing some issues again with how this input is defined, and I’d appreciate your input here. |
My proposal was to generate this |
@radcortez would that result in reading all the system properties? |
|
What triggers the read of all system properties is the call to The problem is that the Map generated by that method is passed down to Hence my suggestion to generate only a Map with the |
This PR covers the issue described in #52464 and expanded on in discussion #52506.
The Quarkus Gradle plugin extension introduces a new property,
disableCreatingBuildConfigDuringConfiguration, which disables EffectConfig initialization during configuration. This avoids reading system properties at configuration time, which can cause configuration cache misses. TheEffectConfigstill happens during task execution.To opt out of the EffectConfig / BaseConfig configuration, we still need to provide the required properties used as inputs for
GetBuildFiles(QuarkuBuild). To do that, and only whendisableCreatingBuildConfigDuringConfigurationis enabled, we provide a Provider that supplies the required system properties.At the moment, we support two levels of properties:
For this experimental phase, this is sufficient. If we continue with this approach, we will likely need to replicate the other ConfigSource providers as well.
From the client perspective, the user only needs to enable the flag:
With this property enabled, a sequence of builds like:
will reuse the configuration cache on the second build.