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

fix(trait): deprecate old native profile #6035

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
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
11 changes: 3 additions & 8 deletions pkg/builder/runtime_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ func (n *NativeSourcesAdapter) NativeMavenProperty() string {
}

// NativeAdapter used for Camel Quarkus runtime < 3.5.0.
// Deprecated: use NativeSourcesAdapter instead.
type NativeAdapter struct {
}

// BuildCommands -- .
func (n *NativeAdapter) BuildCommands() string {
// We must override the local repo as it's not shared from the builder container
return "cd " + n.Directory() + " && ./mvnw $(cat MAVEN_CONTEXT) package -Dquarkus.native.enabled=true -Dmaven.repo.local=./repo"
return "cd " + n.Directory() + " && ./mvnw $(cat MAVEN_CONTEXT) package -Dmaven.repo.local=./repo"
}

// Directory -- .
Expand All @@ -79,17 +80,11 @@ func (n *NativeAdapter) TargetDirectory(ctxPath, runner string) string {

// NativeMavenProperty -- .
func (n *NativeAdapter) NativeMavenProperty() string {
// Empty on purpose. The parameter will be provided later by the command (see BuildCommands()).
// Empty on purpose.
return ""
}

// QuarkusRuntimeSupport is used to get the proper native configuration based on the Camel Quarkus version.
func QuarkusRuntimeSupport(version string) QuarkusRuntimeNativeAdapter {
// Version 3.6.0 depends on a parameter which is available on JDK-21 based image.
// For this reason we fallback to the "legacy" Quarkus native build.
// Hopefully this will be solved starting from runtime version 3.7.0.
if version < "3.7.0" {
return &NativeAdapter{}
}
return &NativeSourcesAdapter{}
}
2 changes: 1 addition & 1 deletion pkg/trait/jvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (t *jvmTrait) enableDebug(e *Environment) string {
if meta.Labels == nil {
meta.Labels = make(map[string]string)
}
meta.Labels["camel.apache.org/debug"] = "true"
meta.Labels["camel.apache.org/debug"] = trueString
})
t.DebugAddress = "*:5005"

Expand Down
11 changes: 6 additions & 5 deletions pkg/trait/quarkus.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,14 @@ func (t *quarkusTrait) applyWhenBuildSubmitted(e *Environment) error {

//nolint:nestif
if native {
buildTask.Maven.Properties["quarkus.native.enabled"] = "true"
if nativePackageType := builder.QuarkusRuntimeSupport(e.CamelCatalog.GetCamelQuarkusVersion()).NativeMavenProperty(); nativePackageType != "" {
buildTask.Maven.Properties[nativePackageType] = "true"
if t.NativeBaseImage == "" {
packageTask.BaseImage = QuarkusNativeDefaultBaseImageName
} else {
packageTask.BaseImage = t.NativeBaseImage
}
}
if t.NativeBaseImage == "" {
packageTask.BaseImage = QuarkusNativeDefaultBaseImageName
} else {
packageTask.BaseImage = t.NativeBaseImage
}
if len(e.IntegrationKit.Spec.Sources) > 0 {
buildTask.Sources = e.IntegrationKit.Spec.Sources
Expand Down
Loading