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

Handle config secrets during build-time config detection #1160

Merged
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 @@ -36,6 +36,7 @@
import io.quarkus.test.utils.MapUtils;
import io.quarkus.test.utils.PropertiesUtils;
import io.quarkus.test.utils.TestExecutionProperties;
import io.smallrye.config.SecretKeys;

public abstract class QuarkusApplicationManagedResourceBuilder implements ManagedResourceBuilder {

Expand Down Expand Up @@ -299,14 +300,16 @@ protected void detectBuildTimeProperties(Map<String, String> computedProperties)
buildTimeConfigKeys.addAll(deploymentBuildProps);

// handle relocations - if relocation processor is applied, we won't find original config property
// in the build-time or build-time-runtime-fixed properties as we can only find there the relocated one
var relocatedBuildTimeProps = buildSystemProps
// in the build-time or build-time-runtime-fixed properties as we can only find there the relocated one;
// we can safely guess that secret keys are not build-time config props,
// but we don't create config ourselves, hence unlock keys to avoid build failures
var relocatedBuildTimeProps = SecretKeys.doUnlocked(() -> buildSystemProps
.stringPropertyNames()
.stream()
.filter(p -> !buildTimeConfigKeys.contains(p))
.filter(p -> !p.equals(config.getConfigValue(p).getName()))
.filter(p -> buildTimeConfigKeys.contains(config.getConfigValue(p).getName()))
.collect(toSet());
.collect(toSet()));
buildTimeConfigKeys.addAll(relocatedBuildTimeProps);

this.detectedBuildTimeProperties = Set.copyOf(buildTimeConfigKeys);
Expand Down