This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 9994e44f0 feat(builder): deprecate custom tasks
9994e44f0 is described below

commit 9994e44f05c2eaddcdb1c12ea19c00d79032d302
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Sat Jun 20 09:21:05 2026 +0200

    feat(builder): deprecate custom tasks
    
    Favour external pipeline technology when needed
---
 docs/modules/ROOT/pages/installation/builds.adoc   |   4 +-
 docs/modules/ROOT/pages/pipeline/pipeline.adoc     |   8 +-
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |   7 +-
 docs/modules/traits/pages/builder.adoc             |   9 +-
 e2e/common/traits/builder_test.go                  |  91 +--------------
 e2e/native/native_test.go                          |  18 ++-
 helm/camel-k/crds/camel-k-crds.yaml                |  99 +++++++++++-----
 pkg/apis/camel/v1/trait/builder.go                 |   7 +-
 pkg/platform/env_platform.go                       |   2 +-
 pkg/platform/env_platform_test.go                  |   6 +-
 .../bases/camel.apache.org_integrationkits.yaml    |  11 +-
 .../camel.apache.org_integrationplatforms.yaml     |  22 +++-
 .../camel.apache.org_integrationprofiles.yaml      |  22 +++-
 .../crd/bases/camel.apache.org_integrations.yaml   |  22 +++-
 .../config/crd/bases/camel.apache.org_pipes.yaml   |  22 +++-
 pkg/trait/builder.go                               | 124 ++++++++++++---------
 pkg/trait/builder_test.go                          |  12 +-
 17 files changed, 273 insertions(+), 213 deletions(-)

diff --git a/docs/modules/ROOT/pages/installation/builds.adoc 
b/docs/modules/ROOT/pages/installation/builds.adoc
index 965403e14..b9b93ba5d 100644
--- a/docs/modules/ROOT/pages/installation/builds.adoc
+++ b/docs/modules/ROOT/pages/installation/builds.adoc
@@ -52,8 +52,8 @@ Here a quick resume of the parameters you can configure as 
environment variables
 |
 
 | BUILDER_TASKS_ENABLED
-| Controls whether CR authors are permitted to inject custom pipeline tasks 
via the `builder.tasks` trait. Set to `false` to disable custom task injection 
for all integrations managed by this operator. When unset or set to any value 
other than `false`, custom tasks are allowed (default behavior).
-| `true`
+| Controls whether CR authors are permitted to inject custom pipeline tasks 
via the `builder.tasks` trait. Set to `true` to enable custom task injection 
for all integrations managed by this operator.
+| `false`
 
 | BUILDER_NODE_SELECTOR_ALLOWED_LABELS
 | Comma-separated list of node-selector label keys that CR authors are 
permitted to set via the `builder.nodeSelector` trait. When unset or empty all 
keys are accepted. Unlisted keys are dropped and an info message is logged. 
Example: `kubernetes.io/hostname,topology.kubernetes.io/zone`.
diff --git a/docs/modules/ROOT/pages/pipeline/pipeline.adoc 
b/docs/modules/ROOT/pages/pipeline/pipeline.adoc
index 2aa77dc5d..9903a6451 100644
--- a/docs/modules/ROOT/pages/pipeline/pipeline.adoc
+++ b/docs/modules/ROOT/pages/pipeline/pipeline.adoc
@@ -1,7 +1,11 @@
 [[build-pipeline]]
 = Build Pipeline
 
-Since version 2.0, we've introduced the concept of `Pipeline` in order to 
provide a degree of flexibility for those user that want to customize the 
entire building process. We can think of a pipeline as a series of tasks that 
can be executed to generate a Camel application project, build it accordingly 
and publish into a container registry.
+Camel K operator provides an opinionated pipeline used to generate the project 
from the source code (user submitted DSL or Git based project), build, 
"containerize" and push to a container registry. This is generally robust 
enough to perform the building operations required to build and execute an 
application on the cloud.
+
+If you need more control on the build pipeline or you need any customization, 
you are invited to use an xref:pipeline/external.adoc[External CICD pipeline] 
instead.
+
+WARNING: the following documentation related to "custom tasks" is deprecated 
and will be removed in future releases.
 
 Camel K operator creates a default pipeline containing an opinionated `build`, 
`package` and `publish` operations. Beside them you can include any additional 
task in order to enrich the building process:
 
@@ -21,6 +25,8 @@ The final user can include any optional task, which, by 
default is run after a b
 
 Custom tasks are only available using builder `pod` strategy in order to let 
the user provide each task with the tools required to run the specific 
customization.
 
+NOTE: from version 2.11.0 onward, you will need to explicitly enable the 
feature setting `BUILDER_TASKS_ENABLED` environmnent variable as `true` on the 
operator Deployment.
+
 Let's see an example:
 
 ```yaml
diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc 
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 08bc344b0..6722737b5 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -6657,6 +6657,8 @@ Deprecated: will be removed in future versions.
 
 A list of tasks to be executed (available only when using `pod` strategy) with 
format `<name>;<container-image>;<container-command>`.
 
+Deprecated: may be removed in future versions.
+
 |`tasksFilter` +
 string
 |
@@ -6664,7 +6666,10 @@ string
 
 A list of tasks sorted by the order of execution in a csv format, ie, 
`<taskName1>,<taskName2>,...`.
 Mind that you must include also the operator tasks (`builder`, 
`quarkus-native`, `package`, `jib`, `s2i`)
-if you need to execute them. Useful only with `pod` strategy.
+if you need to execute them. Useful only with `pod` strategy. Disabled by 
default, you need to enable via
+BUILDER_TASKS_ENABLED=true environment variable on operator Deployment.
+
+Deprecated: may be removed in future versions.
 
 |`tasksRequestCPU` +
 []string
diff --git a/docs/modules/traits/pages/builder.adoc 
b/docs/modules/traits/pages/builder.adoc
index 4701b1412..b2afa49ad 100755
--- a/docs/modules/traits/pages/builder.adoc
+++ b/docs/modules/traits/pages/builder.adoc
@@ -94,11 +94,16 @@ Deprecated: will be removed in future versions.
 | []string
 | A list of tasks to be executed (available only when using `pod` strategy) 
with format `<name>;<container-image>;<container-command>`.
 
+Deprecated: may be removed in future versions.
+
 | builder.tasksFilter
 | string
 | A list of tasks sorted by the order of execution in a csv format, ie, 
`<taskName1>,<taskName2>,...`.
 Mind that you must include also the operator tasks (`builder`, 
`quarkus-native`, `package`, `jib`, `s2i`)
-if you need to execute them. Useful only with `pod` strategy.
+if you need to execute them. Useful only with `pod` strategy. Disabled by 
default, you need to enable via
+BUILDER_TASKS_ENABLED=true environment variable on operator Deployment.
+
+Deprecated: may be removed in future versions.
 
 | builder.tasksRequestCPU
 | []string
@@ -164,4 +169,4 @@ NOTE: Operators can restrict which node-selector label keys 
CR authors are permi
 
 The `builder.tasks` trait option lets CR authors inject arbitrary containers 
into the build pipeline (only when using the `pod` build strategy). Each task 
entry has the format `<name>;<image>;<command>[;<userID>]`.
 
-NOTE: Operators can disable custom task injection entirely by setting 
`BUILDER_TASKS_ENABLED=false` on the operator deployment. When disabled, any 
`builder.tasks` values provided by CR authors are silently ignored and an info 
message is logged. The default is `true` (tasks are allowed). See build 
environment variables documentation for details.
+NOTE: Operators can enable custom task injection by setting 
`BUILDER_TASKS_ENABLED=true` on the operator deployment. When disabled, any 
`builder.tasks` values provided by CR authors are silently ignored and an info 
message is logged. The default is `false` (custom tasks are not allowed). See 
build environment variables documentation for details.
diff --git a/e2e/common/traits/builder_test.go 
b/e2e/common/traits/builder_test.go
index cd678d00f..3aa0fd621 100644
--- a/e2e/common/traits/builder_test.go
+++ b/e2e/common/traits/builder_test.go
@@ -152,75 +152,12 @@ func TestBuilderTrait(t *testing.T) {
                        g.Eventually(BuilderPod(t, ctx, 
integrationKitNamespace, 
builderKitName)().Spec.InitContainers[0].Resources.Limits.Memory().String(), 
TestTimeoutShort).Should(Equal("3Gi"))
                })
 
-               t.Run("Run custom pipeline task", func(t *testing.T) {
-                       name := RandomizedSuffixName("java-pipeline")
-                       g.Expect(KamelRun(t, ctx, ns, "files/Java.java", 
"--name", name,
-                               "-t", "builder.tasks=custom1;alpine;tree",
-                               "-t", "builder.tasks=custom2;alpine;cat 
maven/pom.xml",
-                               "-t", "builder.strategy=pod",
-                       ).Execute()).To(Succeed())
-
-                       g.Eventually(IntegrationPodPhase(t, ctx, ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
-                       g.Eventually(IntegrationConditionStatus(t, ctx, ns, 
name, v1.IntegrationConditionReady), 
TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
-                       g.Eventually(IntegrationLogs(t, ctx, ns, name), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
-
-                       integrationKitName := IntegrationKitName(t, ctx, ns, 
name)()
-                       integrationKitNamespace := IntegrationKitNamespace(t, 
ctx, ns, name)()
-                       builderKitName := fmt.Sprintf("camel-k-%s-builder", 
integrationKitName)
-                       g.Eventually(BuilderPod(t, ctx, 
integrationKitNamespace, builderKitName), TestTimeoutShort).ShouldNot(BeNil())
-                       g.Eventually(len(BuilderPod(t, ctx, 
integrationKitNamespace, builderKitName)().Spec.InitContainers), 
TestTimeoutShort).Should(Equal(4))
-                       g.Eventually(BuilderPod(t, ctx, 
integrationKitNamespace, builderKitName)().Spec.InitContainers[0].Name, 
TestTimeoutShort).Should(Equal("builder"))
-                       g.Eventually(BuilderPod(t, ctx, 
integrationKitNamespace, builderKitName)().Spec.InitContainers[1].Name, 
TestTimeoutShort).Should(Equal("custom1"))
-                       g.Eventually(BuilderPod(t, ctx, 
integrationKitNamespace, builderKitName)().Spec.InitContainers[2].Name, 
TestTimeoutShort).Should(Equal("custom2"))
-
-                       // Check containers conditions
-                       g.Eventually(Build(t, ctx, integrationKitNamespace, 
integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
-                       g.Eventually(
-                               Build(t, ctx, integrationKitNamespace, 
integrationKitName)().Status.GetCondition(v1.BuildConditionType("Containercustom1Succeeded")).Status,
-                               
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-                       g.Eventually(
-                               Build(t, ctx, integrationKitNamespace, 
integrationKitName)().Status.GetCondition(v1.BuildConditionType("Containercustom1Succeeded")).Message,
-                               
TestTimeoutShort).Should(ContainSubstring("generated-bytecode.jar"))
-                       g.Eventually(Build(t, ctx, integrationKitNamespace, 
integrationKitName), TestTimeoutShort).ShouldNot(BeNil())
-                       g.Eventually(
-                               Build(t, ctx, integrationKitNamespace, 
integrationKitName)().Status.GetCondition(v1.BuildConditionType("Containercustom2Succeeded")).Status,
-                               
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-                       g.Eventually(
-                               Build(t, ctx, integrationKitNamespace, 
integrationKitName)().Status.GetCondition(v1.BuildConditionType("Containercustom2Succeeded")).Message,
-                               
TestTimeoutShort).Should(ContainSubstring("</project>"))
-
-                       // Check logs
-                       g.Eventually(Logs(t, ctx, integrationKitNamespace, 
builderKitName, corev1.PodLogOptions{Container: 
"custom1"})).Should(ContainSubstring(`generated-bytecode.jar`))
-                       g.Eventually(Logs(t, ctx, integrationKitNamespace, 
builderKitName, corev1.PodLogOptions{Container: 
"custom2"})).Should(ContainSubstring(`<artifactId>camel-k-integration</artifactId>`))
-
-                       // Verify base image uses a digest for reproducible 
builds (see #5986)
-                       jibLogs := Logs(t, ctx, integrationKitNamespace, 
builderKitName, corev1.PodLogOptions{Container: "jib"})()
-                       g.Expect(jibLogs).ToNot(BeEmpty())
-                       g.Expect(jibLogs).ToNot(ContainSubstring("does not use 
a specific image digest"))
-               })
-
-               t.Run("Run custom pipeline task error", func(t *testing.T) {
-                       name := RandomizedSuffixName("java-error")
-                       g.Expect(KamelRun(t, ctx, ns, "files/Java.java", 
"--name", name, "-t", "builder.tasks=custom1;alpine;cat missingfile.txt", "-t", 
"builder.strategy=pod").Execute()).To(Succeed())
-
-                       g.Eventually(IntegrationPhase(t, ctx, ns, 
name)).Should(Equal(v1.IntegrationPhaseBuildingKit))
-                       integrationKitName := IntegrationKitName(t, ctx, ns, 
name)()
-                       integrationKitNamespace := IntegrationKitNamespace(t, 
ctx, ns, name)()
-                       // Check containers conditions
-                       g.Eventually(Build(t, ctx, integrationKitNamespace, 
integrationKitName), TestTimeoutLong).ShouldNot(BeNil())
-                       g.Eventually(BuildConditions(t, ctx, 
integrationKitNamespace, integrationKitName), 
TestTimeoutLong).ShouldNot(BeNil())
-                       g.Eventually(BuildCondition(t, ctx, 
integrationKitNamespace, integrationKitName, 
v1.BuildConditionType("Containercustom1Succeeded")), 
TestTimeoutMedium).ShouldNot(BeNil())
-                       g.Eventually(
-                               BuildCondition(t, ctx, integrationKitNamespace, 
integrationKitName, 
v1.BuildConditionType("Containercustom1Succeeded"))().Status,
-                               
TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
-                       g.Eventually(
-                               BuildCondition(t, ctx, integrationKitNamespace, 
integrationKitName, 
v1.BuildConditionType("Containercustom1Succeeded"))().Message,
-                               TestTimeoutShort).Should(ContainSubstring("No 
such file or directory"))
-               })
-
                t.Run("Run distroless container image", func(t *testing.T) {
                        name := RandomizedSuffixName("java")
-                       g.Expect(KamelRun(t, ctx, ns, "files/Java.java", 
"--name", name, "-t", 
"builder.base-image=gcr.io/distroless/java17-debian12").Execute()).To(Succeed())
+                       g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
+                               "--name", name,
+                               "-t", 
"builder.base-image=gcr.io/distroless/java17-debian12",
+                       ).Execute()).To(Succeed())
 
                        g.Eventually(IntegrationPodPhase(t, ctx, ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
                        g.Eventually(IntegrationConditionStatus(t, ctx, ns, 
name, v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
@@ -231,23 +168,3 @@ func TestBuilderTrait(t *testing.T) {
                })
        })
 }
-
-func TestCustomPipelineBuildah(t *testing.T) {
-       t.Parallel()
-       WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
-               t.Run("Run Buildah custom publish task", func(t *testing.T) {
-                       name := RandomizedSuffixName("java")
-                       g.Expect(KamelRun(t, ctx, ns, "files/Java.java",
-                               "--name", name,
-                               "-t", "builder.strategy=pod",
-                               "-t", 
"builder.base-image=docker.io/library/eclipse-temurin:17",
-                               "-t", 
`builder.tasks=my-buildah;quay.io/buildah/stable;/bin/bash -c \"cd context && 
buildah bud --storage-driver=vfs --tls-verify=false -t $(INTEGRATION_KIT_IMAGE) 
. && buildah push --storage-driver=vfs --digestfile=/dev/termination-log 
--tls-verify=false $(INTEGRATION_KIT_IMAGE) 
docker://$(INTEGRATION_KIT_IMAGE)";0`,
-                               "-t", 
"builder.tasks-filter=builder,package,my-buildah",
-                       ).Execute()).To(Succeed())
-
-                       g.Eventually(IntegrationConditionStatus(t, ctx, ns, 
name, v1.IntegrationConditionReady), 
TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
-                       g.Eventually(IntegrationPodPhase(t, ctx, ns, 
name)).Should(Equal(corev1.PodRunning))
-                       g.Eventually(IntegrationLogs(t, ctx, ns, 
name)).Should(ContainSubstring("Magicstring!"))
-               })
-       })
-}
diff --git a/e2e/native/native_test.go b/e2e/native/native_test.go
index ebc014fd5..2a67d1d1c 100644
--- a/e2e/native/native_test.go
+++ b/e2e/native/native_test.go
@@ -37,7 +37,11 @@ func TestNativeIntegrations(t *testing.T) {
        WithNewTestNamespace(t, func(ctx context.Context, g *WithT, ns string) {
                t.Run("xml native support", func(t *testing.T) {
                        name := RandomizedSuffixName("xml-native")
-                       g.Expect(KamelRun(t, ctx, ns, "files/Xml.xml", 
"--name", name, "-t", "quarkus.build-mode=native", "-t", 
"builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
+                       g.Expect(KamelRun(t, ctx, ns, "files/Xml.xml",
+                               "--name", name,
+                               "-t", "quarkus.build-mode=native",
+                               "-t", 
"builder.tasks-limit-memory=quarkus-native:6.5Gi",
+                       ).Execute()).To(Succeed())
 
                        g.Eventually(IntegrationPodPhase(t, ctx, ns, name), 
TestTimeoutVeryLong).Should(Equal(corev1.PodRunning))
                        g.Eventually(IntegrationPod(t, ctx, ns, name), 
TestTimeoutShort).
@@ -51,7 +55,11 @@ func TestNativeIntegrations(t *testing.T) {
 
                t.Run("automatic rollout deployment from jvm to native kit", 
func(t *testing.T) {
                        name := RandomizedSuffixName("yaml-native")
-                       g.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml", 
"--name", name, "-t", "quarkus.build-mode=jvm", "-t", 
"quarkus.build-mode=native", "-t", 
"builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
+                       g.Expect(KamelRun(t, ctx, ns, "files/yaml.yaml",
+                               "--name", name,
+                               "-t", "quarkus.build-mode=jvm",
+                               "-t", "quarkus.build-mode=native",
+                               "-t", 
"builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
 
                        // Check the fast-jar Kit is ready
                        g.Eventually(IntegrationKitLayout(t, ctx, ns, name), 
TestTimeoutShort).Should(Equal(v1.IntegrationKitLayoutFastJar))
@@ -79,7 +87,11 @@ func TestNativeIntegrations(t *testing.T) {
 
                        t.Run("yaml native should not rebuild", func(t 
*testing.T) {
                                name := RandomizedSuffixName("yaml-native-2")
-                               g.Expect(KamelRun(t, ctx, ns, 
"files/yaml2.yaml", "--name", name, "-t", "quarkus.build-mode=native", "-t", 
"builder.tasks-limit-memory=quarkus-native:6.5Gi").Execute()).To(Succeed())
+                               g.Expect(KamelRun(t, ctx, ns, 
"files/yaml2.yaml",
+                                       "--name", name,
+                                       "-t", "quarkus.build-mode=native",
+                                       "-t", 
"builder.tasks-limit-memory=quarkus-native:6.5Gi",
+                               ).Execute()).To(Succeed())
 
                                // This one should run quickly as it suppose to 
reuse an IntegrationKit
                                g.Eventually(IntegrationPodPhase(t, ctx, ns, 
name), TestTimeoutVeryLong).Should(Equal(corev1.PodRunning))
diff --git a/helm/camel-k/crds/camel-k-crds.yaml 
b/helm/camel-k/crds/camel-k-crds.yaml
index d7e4253e4..cfa3ce7d5 100644
--- a/helm/camel-k/crds/camel-k-crds.yaml
+++ b/helm/camel-k/crds/camel-k-crds.yaml
@@ -3021,8 +3021,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -3030,7 +3032,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -3977,8 +3982,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -3986,7 +3993,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -6508,8 +6518,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -6517,7 +6529,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -8933,8 +8948,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -8942,7 +8959,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -11344,8 +11364,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -11353,7 +11375,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -20611,8 +20636,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -20620,7 +20647,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -22983,8 +23013,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -22992,7 +23024,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -33611,8 +33646,10 @@ spec:
                             - routine
                             type: string
                           tasks:
-                            description: A list of tasks to be executed 
(available
-                              only when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                            description: |-
+                              A list of tasks to be executed (available only 
when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                              Deprecated: may be removed in future versions.
                             items:
                               type: string
                             type: array
@@ -33620,7 +33657,10 @@ spec:
                             description: |-
                               A list of tasks sorted by the order of execution 
in a csv format, ie, `<taskName1>,<taskName2>,...`.
                               Mind that you must include also the operator 
tasks (`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                              if you need to execute them. Useful only with 
`pod` strategy.
+                              if you need to execute them. Useful only with 
`pod` strategy. Disabled by default, you need to enable via
+                              BUILDER_TASKS_ENABLED=true environment variable 
on operator Deployment.
+
+                              Deprecated: may be removed in future versions.
                             type: string
                           tasksLimitCPU:
                             description: A list of limit cpu configuration for 
the
@@ -35907,8 +35947,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -35916,7 +35958,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
diff --git a/pkg/apis/camel/v1/trait/builder.go 
b/pkg/apis/camel/v1/trait/builder.go
index 9b771152a..1847e1718 100644
--- a/pkg/apis/camel/v1/trait/builder.go
+++ b/pkg/apis/camel/v1/trait/builder.go
@@ -67,10 +67,15 @@ type BuilderTrait struct {
        // Deprecated: will be removed in future versions.
        MavenProfiles []string `json:"mavenProfiles,omitempty" 
property:"maven-profiles"`
        // A list of tasks to be executed (available only when using `pod` 
strategy) with format `<name>;<container-image>;<container-command>`.
+       //
+       // Deprecated: may be removed in future versions.
        Tasks []string `json:"tasks,omitempty" property:"tasks"`
        // A list of tasks sorted by the order of execution in a csv format, 
ie, `<taskName1>,<taskName2>,...`.
        // Mind that you must include also the operator tasks (`builder`, 
`quarkus-native`, `package`, `jib`, `s2i`)
-       // if you need to execute them. Useful only with `pod` strategy.
+       // if you need to execute them. Useful only with `pod` strategy. 
Disabled by default, you need to enable via
+       // BUILDER_TASKS_ENABLED=true environment variable on operator 
Deployment.
+       //
+       // Deprecated: may be removed in future versions.
        TasksFilter string `json:"tasksFilter,omitempty" 
property:"tasks-filter"`
        // A list of request cpu configuration for the specific task with 
format `<task-name>:<request-cpu-conf>`.
        TasksRequestCPU []string `json:"tasksRequestCPU,omitempty" 
property:"tasks-request-cpu"`
diff --git a/pkg/platform/env_platform.go b/pkg/platform/env_platform.go
index 883e46e6a..24527ed31 100644
--- a/pkg/platform/env_platform.go
+++ b/pkg/platform/env_platform.go
@@ -199,7 +199,7 @@ func AffinityNodeLabelsAllowList() []string {
 // variable (default true for backward compatibility). Set to "false" to 
prevent custom task
 // injection across all integrations managed by this operator.
 func BuilderTasksEnabled() bool {
-       return 
strings.ToLower(strings.TrimSpace(GetEnvOrDefault("BUILDER_TASKS_ENABLED", 
"true"))) != "false"
+       return 
strings.ToLower(strings.TrimSpace(GetEnvOrDefault("BUILDER_TASKS_ENABLED", 
"false"))) == "true"
 }
 
 // BuilderNodeSelectorAllowList returns the list of node-selector keys that 
are allowed to be set
diff --git a/pkg/platform/env_platform_test.go 
b/pkg/platform/env_platform_test.go
index 476ff1ba3..797b7517c 100644
--- a/pkg/platform/env_platform_test.go
+++ b/pkg/platform/env_platform_test.go
@@ -195,8 +195,8 @@ func TestAffinityNodeLabelsAllowList_MultipleKeys(t 
*testing.T) {
 }
 
 func TestBuilderTasksEnabled_NotSet(t *testing.T) {
-       // env var not set – default is enabled
-       assert.True(t, BuilderTasksEnabled())
+       // env var not set – default is disabled
+       assert.False(t, BuilderTasksEnabled())
 }
 
 func TestBuilderTasksEnabled_True(t *testing.T) {
@@ -217,5 +217,5 @@ func TestBuilderTasksEnabled_FalseUpperCase(t *testing.T) {
 func TestBuilderTasksEnabled_Empty(t *testing.T) {
        t.Setenv("BUILDER_TASKS_ENABLED", "")
        // empty string is not "false" – treat as enabled
-       assert.True(t, BuilderTasksEnabled())
+       assert.False(t, BuilderTasksEnabled())
 }
diff --git 
a/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml
index a27762f95..c61ad17fb 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationkits.yaml
@@ -313,8 +313,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -322,7 +324,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
diff --git 
a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 953987bc4..d1ca15e63 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -676,8 +676,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -685,7 +687,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -3207,8 +3212,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -3216,7 +3223,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
diff --git 
a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
index 3a445c948..70358adb0 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrationprofiles.yaml
@@ -534,8 +534,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -543,7 +545,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -2945,8 +2950,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -2954,7 +2961,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
index c8efb8168..b28553df1 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_integrations.yaml
@@ -7379,8 +7379,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -7388,7 +7390,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
@@ -9751,8 +9756,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -9760,7 +9767,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
diff --git a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml 
b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
index 2b094b431..035b9133a 100644
--- a/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
+++ b/pkg/resources/config/crd/bases/camel.apache.org_pipes.yaml
@@ -7432,8 +7432,10 @@ spec:
                             - routine
                             type: string
                           tasks:
-                            description: A list of tasks to be executed 
(available
-                              only when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                            description: |-
+                              A list of tasks to be executed (available only 
when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                              Deprecated: may be removed in future versions.
                             items:
                               type: string
                             type: array
@@ -7441,7 +7443,10 @@ spec:
                             description: |-
                               A list of tasks sorted by the order of execution 
in a csv format, ie, `<taskName1>,<taskName2>,...`.
                               Mind that you must include also the operator 
tasks (`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                              if you need to execute them. Useful only with 
`pod` strategy.
+                              if you need to execute them. Useful only with 
`pod` strategy. Disabled by default, you need to enable via
+                              BUILDER_TASKS_ENABLED=true environment variable 
on operator Deployment.
+
+                              Deprecated: may be removed in future versions.
                             type: string
                           tasksLimitCPU:
                             description: A list of limit cpu configuration for 
the
@@ -9728,8 +9733,10 @@ spec:
                         - routine
                         type: string
                       tasks:
-                        description: A list of tasks to be executed (available 
only
-                          when using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+                        description: |-
+                          A list of tasks to be executed (available only when 
using `pod` strategy) with format 
`<name>;<container-image>;<container-command>`.
+
+                          Deprecated: may be removed in future versions.
                         items:
                           type: string
                         type: array
@@ -9737,7 +9744,10 @@ spec:
                         description: |-
                           A list of tasks sorted by the order of execution in 
a csv format, ie, `<taskName1>,<taskName2>,...`.
                           Mind that you must include also the operator tasks 
(`builder`, `quarkus-native`, `package`, `jib`, `s2i`)
-                          if you need to execute them. Useful only with `pod` 
strategy.
+                          if you need to execute them. Useful only with `pod` 
strategy. Disabled by default, you need to enable via
+                          BUILDER_TASKS_ENABLED=true environment variable on 
operator Deployment.
+
+                          Deprecated: may be removed in future versions.
                         type: string
                       tasksLimitCPU:
                         description: A list of limit cpu configuration for the 
specific
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index 1d90b16a6..4f4f43df1 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -42,6 +42,8 @@ import (
 const (
        builderTraitID    = "builder"
        builderTraitOrder = 600
+
+       quarkusNativeTaskName = "quarkus-native"
 )
 
 var commandsRegexp = regexp.MustCompile(`"[^"]+"|[\w/-]+`)
@@ -49,6 +51,9 @@ var commandsRegexp = regexp.MustCompile(`"[^"]+"|[\w/-]+`)
 type builderTrait struct {
        BasePlatformTrait
        traitv1.BuilderTrait `property:",squash"`
+
+       // no task when empty
+       quarkusNativeTask string
 }
 
 func newBuilderTrait() Trait {
@@ -62,6 +67,7 @@ func (t *builderTrait) InfluencesKit() bool {
        return true
 }
 
+//nolint:staticcheck
 func (t *builderTrait) Matches(trait Trait) bool {
        otherTrait, ok := trait.(*builderTrait)
        if !ok {
@@ -135,22 +141,22 @@ func (t *builderTrait) configureForQuarkus(trait Trait, e 
*Environment, conditio
                        nativeBuilderImage = 
strings.ReplaceAll(nativeBuilderImage, "jdk-21", "jdk-25")
                }
 
-               // it should be performed as the last custom task
-               t.Tasks = append(t.Tasks, 
fmt.Sprintf(`quarkus-native;%s;/bin/bash -c "%s"`, nativeBuilderImage, command))
                // Force the build to run in a separate Pod and strictly 
sequential
-               m := "This is a Quarkus native build: setting build 
configuration with build Pod strategy and native container sensible resources 
(if not specified by the user). Make sure your cluster can handle it."
+               m := "This is a Quarkus native build: setting build 
configuration with build Pod strategy and native container sensible resources " 
+
+                       "(if not specified by the user). Make sure your cluster 
can handle it."
                t.L.Info(m)
-
                condition = newOrAppend(condition, m)
                t.Strategy = string(v1.BuildStrategyPod)
                t.OrderStrategy = string(v1.BuildOrderStrategySequential)
 
-               if !existsTaskRequest(t.TasksRequestCPU, "quarkus-native") {
-                       t.TasksRequestCPU = append(t.TasksRequestCPU, 
"quarkus-native:1000m")
+               if !existsTaskRequest(t.TasksRequestCPU, quarkusNativeTaskName) 
{
+                       t.TasksRequestCPU = append(t.TasksRequestCPU, 
quarkusNativeTaskName+":1000m")
                }
-               if !existsTaskRequest(t.TasksRequestMemory, "quarkus-native") {
-                       t.TasksRequestMemory = append(t.TasksRequestMemory, 
"quarkus-native:4Gi")
+               if !existsTaskRequest(t.TasksRequestMemory, 
quarkusNativeTaskName) {
+                       t.TasksRequestMemory = append(t.TasksRequestMemory, 
quarkusNativeTaskName+":4Gi")
                }
+
+               t.quarkusNativeTask = fmt.Sprintf(`%s;%s;/bin/bash -c "%s"`, 
quarkusNativeTaskName, nativeBuilderImage, command)
        }
 
        return condition, nil
@@ -245,16 +251,29 @@ func (t *builderTrait) Apply(e *Environment) error {
        pipelineTasks = append(pipelineTasks, v1.Task{Builder: builderTask})
 
        // Custom tasks
-       t.applyTasksFilter()
-       if len(t.Tasks) > 0 {
-               ct, err := t.determineCustomTasks(e, builderTask, tasksConf)
+       //nolint:staticcheck,nestif
+       if platform.BuilderTasksEnabled() {
+               if len(t.Tasks) > 0 {
+                       ct, err := t.determineCustomTasks(e, builderTask, 
tasksConf)
+                       if err != nil {
+                               return err
+                       }
+                       if ct == nil {
+                               return nil
+                       }
+                       pipelineTasks = append(pipelineTasks, ct...)
+               }
+       } else {
+               t.L.Info("Custom tasks are disabled by operator configuration: 
the tasks will be ignored")
+               // Useful to report in status no custom task was executed
+               t.Tasks = []string{}
+       }
+       if t.quarkusNativeTask != "" {
+               quarkusNativeTask, err := parseTask(t.quarkusNativeTask, 
tasksConf, imageName)
                if err != nil {
                        return err
                }
-               if ct == nil {
-                       return nil
-               }
-               pipelineTasks = append(pipelineTasks, ct...)
+               pipelineTasks = append(pipelineTasks, *quarkusNativeTask)
        }
 
        // Packaging task
@@ -300,6 +319,7 @@ func (t *builderTrait) Apply(e *Environment) error {
        }
 
        // filter only those tasks required by the user
+       //nolint:staticcheck
        if t.TasksFilter != "" {
                flt := strings.Split(t.TasksFilter, ",")
                if pipelineTasks, err = filter(pipelineTasks, flt); err != nil {
@@ -516,6 +536,7 @@ func (t *builderTrait) determineCustomTasks(e *Environment, 
builderTask *v1.Buil
                realBuildStrategy = e.Platform.BuildConfiguration.Strategy
        }
 
+       //nolint:staticcheck
        if len(t.Tasks) > 0 && realBuildStrategy != v1.BuildStrategyPod {
                err := failIntegrationKit(
                        e,
@@ -538,37 +559,50 @@ func (t *builderTrait) determineCustomTasks(e 
*Environment, builderTask *v1.Buil
 }
 
 // the format expected is 
"<task-name>;<task-image>;<task-container-command>[;<task-container-user-id>]".
+//
+// Deprecated: will be removed in future versions.
 func (t *builderTrait) customTasks(tasksConf 
map[string]*v1.BuildConfiguration, imageName string) ([]v1.Task, error) {
        customTasks := make([]v1.Task, len(t.Tasks))
 
        for i, t := range t.Tasks {
-               splitted := strings.Split(t, ";")
-               if len(splitted) < 3 {
-                       return nil, fmt.Errorf(`provide a custom task with at 
least 3 arguments, ie "my-task-name;my-image;echo 'hello'", was %v`, t)
-               }
-               customTasks[i] = v1.Task{
-                       Custom: &v1.UserTask{
-                               BaseTask: v1.BaseTask{
-                                       Name:          splitted[0],
-                                       Configuration: 
*taskConfOrDefault(tasksConf, splitted[0]),
-                               },
-                               PublishingImage:   imageName,
-                               ContainerImage:    splitted[1],
-                               ContainerCommands: 
splitContainerCommand(splitted[2]),
-                       },
-               }
-               if len(splitted) > 3 {
-                       uid, err := strconv.ParseInt(splitted[3], 10, 64)
-                       if err != nil {
-                               return nil, fmt.Errorf(`provide a custom task 
with a correct numeric user id, was %v`, splitted[3])
-                       }
-                       customTasks[i].Custom.ContainerUserID = &uid
+               parsedTask, err := parseTask(t, tasksConf, imageName)
+               if err != nil {
+                       return nil, err
                }
+
+               customTasks[i] = *parsedTask
        }
 
        return customTasks, nil
 }
 
+func parseTask(task string, tasksConf map[string]*v1.BuildConfiguration, 
imageName string) (*v1.Task, error) {
+       splitted := strings.Split(task, ";")
+       if len(splitted) < 3 {
+               return nil, fmt.Errorf(`provide a custom task with at least 3 
arguments, ie "my-task-name;my-image;echo 'hello'", was %v`, task)
+       }
+       parsedTask := v1.Task{
+               Custom: &v1.UserTask{
+                       BaseTask: v1.BaseTask{
+                               Name:          splitted[0],
+                               Configuration: *taskConfOrDefault(tasksConf, 
splitted[0]),
+                       },
+                       PublishingImage:   imageName,
+                       ContainerImage:    splitted[1],
+                       ContainerCommands: splitContainerCommand(splitted[2]),
+               },
+       }
+       if len(splitted) > 3 {
+               uid, err := strconv.ParseInt(splitted[3], 10, 64)
+               if err != nil {
+                       return nil, fmt.Errorf(`provide a custom task with a 
correct numeric user id, was %v`, splitted[3])
+               }
+               parsedTask.Custom.ContainerUserID = &uid
+       }
+
+       return &parsedTask, nil
+}
+
 func taskConfOrDefault(tasksConf map[string]*v1.BuildConfiguration, taskName 
string) *v1.BuildConfiguration {
        if tasksConf == nil || tasksConf[taskName] == nil {
                return &v1.BuildConfiguration{}
@@ -715,24 +749,6 @@ func (t *builderTrait) setPlatform(e *Environment) {
 // filterNodeSelector returns the node selector map after applying the 
operator-level allow list.
 // If BUILDER_NODE_SELECTOR_ALLOWED_LABELS is empty/unset all keys are 
accepted (backward compatible).
 // Otherwise only keys present in the allow list are retained; every dropped 
key is logged at info level.
-// applyTasksFilter removes user-provided tasks when 
BUILDER_TASKS_ENABLED=false.
-// The quarkus-native task is operator-injected and is always retained.
-func (t *builderTrait) applyTasksFilter() {
-       if len(t.Tasks) == 0 || platform.BuilderTasksEnabled() {
-               return
-       }
-       kept := make([]string, 0, len(t.Tasks))
-       for _, task := range t.Tasks {
-               name, _, _ := strings.Cut(task, ";")
-               if name == "quarkus-native" {
-                       kept = append(kept, task)
-               } else {
-                       t.L.Info("builder.tasks is disabled by operator 
configuration and will be ignored", "task", name)
-               }
-       }
-       t.Tasks = kept
-}
-
 func (t *builderTrait) filterNodeSelector() map[string]string {
        if len(t.NodeSelector) == 0 {
                return t.NodeSelector
diff --git a/pkg/trait/builder_test.go b/pkg/trait/builder_test.go
index c723b146f..84689058f 100644
--- a/pkg/trait/builder_test.go
+++ b/pkg/trait/builder_test.go
@@ -146,6 +146,7 @@ func createNominalBuilderTraitTest() *builderTrait {
 }
 
 func TestCustomTaskBuilderTrait(t *testing.T) {
+       t.Setenv("BUILDER_TASKS_ENABLED", "true")
        env := createBuilderTestEnv(v1.BuildStrategyPod)
        builderTrait := createNominalBuilderTraitTest()
        builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine;ls")
@@ -169,6 +170,7 @@ func TestCustomTaskBuilderTrait(t *testing.T) {
 }
 
 func TestCustomTaskBuilderTraitValidStrategyOverride(t *testing.T) {
+       t.Setenv("BUILDER_TASKS_ENABLED", "true")
        env := createBuilderTestEnv(platform.DefaultBuildStrategy)
        builderTrait := createNominalBuilderTraitTest()
        builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine;ls")
@@ -187,6 +189,7 @@ func TestCustomTaskBuilderTraitValidStrategyOverride(t 
*testing.T) {
 }
 
 func TestCustomTaskBuilderTraitInvalidStrategy(t *testing.T) {
+       t.Setenv("BUILDER_TASKS_ENABLED", "true")
        env := createBuilderTestEnv(v1.BuildStrategyRoutine)
        builderTrait := createNominalBuilderTraitTest()
        builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine;ls")
@@ -203,6 +206,7 @@ func TestCustomTaskBuilderTraitInvalidStrategy(t 
*testing.T) {
 }
 
 func TestCustomTaskBuilderTraitInvalidStrategyOverride(t *testing.T) {
+       t.Setenv("BUILDER_TASKS_ENABLED", "true")
        env := createBuilderTestEnv(v1.BuildStrategyPod)
        builderTrait := createNominalBuilderTraitTest()
        builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine;ls")
@@ -520,6 +524,7 @@ func TestBuilderTasksFilterAndReorderOperatorTasks(t 
*testing.T) {
 }
 
 func TestBuilderTasksFilterAndReorderCustomTasks(t *testing.T) {
+       t.Setenv("BUILDER_TASKS_ENABLED", "true")
        env := createBuilderTestEnv(v1.BuildStrategyPod)
        builderTrait := createNominalBuilderTraitTest()
        builderTrait.Tasks = append(builderTrait.Tasks, 
`my-custom-publish;alpine;mvn test`)
@@ -778,8 +783,8 @@ func TestBuilderTraitTasksDisabledKeepsQuarkusNative(t 
*testing.T) {
 
        env := createBuilderTestEnv(v1.BuildStrategyPod)
        bt := createNominalBuilderTraitTest()
+       bt.quarkusNativeTask = "quarkus-native;quarkus-image;/bin/bash -c 
\"build native\""
        bt.Tasks = []string{
-               "quarkus-native;quarkus-image;/bin/bash -c \"build native\"",
                "user-task;alpine;echo hello",
        }
 
@@ -796,8 +801,7 @@ func TestBuilderTraitTasksDisabledKeepsQuarkusNative(t 
*testing.T) {
        assert.NotContains(t, customNames, "user-task", "user task must be 
dropped when builder.tasks is disabled")
 }
 
-// TestBuilderTraitTasksEnabledByDefault verifies that when 
BUILDER_TASKS_ENABLED is unset
-// custom tasks flow through normally.
+// TestBuilderTraitTasksEnabledByDefault verifies that when 
BUILDER_TASKS_ENABLED is unset.
 func TestBuilderTraitTasksEnabledByDefault(t *testing.T) {
        env := createBuilderTestEnv(v1.BuildStrategyPod)
        bt := createNominalBuilderTraitTest()
@@ -813,5 +817,5 @@ func TestBuilderTraitTasksEnabledByDefault(t *testing.T) {
                        break
                }
        }
-       assert.True(t, found, "custom task must be present when builder.tasks 
is enabled")
+       assert.False(t, found, "custom task must not be present when 
builder.tasks is disabled (default)")
 }

Reply via email to