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

Quarkus native ignores 'quarkus.profile' override in native mode #45622

Open
emakunin opened this issue Jan 15, 2025 · 1 comment
Open

Quarkus native ignores 'quarkus.profile' override in native mode #45622

emakunin opened this issue Jan 15, 2025 · 1 comment

Comments

@emakunin
Copy link

emakunin commented Jan 15, 2025

Describe the bug

Hello,
I'm using quakus native (GraalVM) with AWS lambdas. I have BETA/PROD stages where I want to deploy the same build artifact with different runtime configuration from profile files. But Quarkus native ignores config keys for beta after QUARKUS_PROFILE=beta env variable override in native mode.

Build process takes time, so I want to re-use the same build artifact for both enviroments. Also it is kind of safer to deploy the same binaries that were tested, not generated differently.

Is there a way to achieve my setup? Maybe some GraalVM options to disable profile optimisztions. If no it would be nice to add or at least mention in the docs explicitly. I'd imagine it's quite a common setup so can be useful for others.

Expected behavior

QUARKUS_PROFILE=beta should override profile for native images and load corresponding configuration (beta in this case at runtime. Or at least tell explicitly that it's not possible.

Actual behavior

  1. After QUARKUS_PROFILE=beta. Profile changed with a warning to beta with below warning
    2025-01-15 14:25:58,124 WARN  [io.qua.run.con.ConfigRecorder] (main) The profile 'prod' used to build the native image is different from the runtime profile 'beta'. This may lead to unexpected results.
    
  2. Quarkus keeps using prod config keys.
  3. In the documentation it's written that I can override the mode and there some instructions for integration tests. But being honest it's a bit vaugue for the native image use case. I cannot understand if it's supported or no.

How to Reproduce?

  1. I have separate custom profile aware files with the config for each stage: application-prod.configuration, application-beta.configuration. Also some "common/default" values in application.config. The files are in resources.
  2. I include the the resources to the native image as
     <quarkus.native.resources.includes>
       resources/**
     </quarkus.native.resources.includes>
    
  3. I build service in native mode without any profile overrides (prod used by default)
  4. Then I try to select necessary config at runtime using QUARKUS_PROFILE=beta env variable, but the values from the beta config are not read. (I test it using different CORS domains). In the lambda logs I see below warning
     2025-01-15 14:25:58,124 WARN  [io.qua.run.con.ConfigRecorder] (main) The profile 'prod' used to build the native image is different from the runtime profile 'beta'. This may lead to unexpected results.
    

Output of uname -a or ver

Version info: 'GraalVM 22.3.0.1-Final Java 17 Mandrel Distribution'
Java version info: '17.0.5+8'
C compiler: gcc (redhat, x86_64, 8.5.0)
Garbage collector: Serial GC
2 user-specific feature(s)

  • io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
  • io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase

Output of java -version

Java version info: '17.0.5+8'

Quarkus version or git rev

3.15.1 (LTS)

Build tool (ie. output of mvnw --version or gradlew --version)

mvn --version
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)

Additional information

No response

@emakunin emakunin added the kind/bug Something isn't working label Jan 15, 2025
Copy link

quarkus-bot bot commented Jan 16, 2025

/cc @Karm (native-image), @galderz (native-image), @zakkak (native-image)

@zakkak zakkak added kind/enhancement New feature or request and removed kind/bug Something isn't working labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants