You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/10/04 10:52:59 UTC
[camel-k] 01/09: feat: Quarkus native source
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 4de6cc3f6cc6a4726c5023cbfb7574d1d90cdec1
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri Sep 22 14:39:25 2023 +0200
feat: Quarkus native source
* Move the previous logic to native-source package type
* A new task takes care to trigger a pipeline task to run Native Image
* Split the builder task into 2 tasks
- builder takes care of the building part (mvn package)
- package task does the packaging (after custom tasks)
Ref #4648
---
config/crd/bases/camel.apache.org_builds.yaml | 513 ++++++++++++++++++++-
.../bases/camel.apache.org_integrationkits.yaml | 22 +-
.../camel.apache.org_integrationplatforms.yaml | 44 +-
.../crd/bases/camel.apache.org_integrations.yaml | 22 +-
.../bases/camel.apache.org_kameletbindings.yaml | 23 +-
config/crd/bases/camel.apache.org_pipes.yaml | 23 +-
.../pages/installation/advanced/build-config.adoc | 2 +-
docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 46 +-
docs/modules/traits/pages/quarkus.adoc | 12 +-
helm/camel-k/crds/crd-build.yaml | 513 ++++++++++++++++++++-
helm/camel-k/crds/crd-integration-kit.yaml | 22 +-
helm/camel-k/crds/crd-integration-platform.yaml | 44 +-
helm/camel-k/crds/crd-integration.yaml | 22 +-
helm/camel-k/crds/crd-kamelet-binding.yaml | 23 +-
helm/camel-k/crds/crd-pipe.yaml | 23 +-
pkg/apis/camel/v1/build_types.go | 16 +-
pkg/apis/camel/v1/trait/quarkus.go | 23 +-
pkg/apis/camel/v1/zz_generated.deepcopy.go | 20 +-
pkg/builder/builder.go | 17 +-
pkg/builder/image.go | 3 +-
pkg/builder/spectrum.go | 2 +
pkg/builder/tasks.go | 30 ++
.../camel/applyconfiguration/camel/v1/task.go | 27 +-
.../camel/applyconfiguration/camel/v1/usertask.go | 15 +-
pkg/controller/build/build_pod.go | 13 +-
pkg/controller/build/monitor_routine.go | 33 +-
pkg/resources/resources.go | 28 +-
pkg/trait/builder.go | 70 ++-
pkg/trait/builder_test.go | 91 +++-
pkg/trait/quarkus.go | 67 +--
pkg/trait/quarkus_test.go | 8 +-
pkg/trait/util.go | 9 +
resources/traits.yaml | 21 +-
33 files changed, 1566 insertions(+), 281 deletions(-)
diff --git a/config/crd/bases/camel.apache.org_builds.yaml b/config/crd/bases/camel.apache.org_builds.yaml
index 9efe73a2d..0ff027d69 100644
--- a/config/crd/bases/camel.apache.org_builds.yaml
+++ b/config/crd/bases/camel.apache.org_builds.yaml
@@ -189,8 +189,7 @@ spec:
type: boolean
type: object
builder:
- description: a BuilderTask, used to generate and package the
- project
+ description: a BuilderTask, used to generate and build the project
properties:
baseImage:
description: the base image layer
@@ -688,12 +687,17 @@ spec:
type: array
type: object
custom:
- description: UserTask is used to execute any generic custom
- operation.
+ description: User customizable task execution. These are executed
+ after the build and before the package task.
properties:
command:
- description: the command to execute
+ description: 'the command to execute Deprecated: use ContainerCommands'
type: string
+ commands:
+ description: the command to execute
+ items:
+ type: string
+ type: array
image:
description: the container image to use
type: string
@@ -792,6 +796,505 @@ spec:
description: log more information
type: boolean
type: object
+ package:
+ description: Application pre publishing a PackageTask, used
+ to package the project
+ properties:
+ baseImage:
+ description: the base image layer
+ type: string
+ buildDir:
+ description: workspace directory to use
+ type: string
+ configuration:
+ description: The configuration that should be used to perform
+ the Build.
+ properties:
+ limitCPU:
+ description: The maximum amount of CPU required. Only
+ used for `pod` strategy
+ type: string
+ limitMemory:
+ description: The maximum amount of memory required.
+ Only used for `pod` strategy
+ type: string
+ operatorNamespace:
+ description: The namespace where to run the builder
+ Pod (must be the same of the operator in charge of
+ this Build reconciliation).
+ type: string
+ orderStrategy:
+ description: the build order strategy to adopt
+ enum:
+ - dependencies
+ - fifo
+ - sequential
+ type: string
+ requestCPU:
+ description: The minimum amount of CPU required. Only
+ used for `pod` strategy
+ type: string
+ requestMemory:
+ description: The minimum amount of memory required.
+ Only used for `pod` strategy
+ type: string
+ strategy:
+ description: the strategy to adopt
+ enum:
+ - routine
+ - pod
+ type: string
+ toolImage:
+ description: The container image to be used to run the
+ build.
+ type: string
+ type: object
+ dependencies:
+ description: the list of dependencies to use for this build
+ items:
+ type: string
+ type: array
+ maven:
+ description: the configuration required by Maven for the
+ application build phase
+ properties:
+ caSecrets:
+ description: The Secrets name and key, containing the
+ CA certificate(s) used to connect to remote Maven
+ repositories. It can contain X.509 certificates, and
+ PKCS#7 formatted certificate chains. A JKS formatted
+ keystore is automatically created to store the CA
+ certificate(s), and configured to be used as a trusted
+ certificate(s) by the Maven commands. Note that the
+ root CA certificates are also imported into the created
+ keystore.
+ items:
+ description: SecretKeySelector selects a key of a
+ Secret.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion, kind,
+ uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: array
+ cliOptions:
+ description: The CLI options that are appended to the
+ list of arguments for Maven commands, e.g., `-V,--no-transfer-progress,-Dstyle.color=never`.
+ See https://maven.apache.org/ref/3.8.4/maven-embedder/cli.html.
+ items:
+ type: string
+ type: array
+ extension:
+ description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html.
+ items:
+ description: MavenArtifact defines a GAV (Group:Artifact:Version)
+ Maven artifact.
+ properties:
+ artifactId:
+ description: Maven Artifact
+ type: string
+ groupId:
+ description: Maven Group
+ type: string
+ version:
+ description: Maven Version
+ type: string
+ required:
+ - artifactId
+ - groupId
+ type: object
+ type: array
+ localRepository:
+ description: The path of the local Maven repository.
+ type: string
+ profiles:
+ description: A reference to the ConfigMap or Secret
+ key that contains the Maven profile.
+ items:
+ description: ValueSource --.
+ properties:
+ configMapKeyRef:
+ description: Selects a key of a ConfigMap.
+ properties:
+ key:
+ description: The key to select.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the ConfigMap
+ or its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ secretKeyRef:
+ description: Selects a key of a secret.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: object
+ type: array
+ properties:
+ additionalProperties:
+ type: string
+ description: The Maven properties.
+ type: object
+ repositories:
+ description: additional repositories
+ items:
+ description: Repository defines a Maven repository.
+ properties:
+ id:
+ description: identifies the repository
+ type: string
+ name:
+ description: name of the repository
+ type: string
+ releases:
+ description: can use stable releases
+ properties:
+ checksumPolicy:
+ description: When Maven deploys files to the
+ repository, it also deploys corresponding
+ checksum files. Your options are to `ignore`,
+ `fail`, or `warn` on missing or incorrect
+ checksums.
+ type: string
+ enabled:
+ description: is the policy activated or not
+ type: boolean
+ updatePolicy:
+ description: 'This element specifies how often
+ updates should attempt to occur. Maven will
+ compare the local POM''s timestamp (stored
+ in a repository''s maven-metadata file)
+ to the remote. The choices are: `always`,
+ `daily` (default), `interval:X` (where X
+ is an integer in minutes) or `never`'
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: can use snapshot
+ properties:
+ checksumPolicy:
+ description: When Maven deploys files to the
+ repository, it also deploys corresponding
+ checksum files. Your options are to `ignore`,
+ `fail`, or `warn` on missing or incorrect
+ checksums.
+ type: string
+ enabled:
+ description: is the policy activated or not
+ type: boolean
+ updatePolicy:
+ description: 'This element specifies how often
+ updates should attempt to occur. Maven will
+ compare the local POM''s timestamp (stored
+ in a repository''s maven-metadata file)
+ to the remote. The choices are: `always`,
+ `daily` (default), `interval:X` (where X
+ is an integer in minutes) or `never`'
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ description: location of the repository
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
+ servers:
+ description: Servers (auth)
+ items:
+ description: Server see link:https://maven.apache.org/settings.html[Maven
+ settings].
+ properties:
+ configuration:
+ additionalProperties:
+ type: string
+ description: Properties -- .
+ type: object
+ id:
+ type: string
+ password:
+ type: string
+ username:
+ type: string
+ type: object
+ type: array
+ settings:
+ description: A reference to the ConfigMap or Secret
+ key that contains the Maven settings.
+ properties:
+ configMapKeyRef:
+ description: Selects a key of a ConfigMap.
+ properties:
+ key:
+ description: The key to select.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the ConfigMap or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ secretKeyRef:
+ description: Selects a key of a secret.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: object
+ settingsSecurity:
+ description: A reference to the ConfigMap or Secret
+ key that contains the security of the Maven settings.
+ properties:
+ configMapKeyRef:
+ description: Selects a key of a ConfigMap.
+ properties:
+ key:
+ description: The key to select.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the ConfigMap or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ secretKeyRef:
+ description: Selects a key of a secret.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: object
+ type: object
+ name:
+ description: name of the task
+ type: string
+ runtime:
+ description: the configuration required for the runtime
+ application
+ properties:
+ applicationClass:
+ description: application entry point (main) to be executed
+ type: string
+ capabilities:
+ additionalProperties:
+ description: Capability is a particular feature which
+ requires a well known set of dependencies which
+ are specified in the runtime catalog.
+ properties:
+ dependencies:
+ items:
+ description: MavenArtifact defines a GAV (Group:Artifact:Version)
+ Maven artifact.
+ properties:
+ artifactId:
+ description: Maven Artifact
+ type: string
+ groupId:
+ description: Maven Group
+ type: string
+ version:
+ description: Maven Version
+ type: string
+ required:
+ - artifactId
+ - groupId
+ type: object
+ type: array
+ required:
+ - dependencies
+ type: object
+ description: features offered by this runtime
+ type: object
+ dependencies:
+ description: list of dependencies needed to run the
+ application
+ items:
+ description: MavenArtifact defines a GAV (Group:Artifact:Version)
+ Maven artifact.
+ properties:
+ artifactId:
+ description: Maven Artifact
+ type: string
+ groupId:
+ description: Maven Group
+ type: string
+ version:
+ description: Maven Version
+ type: string
+ required:
+ - artifactId
+ - groupId
+ type: object
+ type: array
+ metadata:
+ additionalProperties:
+ type: string
+ description: set of metadata
+ type: object
+ provider:
+ description: Camel main application provider, ie, Camel
+ Quarkus
+ type: string
+ version:
+ description: Camel K Runtime version
+ type: string
+ required:
+ - applicationClass
+ - dependencies
+ - provider
+ - version
+ type: object
+ sources:
+ description: the sources to add at build time
+ items:
+ description: SourceSpec defines the configuration for
+ one or more routes to be executed in a certain Camel
+ DSL language.
+ properties:
+ compression:
+ description: if the content is compressed (base64
+ encrypted)
+ type: boolean
+ content:
+ description: the source code (plain text)
+ type: string
+ contentKey:
+ description: the confimap key holding the source content
+ type: string
+ contentRef:
+ description: the confimap reference holding the source
+ content
+ type: string
+ contentType:
+ description: the content type (tipically text or binary)
+ type: string
+ interceptors:
+ description: Interceptors are optional identifiers
+ the org.apache.camel.k.RoutesLoader uses to pre/post
+ process sources
+ items:
+ type: string
+ type: array
+ language:
+ description: specify which is the language (Camel
+ DSL) used to interpret this source code
+ type: string
+ loader:
+ description: Loader is an optional id of the org.apache.camel.k.RoutesLoader
+ that will interpret this source at runtime
+ type: string
+ name:
+ description: the name of the specification
+ type: string
+ path:
+ description: the path where the file is stored
+ type: string
+ property-names:
+ description: List of property names defined in the
+ source (e.g. if type is "template")
+ items:
+ type: string
+ type: array
+ rawContent:
+ description: the source code (binary)
+ format: byte
+ type: string
+ type:
+ description: Type defines the kind of source described
+ by this object
+ type: string
+ type: object
+ type: array
+ steps:
+ description: the list of steps to execute (see pkg/builder/)
+ items:
+ type: string
+ type: array
+ type: object
s2i:
description: a S2iTask, for S2I strategy
properties:
diff --git a/config/crd/bases/camel.apache.org_integrationkits.yaml b/config/crd/bases/camel.apache.org_integrationkits.yaml
index f70954ab5..ea68807a3 100644
--- a/config/crd/bases/camel.apache.org_integrationkits.yaml
+++ b/config/crd/bases/camel.apache.org_integrationkits.yaml
@@ -300,19 +300,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index f65b8207a..a37e7c91d 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -1589,19 +1589,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
@@ -3361,19 +3363,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml b/config/crd/bases/camel.apache.org_integrations.yaml
index 7a41808ee..042186be4 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases/camel.apache.org_integrations.yaml
@@ -7506,19 +7506,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/config/crd/bases/camel.apache.org_kameletbindings.yaml b/config/crd/bases/camel.apache.org_kameletbindings.yaml
index d3c4b9a6f..1181e466b 100644
--- a/config/crd/bases/camel.apache.org_kameletbindings.yaml
+++ b/config/crd/bases/camel.apache.org_kameletbindings.yaml
@@ -7801,19 +7801,22 @@ spec:
All traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence
- over the `fast-jar` one once ready. The order influences
- the resolution of the current kit for the integration.
- The kit corresponding to the first package type will
- be assigned to the integration in case no existing kit
- that matches the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution
+ of the current kit for the integration. The kit corresponding
+ to the first package type will be assigned to the integration
+ in case no existing kit that matches the integration
+ exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus
+ build packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/config/crd/bases/camel.apache.org_pipes.yaml b/config/crd/bases/camel.apache.org_pipes.yaml
index 33fb3e7d1..d6b5e1269 100644
--- a/config/crd/bases/camel.apache.org_pipes.yaml
+++ b/config/crd/bases/camel.apache.org_pipes.yaml
@@ -7798,19 +7798,22 @@ spec:
All traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence
- over the `fast-jar` one once ready. The order influences
- the resolution of the current kit for the integration.
- The kit corresponding to the first package type will
- be assigned to the integration in case no existing kit
- that matches the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution
+ of the current kit for the integration. The kit corresponding
+ to the first package type will be assigned to the integration
+ in case no existing kit that matches the integration
+ exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus
+ build packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/docs/modules/ROOT/pages/installation/advanced/build-config.adoc b/docs/modules/ROOT/pages/installation/advanced/build-config.adoc
index 0a16301fa..6c6b6d4a6 100644
--- a/docs/modules/ROOT/pages/installation/advanced/build-config.adoc
+++ b/docs/modules/ROOT/pages/installation/advanced/build-config.adoc
@@ -15,7 +15,7 @@ NOTE: the `pod` strategy was also required when using the now deprecated Buildah
Beside the build strategy, there are other configuration you can fine tune for each single build (via builder trait) or in the `.spec.build.buildConfiguration` of the IntegrationPlatform if you want to apply such configuration to all your builds. See the Builder trait page for more information.
-The most relevant are the `resource` and `limit` parameters which can be used to control how much resources to give to builder Pods. Then you can configure the `orderStrategy`, setting a `sequential` (single build), `fifo` (parallel build started in FIFO order) or `dependencies` (parallel build holding those applications which may depends on other because of ** xref:architecture/incremental-image.adoc[incremental image]). Finally you can include any `mavenProfile` to the build in order t [...]
+The most relevant are the `resource` and `limit` parameters which can be used to control how much resources to give to builder Pods. Then you can configure the `orderStrategy`, setting a `sequential` (single build), `fifo` (parallel build started in FIFO order) or `dependencies` (parallel build holding those applications which may depends on other because of xref:architecture/incremental-image.adoc[incremental image]). Finally you can include any `mavenProfile` to the build in order to i [...]
[[publish-strategy]]
== Publish strategy
diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index cfc0f06b2..3afd80dd3 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -5152,7 +5152,22 @@ Task represents the abstract task. Only one of the task should be configured to
|
-a BuilderTask, used to generate and package the project
+a BuilderTask, used to generate and build the project
+
+|`custom` +
+*xref:#_camel_apache_org_v1_UserTask[UserTask]*
+|
+
+
+User customizable task execution. These are executed after the build and before the package task.
+
+|`package` +
+*xref:#_camel_apache_org_v1_BuilderTask[BuilderTask]*
+|
+
+
+Application pre publishing
+a PackageTask, used to package the project
|`buildah` +
*xref:#_camel_apache_org_v1_BuildahTask[BuildahTask]*
@@ -5191,13 +5206,6 @@ a S2iTask, for S2I strategy
a JibTask, for Jib strategy
-|`custom` +
-*xref:#_camel_apache_org_v1_UserTask[UserTask]*
-|
-
-
-
-
|===
@@ -5625,6 +5633,14 @@ string
|
+the command to execute
+Deprecated: use ContainerCommands
+
+|`commands` +
+[]string
+|
+
+
the command to execute
@@ -7537,7 +7553,7 @@ Automatically configures the platform registry secret on the pod if it is of typ
* <<#_camel_apache_org_v1_trait_QuarkusTrait, QuarkusTrait>>
-Quarkus package type.
+QuarkusPackageType is the type of Quarkus build packaging.
[#_camel_apache_org_v1_trait_QuarkusTrait]
@@ -7552,9 +7568,9 @@ The Quarkus trait configures the Quarkus runtime.
It's enabled by default.
-NOTE: Compiling to a native executable, i.e. when using `package-type=native`, requires at least
-4GiB of memory, so the Pod running the native build, that is either the operator Pod, or the build
-Pod (depending on the build strategy configured for the platform), must have enough memory available.
+NOTE: A native based compilation will be forced to use a `pod` build strategy.
+Compiling to a native executable, i.e. when using `package-type=native`, requires at least
+4GiB of memory, so the Pod running the native build, must have enough memory available.
[cols="2,2a",options="header"]
@@ -7574,9 +7590,9 @@ Pod (depending on the build strategy configured for the platform), must have eno
|
-The Quarkus package types, either `fast-jar` or `native` (default `fast-jar`).
-In case both `fast-jar` and `native` are specified, two `IntegrationKit` resources are created,
-with the `native` kit having precedence over the `fast-jar` one once ready.
+The Quarkus package types, `fast-jar`, `native-sources` or `native` (default `fast-jar`). `native` is deprecated.
+In case both `fast-jar` and `native` or `native-sources` are specified, two `IntegrationKit` resources are created,
+with the native kit having precedence over the `fast-jar` one once ready.
The order influences the resolution of the current kit for the integration.
The kit corresponding to the first package type will be assigned to the
integration in case no existing kit that matches the integration exists.
diff --git a/docs/modules/traits/pages/quarkus.adoc b/docs/modules/traits/pages/quarkus.adoc
index b03444c8b..f5014394f 100755
--- a/docs/modules/traits/pages/quarkus.adoc
+++ b/docs/modules/traits/pages/quarkus.adoc
@@ -5,9 +5,9 @@ The Quarkus trait configures the Quarkus runtime.
It's enabled by default.
-NOTE: Compiling to a native executable, i.e. when using `package-type=native`, requires at least
-4GiB of memory, so the Pod running the native build, that is either the operator Pod, or the build
-Pod (depending on the build strategy configured for the platform), must have enough memory available.
+NOTE: A native based compilation will be forced to use a `pod` build strategy.
+Compiling to a native executable, i.e. when using `package-type=native`, requires at least
+4GiB of memory, so the Pod running the native build, must have enough memory available.
This trait is available in the following profiles: **Kubernetes, Knative, OpenShift**.
@@ -35,9 +35,9 @@ The following configuration options are available:
| quarkus.package-type
| []github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait.QuarkusPackageType
-| The Quarkus package types, either `fast-jar` or `native` (default `fast-jar`).
-In case both `fast-jar` and `native` are specified, two `IntegrationKit` resources are created,
-with the `native` kit having precedence over the `fast-jar` one once ready.
+| The Quarkus package types, `fast-jar`, `native-sources` or `native` (default `fast-jar`). `native` is deprecated.
+In case both `fast-jar` and `native` or `native-sources` are specified, two `IntegrationKit` resources are created,
+with the native kit having precedence over the `fast-jar` one once ready.
The order influences the resolution of the current kit for the integration.
The kit corresponding to the first package type will be assigned to the
integration in case no existing kit that matches the integration exists.
diff --git a/helm/camel-k/crds/crd-build.yaml b/helm/camel-k/crds/crd-build.yaml
index 9efe73a2d..0ff027d69 100644
--- a/helm/camel-k/crds/crd-build.yaml
+++ b/helm/camel-k/crds/crd-build.yaml
@@ -189,8 +189,7 @@ spec:
type: boolean
type: object
builder:
- description: a BuilderTask, used to generate and package the
- project
+ description: a BuilderTask, used to generate and build the project
properties:
baseImage:
description: the base image layer
@@ -688,12 +687,17 @@ spec:
type: array
type: object
custom:
- description: UserTask is used to execute any generic custom
- operation.
+ description: User customizable task execution. These are executed
+ after the build and before the package task.
properties:
command:
- description: the command to execute
+ description: 'the command to execute Deprecated: use ContainerCommands'
type: string
+ commands:
+ description: the command to execute
+ items:
+ type: string
+ type: array
image:
description: the container image to use
type: string
@@ -792,6 +796,505 @@ spec:
description: log more information
type: boolean
type: object
+ package:
+ description: Application pre publishing a PackageTask, used
+ to package the project
+ properties:
+ baseImage:
+ description: the base image layer
+ type: string
+ buildDir:
+ description: workspace directory to use
+ type: string
+ configuration:
+ description: The configuration that should be used to perform
+ the Build.
+ properties:
+ limitCPU:
+ description: The maximum amount of CPU required. Only
+ used for `pod` strategy
+ type: string
+ limitMemory:
+ description: The maximum amount of memory required.
+ Only used for `pod` strategy
+ type: string
+ operatorNamespace:
+ description: The namespace where to run the builder
+ Pod (must be the same of the operator in charge of
+ this Build reconciliation).
+ type: string
+ orderStrategy:
+ description: the build order strategy to adopt
+ enum:
+ - dependencies
+ - fifo
+ - sequential
+ type: string
+ requestCPU:
+ description: The minimum amount of CPU required. Only
+ used for `pod` strategy
+ type: string
+ requestMemory:
+ description: The minimum amount of memory required.
+ Only used for `pod` strategy
+ type: string
+ strategy:
+ description: the strategy to adopt
+ enum:
+ - routine
+ - pod
+ type: string
+ toolImage:
+ description: The container image to be used to run the
+ build.
+ type: string
+ type: object
+ dependencies:
+ description: the list of dependencies to use for this build
+ items:
+ type: string
+ type: array
+ maven:
+ description: the configuration required by Maven for the
+ application build phase
+ properties:
+ caSecrets:
+ description: The Secrets name and key, containing the
+ CA certificate(s) used to connect to remote Maven
+ repositories. It can contain X.509 certificates, and
+ PKCS#7 formatted certificate chains. A JKS formatted
+ keystore is automatically created to store the CA
+ certificate(s), and configured to be used as a trusted
+ certificate(s) by the Maven commands. Note that the
+ root CA certificates are also imported into the created
+ keystore.
+ items:
+ description: SecretKeySelector selects a key of a
+ Secret.
+ properties:
+ key:
+ description: The key of the secret to select from. Must
+ be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion, kind,
+ uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: array
+ cliOptions:
+ description: The CLI options that are appended to the
+ list of arguments for Maven commands, e.g., `-V,--no-transfer-progress,-Dstyle.color=never`.
+ See https://maven.apache.org/ref/3.8.4/maven-embedder/cli.html.
+ items:
+ type: string
+ type: array
+ extension:
+ description: The Maven build extensions. See https://maven.apache.org/guides/mini/guide-using-extensions.html.
+ items:
+ description: MavenArtifact defines a GAV (Group:Artifact:Version)
+ Maven artifact.
+ properties:
+ artifactId:
+ description: Maven Artifact
+ type: string
+ groupId:
+ description: Maven Group
+ type: string
+ version:
+ description: Maven Version
+ type: string
+ required:
+ - artifactId
+ - groupId
+ type: object
+ type: array
+ localRepository:
+ description: The path of the local Maven repository.
+ type: string
+ profiles:
+ description: A reference to the ConfigMap or Secret
+ key that contains the Maven profile.
+ items:
+ description: ValueSource --.
+ properties:
+ configMapKeyRef:
+ description: Selects a key of a ConfigMap.
+ properties:
+ key:
+ description: The key to select.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the ConfigMap
+ or its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ secretKeyRef:
+ description: Selects a key of a secret.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: object
+ type: array
+ properties:
+ additionalProperties:
+ type: string
+ description: The Maven properties.
+ type: object
+ repositories:
+ description: additional repositories
+ items:
+ description: Repository defines a Maven repository.
+ properties:
+ id:
+ description: identifies the repository
+ type: string
+ name:
+ description: name of the repository
+ type: string
+ releases:
+ description: can use stable releases
+ properties:
+ checksumPolicy:
+ description: When Maven deploys files to the
+ repository, it also deploys corresponding
+ checksum files. Your options are to `ignore`,
+ `fail`, or `warn` on missing or incorrect
+ checksums.
+ type: string
+ enabled:
+ description: is the policy activated or not
+ type: boolean
+ updatePolicy:
+ description: 'This element specifies how often
+ updates should attempt to occur. Maven will
+ compare the local POM''s timestamp (stored
+ in a repository''s maven-metadata file)
+ to the remote. The choices are: `always`,
+ `daily` (default), `interval:X` (where X
+ is an integer in minutes) or `never`'
+ type: string
+ required:
+ - enabled
+ type: object
+ snapshots:
+ description: can use snapshot
+ properties:
+ checksumPolicy:
+ description: When Maven deploys files to the
+ repository, it also deploys corresponding
+ checksum files. Your options are to `ignore`,
+ `fail`, or `warn` on missing or incorrect
+ checksums.
+ type: string
+ enabled:
+ description: is the policy activated or not
+ type: boolean
+ updatePolicy:
+ description: 'This element specifies how often
+ updates should attempt to occur. Maven will
+ compare the local POM''s timestamp (stored
+ in a repository''s maven-metadata file)
+ to the remote. The choices are: `always`,
+ `daily` (default), `interval:X` (where X
+ is an integer in minutes) or `never`'
+ type: string
+ required:
+ - enabled
+ type: object
+ url:
+ description: location of the repository
+ type: string
+ required:
+ - id
+ - url
+ type: object
+ type: array
+ servers:
+ description: Servers (auth)
+ items:
+ description: Server see link:https://maven.apache.org/settings.html[Maven
+ settings].
+ properties:
+ configuration:
+ additionalProperties:
+ type: string
+ description: Properties -- .
+ type: object
+ id:
+ type: string
+ password:
+ type: string
+ username:
+ type: string
+ type: object
+ type: array
+ settings:
+ description: A reference to the ConfigMap or Secret
+ key that contains the Maven settings.
+ properties:
+ configMapKeyRef:
+ description: Selects a key of a ConfigMap.
+ properties:
+ key:
+ description: The key to select.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the ConfigMap or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ secretKeyRef:
+ description: Selects a key of a secret.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: object
+ settingsSecurity:
+ description: A reference to the ConfigMap or Secret
+ key that contains the security of the Maven settings.
+ properties:
+ configMapKeyRef:
+ description: Selects a key of a ConfigMap.
+ properties:
+ key:
+ description: The key to select.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the ConfigMap or
+ its key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ secretKeyRef:
+ description: Selects a key of a secret.
+ properties:
+ key:
+ description: The key of the secret to select
+ from. Must be a valid secret key.
+ type: string
+ name:
+ description: 'Name of the referent. More info:
+ https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
+ TODO: Add other useful fields. apiVersion,
+ kind, uid?'
+ type: string
+ optional:
+ description: Specify whether the Secret or its
+ key must be defined
+ type: boolean
+ required:
+ - key
+ type: object
+ type: object
+ type: object
+ name:
+ description: name of the task
+ type: string
+ runtime:
+ description: the configuration required for the runtime
+ application
+ properties:
+ applicationClass:
+ description: application entry point (main) to be executed
+ type: string
+ capabilities:
+ additionalProperties:
+ description: Capability is a particular feature which
+ requires a well known set of dependencies which
+ are specified in the runtime catalog.
+ properties:
+ dependencies:
+ items:
+ description: MavenArtifact defines a GAV (Group:Artifact:Version)
+ Maven artifact.
+ properties:
+ artifactId:
+ description: Maven Artifact
+ type: string
+ groupId:
+ description: Maven Group
+ type: string
+ version:
+ description: Maven Version
+ type: string
+ required:
+ - artifactId
+ - groupId
+ type: object
+ type: array
+ required:
+ - dependencies
+ type: object
+ description: features offered by this runtime
+ type: object
+ dependencies:
+ description: list of dependencies needed to run the
+ application
+ items:
+ description: MavenArtifact defines a GAV (Group:Artifact:Version)
+ Maven artifact.
+ properties:
+ artifactId:
+ description: Maven Artifact
+ type: string
+ groupId:
+ description: Maven Group
+ type: string
+ version:
+ description: Maven Version
+ type: string
+ required:
+ - artifactId
+ - groupId
+ type: object
+ type: array
+ metadata:
+ additionalProperties:
+ type: string
+ description: set of metadata
+ type: object
+ provider:
+ description: Camel main application provider, ie, Camel
+ Quarkus
+ type: string
+ version:
+ description: Camel K Runtime version
+ type: string
+ required:
+ - applicationClass
+ - dependencies
+ - provider
+ - version
+ type: object
+ sources:
+ description: the sources to add at build time
+ items:
+ description: SourceSpec defines the configuration for
+ one or more routes to be executed in a certain Camel
+ DSL language.
+ properties:
+ compression:
+ description: if the content is compressed (base64
+ encrypted)
+ type: boolean
+ content:
+ description: the source code (plain text)
+ type: string
+ contentKey:
+ description: the confimap key holding the source content
+ type: string
+ contentRef:
+ description: the confimap reference holding the source
+ content
+ type: string
+ contentType:
+ description: the content type (tipically text or binary)
+ type: string
+ interceptors:
+ description: Interceptors are optional identifiers
+ the org.apache.camel.k.RoutesLoader uses to pre/post
+ process sources
+ items:
+ type: string
+ type: array
+ language:
+ description: specify which is the language (Camel
+ DSL) used to interpret this source code
+ type: string
+ loader:
+ description: Loader is an optional id of the org.apache.camel.k.RoutesLoader
+ that will interpret this source at runtime
+ type: string
+ name:
+ description: the name of the specification
+ type: string
+ path:
+ description: the path where the file is stored
+ type: string
+ property-names:
+ description: List of property names defined in the
+ source (e.g. if type is "template")
+ items:
+ type: string
+ type: array
+ rawContent:
+ description: the source code (binary)
+ format: byte
+ type: string
+ type:
+ description: Type defines the kind of source described
+ by this object
+ type: string
+ type: object
+ type: array
+ steps:
+ description: the list of steps to execute (see pkg/builder/)
+ items:
+ type: string
+ type: array
+ type: object
s2i:
description: a S2iTask, for S2I strategy
properties:
diff --git a/helm/camel-k/crds/crd-integration-kit.yaml b/helm/camel-k/crds/crd-integration-kit.yaml
index f70954ab5..ea68807a3 100644
--- a/helm/camel-k/crds/crd-integration-kit.yaml
+++ b/helm/camel-k/crds/crd-integration-kit.yaml
@@ -300,19 +300,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml
index f65b8207a..a37e7c91d 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -1589,19 +1589,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
@@ -3361,19 +3363,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/helm/camel-k/crds/crd-integration.yaml b/helm/camel-k/crds/crd-integration.yaml
index 7a41808ee..042186be4 100644
--- a/helm/camel-k/crds/crd-integration.yaml
+++ b/helm/camel-k/crds/crd-integration.yaml
@@ -7506,19 +7506,21 @@ spec:
traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence over
- the `fast-jar` one once ready. The order influences the
- resolution of the current kit for the integration. The kit
- corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches
- the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution of the
+ current kit for the integration. The kit corresponding to
+ the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus build
+ packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/helm/camel-k/crds/crd-kamelet-binding.yaml b/helm/camel-k/crds/crd-kamelet-binding.yaml
index d3c4b9a6f..1181e466b 100644
--- a/helm/camel-k/crds/crd-kamelet-binding.yaml
+++ b/helm/camel-k/crds/crd-kamelet-binding.yaml
@@ -7801,19 +7801,22 @@ spec:
All traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence
- over the `fast-jar` one once ready. The order influences
- the resolution of the current kit for the integration.
- The kit corresponding to the first package type will
- be assigned to the integration in case no existing kit
- that matches the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution
+ of the current kit for the integration. The kit corresponding
+ to the first package type will be assigned to the integration
+ in case no existing kit that matches the integration
+ exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus
+ build packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/helm/camel-k/crds/crd-pipe.yaml b/helm/camel-k/crds/crd-pipe.yaml
index 33fb3e7d1..d6b5e1269 100644
--- a/helm/camel-k/crds/crd-pipe.yaml
+++ b/helm/camel-k/crds/crd-pipe.yaml
@@ -7798,19 +7798,22 @@ spec:
All traits share this common property.
type: boolean
packageTypes:
- description: The Quarkus package types, either `fast-jar`
- or `native` (default `fast-jar`). In case both `fast-jar`
- and `native` are specified, two `IntegrationKit` resources
- are created, with the `native` kit having precedence
- over the `fast-jar` one once ready. The order influences
- the resolution of the current kit for the integration.
- The kit corresponding to the first package type will
- be assigned to the integration in case no existing kit
- that matches the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources`
+ or `native` (default `fast-jar`). `native` is deprecated.
+ In case both `fast-jar` and `native` or `native-sources`
+ are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar`
+ one once ready. The order influences the resolution
+ of the current kit for the integration. The kit corresponding
+ to the first package type will be assigned to the integration
+ in case no existing kit that matches the integration
+ exists.
items:
- description: Quarkus package type.
+ description: QuarkusPackageType is the type of Quarkus
+ build packaging.
enum:
- fast-jar
+ - native-sources
- native
type: string
type: array
diff --git a/pkg/apis/camel/v1/build_types.go b/pkg/apis/camel/v1/build_types.go
index 0d875ceab..581ec47dd 100644
--- a/pkg/apis/camel/v1/build_types.go
+++ b/pkg/apis/camel/v1/build_types.go
@@ -54,9 +54,16 @@ type BuildSpec struct {
type Task struct {
// Application building
- // a BuilderTask, used to generate and package the project
+ // a BuilderTask, used to generate and build the project
Builder *BuilderTask `json:"builder,omitempty"`
+ // User customizable task execution. These are executed after the build and before the package task.
+ Custom *UserTask `json:"custom,omitempty"`
+
+ // Application pre publishing
+ // a PackageTask, used to package the project
+ Package *BuilderTask `json:"package,omitempty"`
+
// Application Publishing
// a BuildahTask, for Buildah strategy
@@ -71,10 +78,6 @@ type Task struct {
S2i *S2iTask `json:"s2i,omitempty"`
// a JibTask, for Jib strategy
Jib *JibTask `json:"jib,omitempty"`
-
- // User customizable task execution
-
- Custom *UserTask `json:"custom,omitempty"`
}
// BaseTask is a base for the struct hierarchy.
@@ -185,7 +188,10 @@ type UserTask struct {
// the container image to use
ContainerImage string `json:"image,omitempty"`
// the command to execute
+ // Deprecated: use ContainerCommands
ContainerCommand string `json:"command,omitempty"`
+ // the command to execute
+ ContainerCommands []string `json:"commands,omitempty"`
}
// BuildStatus defines the observed state of Build.
diff --git a/pkg/apis/camel/v1/trait/quarkus.go b/pkg/apis/camel/v1/trait/quarkus.go
index 571ad6206..2d5548c1a 100644
--- a/pkg/apis/camel/v1/trait/quarkus.go
+++ b/pkg/apis/camel/v1/trait/quarkus.go
@@ -21,29 +21,32 @@ package trait
//
// It's enabled by default.
//
-// NOTE: Compiling to a native executable, i.e. when using `package-type=native`, requires at least
-// 4GiB of memory, so the Pod running the native build, that is either the operator Pod, or the build
-// Pod (depending on the build strategy configured for the platform), must have enough memory available.
+// NOTE: A native based compilation will be forced to use a `pod` build strategy.
+// Compiling to a native executable, i.e. when using `package-type=native`, requires at least
+// 4GiB of memory, so the Pod running the native build, must have enough memory available.
//
// +camel-k:trait=quarkus.
type QuarkusTrait struct {
Trait `property:",squash" json:",inline"`
- // The Quarkus package types, either `fast-jar` or `native` (default `fast-jar`).
- // In case both `fast-jar` and `native` are specified, two `IntegrationKit` resources are created,
- // with the `native` kit having precedence over the `fast-jar` one once ready.
+ // The Quarkus package types, `fast-jar`, `native-sources` or `native` (default `fast-jar`). `native` is deprecated.
+ // In case both `fast-jar` and `native` or `native-sources` are specified, two `IntegrationKit` resources are created,
+ // with the native kit having precedence over the `fast-jar` one once ready.
// The order influences the resolution of the current kit for the integration.
// The kit corresponding to the first package type will be assigned to the
// integration in case no existing kit that matches the integration exists.
PackageTypes []QuarkusPackageType `property:"package-type" json:"packageTypes,omitempty"`
}
-// Quarkus package type.
-// +kubebuilder:validation:Enum=fast-jar;native
+// QuarkusPackageType is the type of Quarkus build packaging.
+// +kubebuilder:validation:Enum=fast-jar;native-sources;native
type QuarkusPackageType string
const (
- // Quarkus package type representing "fast jar" packaging.
+ // FastJarPackageType represents "fast jar" Quarkus packaging.
FastJarPackageType QuarkusPackageType = "fast-jar"
- // Quarkus package type representing "native" packaging.
+ // NativePackageType represents "native" Quarkus packaging.
+ // Deprecated: use native-sources instead.
NativePackageType QuarkusPackageType = "native"
+ // NativeSourcesPackageType represents "native-sources" Quarkus packaging.
+ NativeSourcesPackageType QuarkusPackageType = "native-sources"
)
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 533002897..b77a301d9 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -2759,6 +2759,16 @@ func (in *Task) DeepCopyInto(out *Task) {
*out = new(BuilderTask)
(*in).DeepCopyInto(*out)
}
+ if in.Custom != nil {
+ in, out := &in.Custom, &out.Custom
+ *out = new(UserTask)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.Package != nil {
+ in, out := &in.Package, &out.Package
+ *out = new(BuilderTask)
+ (*in).DeepCopyInto(*out)
+ }
if in.Buildah != nil {
in, out := &in.Buildah, &out.Buildah
*out = new(BuildahTask)
@@ -2784,11 +2794,6 @@ func (in *Task) DeepCopyInto(out *Task) {
*out = new(JibTask)
**out = **in
}
- if in.Custom != nil {
- in, out := &in.Custom, &out.Custom
- *out = new(UserTask)
- **out = **in
- }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Task.
@@ -3078,6 +3083,11 @@ func (in *Traits) DeepCopy() *Traits {
func (in *UserTask) DeepCopyInto(out *UserTask) {
*out = *in
out.BaseTask = in.BaseTask
+ if in.ContainerCommands != nil {
+ in, out := &in.ContainerCommands, &out.ContainerCommands
+ *out = make([]string, len(*in))
+ copy(*out, *in)
+ }
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserTask.
diff --git a/pkg/builder/builder.go b/pkg/builder/builder.go
index ec1280eb5..ac2e3ecfd 100644
--- a/pkg/builder/builder.go
+++ b/pkg/builder/builder.go
@@ -63,6 +63,7 @@ func (t *builderTask) Do(ctx context.Context) v1.BuildStatus {
Build: *t.task,
BaseImage: t.task.BaseImage,
}
+ t.log.Infof("running builder task %s in context directory: %s", c.Build.Name, c.Path)
steps, err := StepsFrom(t.task.Steps...)
if err != nil {
@@ -75,7 +76,7 @@ func (t *builderTask) Do(ctx context.Context) v1.BuildStatus {
return steps[i].Phase() < steps[j].Phase()
})
- t.log.Infof("steps: %v", steps)
+ t.log.Debugf("steps: %v", steps)
steps:
for _, step := range steps {
@@ -94,7 +95,7 @@ steps:
default:
l := t.log.WithValues("step", step.ID(), "phase", strconv.FormatInt(int64(step.Phase()), 10), "task", t.task.Name)
- l.Infof("executing step")
+ l.Debugf("executing step")
start := time.Now()
err := step.execute(&c)
@@ -104,7 +105,7 @@ steps:
break steps
}
- l.Infof("step done in %f seconds", time.Since(start).Seconds())
+ l.Debugf("step done in %f seconds", time.Since(start).Seconds())
}
}
@@ -117,11 +118,11 @@ steps:
result.Artifacts = make([]v1.Artifact, 0, len(c.Artifacts))
result.Artifacts = append(result.Artifacts, c.Artifacts...)
- t.log.Infof("dependencies: %s", t.task.Dependencies)
- t.log.Infof("artifacts: %s", artifactIDs(c.Artifacts))
- t.log.Infof("artifacts selected: %s", artifactIDs(c.SelectedArtifacts))
- t.log.Infof("base image: %s", t.task.BaseImage)
- t.log.Infof("resolved base image: %s", c.BaseImage)
+ t.log.Debugf("dependencies: %s", t.task.Dependencies)
+ t.log.Debugf("artifacts: %s", artifactIDs(c.Artifacts))
+ t.log.Debugf("artifacts selected: %s", artifactIDs(c.SelectedArtifacts))
+ t.log.Debugf("base image: %s", t.task.BaseImage)
+ t.log.Debugf("resolved base image: %s", c.BaseImage)
return result
}
diff --git a/pkg/builder/image.go b/pkg/builder/image.go
index 215f3e435..c6bc6d9b8 100644
--- a/pkg/builder/image.go
+++ b/pkg/builder/image.go
@@ -50,6 +50,7 @@ type imageSteps struct {
JvmDockerfile Step
}
+// Image used to export the steps available on an Image building process
var Image = imageSteps{
IncrementalImageContext: NewStep(ApplicationPackagePhase, incrementalImageContext),
NativeImageContext: NewStep(ApplicationPackagePhase, nativeImageContext),
@@ -68,7 +69,7 @@ func nativeImageContext(ctx *builderContext) error {
ctx.Artifacts = []v1.Artifact{
{
ID: runner,
- Location: filepath.Join(ctx.Path, "maven", "target", runner),
+ Location: filepath.Join(ctx.Path, "maven", "target", "native-sources", runner),
Target: runner,
},
}
diff --git a/pkg/builder/spectrum.go b/pkg/builder/spectrum.go
index 9d28a95cf..2bc3b2673 100644
--- a/pkg/builder/spectrum.go
+++ b/pkg/builder/spectrum.go
@@ -68,6 +68,8 @@ func (t *spectrumTask) Do(ctx context.Context) v1.BuildStatus {
contextDir = filepath.Join(pwd, ContextDir)
}
+ log.Infof("Running spectrum task in context directory: %s", contextDir)
+
exists, err := util.DirectoryExists(contextDir)
if err != nil {
return status.Failed(err)
diff --git a/pkg/builder/tasks.go b/pkg/builder/tasks.go
index 054fe3552..3b35e2db2 100644
--- a/pkg/builder/tasks.go
+++ b/pkg/builder/tasks.go
@@ -24,6 +24,7 @@ import (
v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
)
+// Build convert the Build CR in a struct that can be executable as an operator routing
func (b *Builder) Build(build *v1.Build) *Build {
return &Build{
builder: *b,
@@ -31,6 +32,7 @@ func (b *Builder) Build(build *v1.Build) *Build {
}
}
+// Task convert the task in a routine task which can be executed inside operator
func (b *Build) Task(task v1.Task) Task {
switch {
case task.Builder != nil:
@@ -40,11 +42,26 @@ func (b *Build) Task(task v1.Task) Task {
build: b.build,
task: task.Builder,
}
+ // Custom tasks are not supported in routines
+ case task.Custom != nil:
+ return &unsupportedTask{
+ build: b.build,
+ name: task.Custom.Name,
+ }
+ case task.Package != nil:
+ return &builderTask{
+ c: b.builder.client,
+ log: b.builder.log,
+ build: b.build,
+ task: task.Package,
+ }
+ // Buildah tasks are not supported in routines
case task.Buildah != nil:
return &unsupportedTask{
build: b.build,
name: task.Buildah.Name,
}
+ // Kaniko tasks are not supported in routines
case task.Kaniko != nil:
return &unsupportedTask{
build: b.build,
@@ -112,6 +129,7 @@ func (t *unsupportedTask) Do(_ context.Context) v1.BuildStatus {
var _ Task = &missingTask{}
+// TaskByName return the task identified by the name parameter
func (b *Build) TaskByName(name string) Task {
for _, task := range b.build.Spec.Tasks {
switch {
@@ -122,6 +140,18 @@ func (b *Build) TaskByName(name string) Task {
build: b.build,
task: task.Builder,
}
+ case task.Custom != nil && task.Custom.Name == name:
+ return &unsupportedTask{
+ build: b.build,
+ name: task.Custom.Name,
+ }
+ case task.Package != nil && task.Package.Name == name:
+ return &builderTask{
+ c: b.builder.client,
+ log: b.builder.log,
+ build: b.build,
+ task: task.Package,
+ }
case task.Buildah != nil && task.Buildah.Name == name:
return &unsupportedTask{
build: b.build,
diff --git a/pkg/client/camel/applyconfiguration/camel/v1/task.go b/pkg/client/camel/applyconfiguration/camel/v1/task.go
index a4b7912c2..1cef4a8c7 100644
--- a/pkg/client/camel/applyconfiguration/camel/v1/task.go
+++ b/pkg/client/camel/applyconfiguration/camel/v1/task.go
@@ -23,12 +23,13 @@ package v1
// with apply.
type TaskApplyConfiguration struct {
Builder *BuilderTaskApplyConfiguration `json:"builder,omitempty"`
+ Custom *UserTaskApplyConfiguration `json:"custom,omitempty"`
+ Package *BuilderTaskApplyConfiguration `json:"package,omitempty"`
Buildah *BuildahTaskApplyConfiguration `json:"buildah,omitempty"`
Kaniko *KanikoTaskApplyConfiguration `json:"kaniko,omitempty"`
Spectrum *SpectrumTaskApplyConfiguration `json:"spectrum,omitempty"`
S2i *S2iTaskApplyConfiguration `json:"s2i,omitempty"`
Jib *JibTaskApplyConfiguration `json:"jib,omitempty"`
- Custom *UserTaskApplyConfiguration `json:"custom,omitempty"`
}
// TaskApplyConfiguration constructs an declarative configuration of the Task type for use with
@@ -45,6 +46,22 @@ func (b *TaskApplyConfiguration) WithBuilder(value *BuilderTaskApplyConfiguratio
return b
}
+// WithCustom sets the Custom field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Custom field is set to the value of the last call.
+func (b *TaskApplyConfiguration) WithCustom(value *UserTaskApplyConfiguration) *TaskApplyConfiguration {
+ b.Custom = value
+ return b
+}
+
+// WithPackage sets the Package field in the declarative configuration to the given value
+// and returns the receiver, so that objects can be built by chaining "With" function invocations.
+// If called multiple times, the Package field is set to the value of the last call.
+func (b *TaskApplyConfiguration) WithPackage(value *BuilderTaskApplyConfiguration) *TaskApplyConfiguration {
+ b.Package = value
+ return b
+}
+
// WithBuildah sets the Buildah field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Buildah field is set to the value of the last call.
@@ -84,11 +101,3 @@ func (b *TaskApplyConfiguration) WithJib(value *JibTaskApplyConfiguration) *Task
b.Jib = value
return b
}
-
-// WithCustom sets the Custom field in the declarative configuration to the given value
-// and returns the receiver, so that objects can be built by chaining "With" function invocations.
-// If called multiple times, the Custom field is set to the value of the last call.
-func (b *TaskApplyConfiguration) WithCustom(value *UserTaskApplyConfiguration) *TaskApplyConfiguration {
- b.Custom = value
- return b
-}
diff --git a/pkg/client/camel/applyconfiguration/camel/v1/usertask.go b/pkg/client/camel/applyconfiguration/camel/v1/usertask.go
index 51dcadc4b..65b7c5c2a 100644
--- a/pkg/client/camel/applyconfiguration/camel/v1/usertask.go
+++ b/pkg/client/camel/applyconfiguration/camel/v1/usertask.go
@@ -23,8 +23,9 @@ package v1
// with apply.
type UserTaskApplyConfiguration struct {
BaseTaskApplyConfiguration `json:",inline"`
- ContainerImage *string `json:"image,omitempty"`
- ContainerCommand *string `json:"command,omitempty"`
+ ContainerImage *string `json:"image,omitempty"`
+ ContainerCommand *string `json:"command,omitempty"`
+ ContainerCommands []string `json:"commands,omitempty"`
}
// UserTaskApplyConfiguration constructs an declarative configuration of the UserTask type for use with
@@ -56,3 +57,13 @@ func (b *UserTaskApplyConfiguration) WithContainerCommand(value string) *UserTas
b.ContainerCommand = &value
return b
}
+
+// WithContainerCommands adds the given value to the ContainerCommands field in the declarative configuration
+// and returns the receiver, so that objects can be build by chaining "With" function invocations.
+// If called multiple times, values provided by each call will be appended to the ContainerCommands field.
+func (b *UserTaskApplyConfiguration) WithContainerCommands(values ...string) *UserTaskApplyConfiguration {
+ for i := range values {
+ b.ContainerCommands = append(b.ContainerCommands, values[i])
+ }
+ return b
+}
diff --git a/pkg/controller/build/build_pod.go b/pkg/controller/build/build_pod.go
index 686152ab3..27ccd0f68 100644
--- a/pkg/controller/build/build_pod.go
+++ b/pkg/controller/build/build_pod.go
@@ -154,8 +154,17 @@ func newBuildPod(ctx context.Context, c ctrl.Reader, client client.Client, build
for _, task := range build.Spec.Tasks {
switch {
+ // Builder task
case task.Builder != nil:
addBuildTaskToPod(ctx, client, build, task.Builder.Name, pod)
+ // Custom task
+ case task.Custom != nil:
+ addCustomTaskToPod(build, task.Custom, pod)
+ // Package task
+ // It's a type of builder task, we can reuse the same type
+ case task.Package != nil:
+ addBuildTaskToPod(ctx, client, build, task.Package.Name, pod)
+ // Publish task
case task.Buildah != nil:
err := addBuildahTaskToPod(ctx, c, build, task.Buildah, pod)
if err != nil {
@@ -172,8 +181,6 @@ func newBuildPod(ctx context.Context, c ctrl.Reader, client client.Client, build
addBuildTaskToPod(ctx, client, build, task.Spectrum.Name, pod)
case task.Jib != nil:
addBuildTaskToPod(ctx, client, build, task.Jib.Name, pod)
- case task.Custom != nil:
- addCustomTaskToPod(build, task.Custom, pod)
}
}
@@ -558,7 +565,7 @@ func addCustomTaskToPod(build *v1.Build, task *v1.UserTask, pod *corev1.Pod) {
Name: task.Name,
Image: task.ContainerImage,
ImagePullPolicy: corev1.PullIfNotPresent,
- Command: strings.Split(task.ContainerCommand, " "),
+ Command: task.ContainerCommands,
WorkingDir: filepath.Join(builderDir, build.Name),
Env: proxyFromEnvironment(),
}
diff --git a/pkg/controller/build/monitor_routine.go b/pkg/controller/build/monitor_routine.go
index adc566d04..3c3b3ce52 100644
--- a/pkg/controller/build/monitor_routine.go
+++ b/pkg/controller/build/monitor_routine.go
@@ -122,6 +122,7 @@ tasks:
break tasks
default:
+ // TODO apply code refactoring to the below conditions
// Coordinate the build and context directories across the sequence of tasks
if t := task.Builder; t != nil {
if t.BuildDir == "" {
@@ -136,6 +137,12 @@ tasks:
defer os.RemoveAll(tmpDir)
}
buildDir = t.BuildDir
+ } else if t := task.Package; t != nil {
+ if buildDir == "" {
+ status.Failed(fmt.Errorf("cannot determine builder directory for task %s", t.Name))
+ break tasks
+ }
+ t.BuildDir = buildDir
} else if t := task.Spectrum; t != nil && t.ContextDir == "" {
if buildDir == "" {
status.Failed(fmt.Errorf("cannot determine context directory for task %s", t.Name))
@@ -148,7 +155,6 @@ tasks:
break tasks
}
t.ContextDir = filepath.Join(buildDir, builder.ContextDir)
-
} else if t := task.Jib; t != nil && t.ContextDir == "" {
if buildDir == "" {
status.Failed(fmt.Errorf("cannot determine context directory for task %s", t.Name))
@@ -211,16 +217,21 @@ func (action *monitorRoutineAction) updateBuildStatus(ctx context.Context, build
} else if target.Status.Phase == v1.BuildPhaseError {
action.L.Errorf(nil, "Build %s errored: %s", build.Name, target.Status.Error)
}
- err = action.client.Status().Patch(ctx, target, ctrl.RawPatch(types.MergePatchType, p))
- if err != nil {
- action.L.Errorf(err, "Cannot update build status: %s", build.Name)
- event.NotifyBuildError(ctx, action.client, action.recorder, build, target, err)
- return err
- }
- if target.Status.Phase != build.Status.Phase {
- action.L.Info("State transition", "phase-from", build.Status.Phase, "phase-to", target.Status.Phase)
+
+ if len(p) > 0 {
+ err = action.client.Status().Patch(ctx, target, ctrl.RawPatch(types.MergePatchType, p))
+ if err != nil {
+ action.L.Errorf(err, "Cannot update build status: %s", build.Name)
+ event.NotifyBuildError(ctx, action.client, action.recorder, build, target, err)
+ return err
+ }
+
+ if target.Status.Phase != build.Status.Phase {
+ action.L.Info("State transition", "phase-from", build.Status.Phase, "phase-to", target.Status.Phase)
+ }
+ event.NotifyBuildUpdated(ctx, action.client, action.recorder, build, target)
+ build.Status = target.Status
}
- event.NotifyBuildUpdated(ctx, action.client, action.recorder, build, target)
- build.Status = target.Status
+
return nil
}
diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 1cc6fd060..fb3c4547b 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -117,9 +117,9 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_builds.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_builds.yaml",
modTime: time.Time{},
- uncompressedSize: 49805,
+ uncompressedSize: 78450,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\x6b\x73\x1b\x37\x96\xe8\x77\xfd\x8a\x53\xf1\x87\xc8\x55\x22\x95\x38\x33\x73\x73\x75\xeb\xd6\x96\x46\x4e\x32\x1a\xc7\x96\xd7\x94\x3d\x33\xb5\xb5\x55\x02\xbb\x0f\x49\x84\xdd\x40\x2f\x80\x16\xcd\xd9\xda\xff\xbe\x85\x57\x3f\xc8\x7e\x00\x14\x15\x67\x2a\xc4\x17\x5b\x6c\x3c\xce\x39\x38\x38\x2f\x1c\x00\x2f\x60\x72\xbc\x72\xf6\x02\x7e\xa6\x09\x32\x89\x29\x28\x0e\x6a\x85\x70\x5d\x90\x64\x85\x30\xe3\x0b\xb5\x21\x02\xe1\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\x6d\x73\x1b\x37\x92\xf0\x77\xfd\x8a\xae\xf8\x43\xe4\x2a\x91\x4a\x9c\xec\x5e\x4e\x4f\x5d\x3d\xa5\x95\x93\x3d\xad\x1d\xdb\x67\x2a\xde\xdd\xba\xba\x2a\x81\x33\x4d\x12\xe1\x0c\x30\x07\x60\x24\x33\x4f\x3d\xff\xfd\x0a\x6f\xf3\x42\xce\x0b\x40\x91\xb6\xaf\x4c\x7c\x49\x2c\x62\x80\x6e\xa0\xd1\x6f\x68\x74\x3f\x83\xc9\xe1\xda\xd9\x33\x78\x4d\x13\x64\x12\x53\x50\x1c\xd4\x0a\xe1\xba\x20\xc9\x0a\x61\xc6\x17\xea\x91\x08\x84\x [...]
},
"/crd/bases/camel.apache.org_camelcatalogs.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_camelcatalogs.yaml",
@@ -131,30 +131,30 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_integrationkits.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_integrationkits.yaml",
modTime: time.Time{},
- uncompressedSize: 21596,
+ uncompressedSize: 21757,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\x5d\x73\xe3\x36\x92\xef\xfa\x15\x5d\xe3\x87\xb1\xab\x24\x79\x73\x97\x4a\x5d\x79\xb3\xa9\xf2\x3a\x93\xac\x6b\x3c\x33\xbe\x91\x27\xb9\xd4\x66\xab\xdc\x22\x5b\x12\x22\x12\x60\x00\x50\xb2\xee\xe3\xbf\x5f\xa1\x01\x50\x94\x44\x52\x1c\x39\xbe\xbd\x87\xe1\xcb\x8c\x49\xa0\xd1\x1f\xe8\x4f\x34\x74\x06\xa3\x3f\xee\x19\x9c\xc1\x9d\x48\x48\x1a\x4a\xc1\x2a\xb0\x0b\x82\xeb\x02\x93\x05\xc1\x44\xcd\xec\x1a\x35\xc1\x0f\xaa\x94\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3c\xdb\x72\xdb\x38\x96\xef\xfa\x8a\x53\xf1\x43\xec\x2a\x89\x9e\xde\xed\xea\xda\xf2\xf4\x74\x95\xc7\x9d\xf4\xb8\xe2\x24\xde\xc8\xe9\xde\xae\xe9\xa9\x12\x44\x1e\x49\x68\x91\x00\x1b\x00\x25\x6b\x2f\xff\xbe\x85\x03\x80\x17\x89\xa4\x68\x39\xde\xd9\x87\xf0\x25\x31\x09\x1c\x9c\xfb\x0d\x80\xce\x60\xf2\xe5\x9e\xd1\x19\xdc\xf1\x18\x85\xc6\x04\x8c\x04\xb3\x42\xb8\xce\x59\xbc\x42\x98\xca\x85\xd9\x32\x85\xf0\x56\x16\x22\x61\x [...]
},
"/crd/bases/camel.apache.org_integrationplatforms.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_integrationplatforms.yaml",
modTime: time.Time{},
- uncompressedSize: 192212,
+ uncompressedSize: 192534,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7d\x73\xdb\x36\xb6\x38\xfc\x7f\x3f\x05\xc6\x9d\x3b\x71\x32\x96\x94\xec\xde\xee\xf6\xfa\xde\xde\xe7\xe7\x3a\x69\xeb\x26\x8e\x7d\x6d\x27\xbb\x3b\x6d\xa7\x82\xc8\x23\x09\x35\x09\x70\x01\x50\xb6\x3a\xfb\xe1\x9f\xc1\x01\x40\x52\x12\x09\x52\x2f\xb6\xb3\x8d\x98\x99\xd6\x92\x48\xf0\x1c\xe0\xe0\xbc\xe1\xbc\x7c\x49\x7a\xbb\xbb\xbe\xf8\x92\xbc\x63\x11\x70\x05\x31\xd1\x82\xe8\x29\x90\x93\x8c\x46\x53\x20\xd7\x62\xac\xef\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7d\x73\xdb\x36\xb6\x38\xfc\x7f\x3f\x05\xc6\x9d\x3b\x71\x32\x96\x94\xec\xde\xee\xf6\xfa\xde\xde\xe7\xe7\x3a\x69\xeb\x26\x8e\x7d\x6d\x27\xbb\x3b\x6d\xa7\x82\xc8\x23\x09\x35\x09\x70\x01\x50\xb6\x3a\xfb\xe1\x9f\xc1\x01\x40\x52\x12\x09\x52\x2f\xb6\xb3\x8d\x98\x99\xd6\x92\x48\xf0\x1c\xe0\xe0\xbc\xe1\xbc\x7c\x49\x7a\xbb\xbb\xbe\xf8\x92\xbc\x63\x11\x70\x05\x31\xd1\x82\xe8\x29\x90\x93\x8c\x46\x53\x20\xd7\x62\xac\xef\x [...]
},
"/crd/bases/camel.apache.org_integrations.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_integrations.yaml",
modTime: time.Time{},
- uncompressedSize: 514551,
+ uncompressedSize: 514712,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x1d\xff\xa6\x9e\x94\x56\x92\x13\xfd\x62\xcb\x2a\x49\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x44\xc7\x99\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xf4\x7c\xe3\xb3\xcf\xc9\x5b\x9e\x30\xa1\x59\x4a\x8c\x24\x66\xce\xc8\x69\x41\x93\x39\x23\xb7\x72\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x1d\xff\xa6\x9e\x94\x56\x92\x13\xfd\x62\xcb\x2a\x49\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x44\xc7\x99\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xf4\x7c\xe3\xb3\xcf\xc9\x5b\x9e\x30\xa1\x59\x4a\x8c\x24\x66\xce\xc8\x69\x41\x93\x39\x23\xb7\x72\x [...]
},
"/crd/bases/camel.apache.org_kameletbindings.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_kameletbindings.yaml",
modTime: time.Time{},
- uncompressedSize: 595799,
+ uncompressedSize: 595998,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x6b\x73\x1b\x37\xb6\x30\x0a\x7f\xf7\xaf\x40\xc9\xa9\x47\xd2\x8e\x48\xd9\x99\x99\xd4\x8c\xdf\xa9\x9d\xd2\xc8\x72\xa2\x37\xb6\xcc\xb2\x94\xe4\x49\x39\xd9\x09\xd8\x0d\x92\xd8\xea\x06\x7a\x00\x34\x25\xe6\xf8\xfc\xf7\x53\x58\x00\xfa\xc2\x9b\xb0\x9a\x92\x46\x9e\x69\x4c\x55\xc6\xa4\xd8\xab\x71\x59\x58\xf7\xcb\x73\x32\xb8\xbf\xf1\xec\x39\x79\xcb\x13\x26\x34\x4b\x89\x91\xc4\xcc\x18\x39\x29\x68\x32\x63\xe4\x52\x4e\xcc\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x6b\x73\x1b\x37\xb6\x30\x0a\x7f\xf7\xaf\x40\xc9\xa9\x47\xd2\x8e\x48\xd9\x99\x99\xd4\x8c\xdf\xa9\x9d\xd2\xc8\x72\xa2\x37\xb6\xcc\xb2\x94\xe4\x49\x39\xd9\x09\xd8\x0d\x92\xd8\xea\x06\x7a\x00\x34\x25\xe6\xf8\xfc\xf7\x53\x58\x00\xfa\xc2\x9b\xb0\x9a\x92\x46\x9e\x69\x4c\x55\xc6\xa4\xd8\xab\x71\x59\x58\xf7\xcb\x73\x32\xb8\xbf\xf1\xec\x39\x79\xcb\x13\x26\x34\x4b\x89\x91\xc4\xcc\x18\x39\x29\x68\x32\x63\xe4\x52\x4e\xcc\x [...]
},
"/crd/bases/camel.apache.org_kamelets.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_kamelets.yaml",
@@ -166,9 +166,9 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_pipes.yaml": &vfsgen۰CompressedFileInfo{
name: "camel.apache.org_pipes.yaml",
modTime: time.Time{},
- uncompressedSize: 563061,
+ uncompressedSize: 563260,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\xb6\x28\x8a\xff\x9f\x4f\x81\xb2\x53\x47\xd2\x0e\x49\xd9\x99\x99\xd4\x1e\xff\xa6\x4e\x4a\x5b\x96\x13\xfd\x62\xcb\x2c\x4b\x49\x4e\xca\xc9\x4e\xc0\x6e\x90\xc4\x51\x37\xd0\x1b\x40\x53\x62\xae\xef\x77\xbf\x85\x05\xa0\x1f\x7c\x09\xab\x29\x69\xe4\x99\xc6\x54\x65\x4c\x8a\xbd\x1a\x8f\x85\xf5\x7e\x3c\x27\xc3\xfb\x1b\x5f\x3c\x27\x6f\x79\xc2\x84\x66\x29\x31\x92\x98\x39\x23\x27\x05\x4d\xe6\x8c\x5c\xca\xa9\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\xb6\x28\x8a\xff\x9f\x4f\x81\xb2\x53\x47\xd2\x0e\x49\xd9\x99\x99\xd4\x1e\xff\xa6\x4e\x4a\x5b\x96\x13\xfd\x62\xcb\x2c\x4b\x49\x4e\xca\xc9\x4e\xc0\x6e\x90\xc4\x51\x37\xd0\x1b\x40\x53\x62\xae\xef\x77\xbf\x85\x05\xa0\x1f\x7c\x09\xab\x29\x69\xe4\x99\xc6\x54\x65\x4c\x8a\xbd\x1a\x8f\x85\xf5\x7e\x3c\x27\xc3\xfb\x1b\x5f\x3c\x27\x6f\x79\xc2\x84\x66\x29\x31\x92\x98\x39\x23\x27\x05\x4d\xe6\x8c\x5c\xca\xa9\x [...]
},
"/manager": &vfsgen۰DirInfo{
name: "manager",
@@ -637,9 +637,9 @@ var assets = func() http.FileSystem {
"/traits.yaml": &vfsgen۰CompressedFileInfo{
name: "traits.yaml",
modTime: time.Time{},
- uncompressedSize: 68516,
+ uncompressedSize: 68535,
- compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\xfd\x77\x1b\xb9\x91\xe0\xef\xfe\x2b\xf0\xb4\xb7\x4f\x92\x8f\x1f\xf2\x64\x93\x9d\xd5\xc6\xd9\xd3\x78\x3c\x89\x32\xfe\xd0\x59\x9a\xc9\xe6\xf9\xfc\x42\xb0\x1b\x24\x61\x36\x81\x0e\x80\x96\xcc\xb9\xdc\xff\x7e\x0f\x55\x85\x8f\x6e\x36\x45\xca\x96\x66\xa3\xcd\x24\xef\x8d\x45\xb2\xbb\x50\x28\x14\x0a\x85\xfa\x74\x86\x4b\x67\x4f\x9f\x0c\x99\xe2\x2b\x71\xca\x7e\x65\x0b\x5e\x89\x27\x8c\xd5\x15\x77\x33\x6d\x56\xa7\x6c\xc6\x [...]
+ compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x7d\xfd\x77\x1b\xb9\x91\xe0\xef\xfe\x2b\xf0\xb4\xb7\x4f\x92\x8f\x1f\xf2\x64\x93\x9d\xd5\xc6\xd9\xd3\x78\x3c\x89\x32\xfe\xd0\x59\x9a\xc9\xe6\xf9\xfc\x42\xb0\x1b\x24\x61\x36\x81\x0e\x80\x96\xcc\xb9\xdc\xff\x7e\x0f\x55\x85\x8f\x6e\x36\x45\xca\x96\x66\xa3\xcd\x24\xef\x8d\x45\xb2\xbb\x50\x28\x14\x0a\x85\xfa\x74\x86\x4b\x67\x4f\x9f\x0c\x99\xe2\x2b\x71\xca\x7e\x65\x0b\x5e\x89\x27\x8c\xd5\x15\x77\x33\x6d\x56\xa7\x6c\xc6\x [...]
},
}
fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index 3e9a8c00f..c8a514208 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -19,6 +19,8 @@ package trait
import (
"fmt"
+ "path/filepath"
+ "regexp"
"sort"
"strings"
@@ -33,6 +35,8 @@ import (
"github.com/apache/camel-k/v2/pkg/util/property"
)
+var commandsRegexp = regexp.MustCompile(`"[^"]+"|[\w/-]+`)
+
type builderTrait struct {
BaseTrait
traitv1.BuilderTrait `property:",squash"`
@@ -64,12 +68,28 @@ func (t *builderTrait) Configure(e *Environment) (bool, error) {
return false, nil
}
+ if trait := e.Catalog.GetTrait(quarkusTraitID); trait != nil {
+ quarkus, ok := trait.(*quarkusTrait)
+ isNativeIntegration := quarkus.isNativeIntegration(e)
+ isNativeKit, err := quarkus.isNativeKit(e)
+ if err != nil {
+ return false, err
+ }
+ if ok && pointer.BoolDeref(quarkus.Enabled, true) && (isNativeIntegration || isNativeKit) {
+ nativeArgsCd := filepath.Join("maven", "target", "native-sources")
+ command := "cd " + nativeArgsCd + " && echo NativeImage version is $(native-image --version) && echo GraalVM expected version is $(cat graalvm.version) && echo WARN: Make sure they are compatible, otherwise the native compilation may results in error && native-image $(cat native-image.args)"
+ // it should be performed as the last custom task
+ t.Tasks = append(t.Tasks, fmt.Sprintf(`quarkus-native;%s;/bin/bash -c "%s"`, e.CamelCatalog.GetQuarkusToolingImage(), command))
+ }
+ }
+
return e.IntegrationKitInPhase(v1.IntegrationKitPhaseBuildSubmitted), nil
}
func (t *builderTrait) Apply(e *Environment) error {
// local pipeline tasks
var pipelineTasks []v1.Task
+
// Building task
builderTask, err := t.builderTask(e)
if err != nil {
@@ -81,7 +101,6 @@ func (t *builderTrait) Apply(e *Environment) error {
}
return nil
}
-
pipelineTasks = append(pipelineTasks, v1.Task{Builder: builderTask})
// Custom tasks
@@ -104,9 +123,22 @@ func (t *builderTrait) Apply(e *Environment) error {
}
return nil
}
- pipelineTasks = append(pipelineTasks, t.customTasks()...)
+
+ customTasks, err := t.customTasks()
+ if err != nil {
+ return err
+ }
+
+ pipelineTasks = append(pipelineTasks, customTasks...)
}
+ // Packaging task
+ // It's the same builder configuration, but with different steps
+ packageTask := builderTask.DeepCopy()
+ packageTask.Name = "package"
+ packageTask.Steps = make([]string, 0)
+ pipelineTasks = append(pipelineTasks, v1.Task{Package: packageTask})
+
// Publishing task
switch e.Platform.Status.Build.PublishStrategy {
case v1.IntegrationPlatformBuildPublishStrategySpectrum:
@@ -344,20 +376,42 @@ func getImageName(e *Environment) string {
return e.Platform.Status.Build.Registry.Address + "/" + organization + "/camel-k-" + e.IntegrationKit.Name + ":" + e.IntegrationKit.ResourceVersion
}
-func (t *builderTrait) customTasks() []v1.Task {
- customTasks := make([]v1.Task, len(t.Tasks))
+func (t *builderTrait) customTasks() ([]v1.Task, error) {
+ customTasks := make([]v1.Task, len(t.Tasks), len(t.Tasks))
for i, t := range t.Tasks {
- // TODO, better strategy than a simple split!
splitted := strings.Split(t, ";")
+ if len(splitted) < 3 {
+ return nil, fmt.Errorf(`You need to provide a custom task with at least 3 arguments, ie "my-task-name;my-image;echo 'hello', was %v"`, t)
+ }
+ var containerCommand string
+ if len(splitted) > 3 {
+ //recompose in case of usage of separator char in the script
+ containerCommand = strings.Join(splitted[2:], ";")
+ } else {
+ containerCommand = splitted[2]
+ }
+ containerCommands := splitContainerCommand(containerCommand)
customTasks[i] = v1.Task{
Custom: &v1.UserTask{
BaseTask: v1.BaseTask{
Name: splitted[0],
},
- ContainerImage: splitted[1],
- ContainerCommand: splitted[2],
+ ContainerImage: splitted[1],
+ ContainerCommands: containerCommands,
},
}
}
- return customTasks
+ return customTasks, nil
+}
+
+// we may get a command in the following format `/bin/bash -c "ls && echo 'hello'`
+// which should provide a string with {"/bin/bash", "-c", "ls && echo 'hello'"}
+func splitContainerCommand(command string) []string {
+ matches := commandsRegexp.FindAllString(command, -1)
+ removeQuotes := make([]string, 0, len(matches))
+ for _, m := range matches {
+ removeQuotes = append(removeQuotes, strings.Replace(m, "\"", "", -1))
+ }
+
+ return removeQuotes
}
diff --git a/pkg/trait/builder_test.go b/pkg/trait/builder_test.go
index 54151db29..9708a7485 100644
--- a/pkg/trait/builder_test.go
+++ b/pkg/trait/builder_test.go
@@ -84,9 +84,10 @@ func TestS2IBuilderTrait(t *testing.T) {
assert.NotEmpty(t, env.ExecutedTraits)
assert.NotNil(t, env.GetTrait("builder"))
assert.NotEmpty(t, env.Pipeline)
- assert.Len(t, env.Pipeline, 2)
+ assert.Len(t, env.Pipeline, 3)
assert.NotNil(t, env.Pipeline[0].Builder)
- assert.NotNil(t, env.Pipeline[1].S2i)
+ assert.NotNil(t, env.Pipeline[1].Package)
+ assert.NotNil(t, env.Pipeline[2].S2i)
}
func TestKanikoBuilderTrait(t *testing.T) {
@@ -97,9 +98,10 @@ func TestKanikoBuilderTrait(t *testing.T) {
assert.NotEmpty(t, env.ExecutedTraits)
assert.NotNil(t, env.GetTrait("builder"))
assert.NotEmpty(t, env.Pipeline)
- assert.Len(t, env.Pipeline, 2)
+ assert.Len(t, env.Pipeline, 3)
assert.NotNil(t, env.Pipeline[0].Builder)
- assert.NotNil(t, env.Pipeline[1].Kaniko)
+ assert.NotNil(t, env.Pipeline[1].Package)
+ assert.NotNil(t, env.Pipeline[2].Kaniko)
}
func createBuilderTestEnv(cluster v1.IntegrationPlatformCluster, strategy v1.IntegrationPlatformBuildPublishStrategy, buildStrategy v1.BuildStrategy) *Environment {
@@ -189,15 +191,18 @@ func TestCustomTaskBuilderTrait(t *testing.T) {
assert.Nil(t, err)
builderTask := findCustomTaskByName(env.Pipeline, "builder")
- publisherTask := findCustomTaskByName(env.Pipeline, "spectrum")
customTask := findCustomTaskByName(env.Pipeline, "test")
- assert.NotNil(t, customTask)
+ packageTask := findCustomTaskByName(env.Pipeline, "package")
+ publisherTask := findCustomTaskByName(env.Pipeline, "spectrum")
+
assert.NotNil(t, builderTask)
+ assert.NotNil(t, customTask)
+ assert.NotNil(t, packageTask)
assert.NotNil(t, publisherTask)
- assert.Equal(t, 3, len(env.Pipeline))
+ assert.Equal(t, 4, len(env.Pipeline))
assert.Equal(t, "test", customTask.Custom.Name)
assert.Equal(t, "alpine", customTask.Custom.ContainerImage)
- assert.Equal(t, "ls", customTask.Custom.ContainerCommand)
+ assert.Equal(t, "ls", customTask.Custom.ContainerCommands[0])
}
func TestCustomTaskBuilderTraitValidStrategyOverride(t *testing.T) {
@@ -210,16 +215,12 @@ func TestCustomTaskBuilderTraitValidStrategyOverride(t *testing.T) {
assert.Nil(t, err)
- builderTask := findCustomTaskByName(env.Pipeline, "builder")
- publisherTask := findCustomTaskByName(env.Pipeline, "spectrum")
customTask := findCustomTaskByName(env.Pipeline, "test")
- assert.NotNil(t, customTask)
- assert.NotNil(t, builderTask)
- assert.NotNil(t, publisherTask)
- assert.Equal(t, 3, len(env.Pipeline))
+
+ assert.Equal(t, 4, len(env.Pipeline))
assert.Equal(t, "test", customTask.Custom.Name)
assert.Equal(t, "alpine", customTask.Custom.ContainerImage)
- assert.Equal(t, "ls", customTask.Custom.ContainerCommand)
+ assert.Equal(t, "ls", customTask.Custom.ContainerCommands[0])
}
func TestCustomTaskBuilderTraitInvalidStrategy(t *testing.T) {
@@ -315,3 +316,63 @@ func TestMavenBuilderTraitJib(t *testing.T) {
},
}, env.Pipeline[0].Builder.Maven.MavenSpec.Profiles[0])
}
+
+func TestBuilderCustomTasks(t *testing.T) {
+ builderTrait := createNominalBuilderTraitTest()
+ builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine;ls")
+ builderTrait.Tasks = append(builderTrait.Tasks, `test;alpine;"mvn test"`)
+
+ tasks, err := builderTrait.customTasks()
+
+ assert.Nil(t, err)
+ assert.Equal(t, 2, len(tasks))
+ assert.Equal(t, "test", tasks[0].Custom.Name)
+ assert.Equal(t, "alpine", tasks[0].Custom.ContainerImage)
+ assert.Equal(t, "ls", tasks[0].Custom.ContainerCommands[0])
+ assert.Equal(t, "test", tasks[1].Custom.Name)
+ assert.Equal(t, "alpine", tasks[1].Custom.ContainerImage)
+ assert.Equal(t, "mvn test", tasks[1].Custom.ContainerCommands[0])
+}
+
+func TestBuilderCustomTasksFailure(t *testing.T) {
+ builderTrait := createNominalBuilderTraitTest()
+ builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine")
+
+ _, err := builderTrait.customTasks()
+
+ assert.NotNil(t, err)
+}
+
+func TestBuilderCustomTasksScript(t *testing.T) {
+ builderTrait := createNominalBuilderTraitTest()
+ builderTrait.Tasks = append(builderTrait.Tasks, "test;alpine;/bin/bash -c \"cd test && ls; echo 'helooo'\"")
+
+ tasks, err := builderTrait.customTasks()
+
+ assert.Nil(t, err)
+ assert.Equal(t, 1, len(tasks))
+ assert.Equal(t, "test", tasks[0].Custom.Name)
+ assert.Equal(t, "alpine", tasks[0].Custom.ContainerImage)
+ assert.Equal(t, "/bin/bash", tasks[0].Custom.ContainerCommands[0])
+ assert.Equal(t, "-c", tasks[0].Custom.ContainerCommands[1])
+ assert.Equal(t, "cd test && ls; echo 'helooo'", tasks[0].Custom.ContainerCommands[2])
+}
+
+func TestUserTaskCommands(t *testing.T) {
+ command := `/bin/bash -c "ls && echo 'hello' && $(cat /path/to/a/resource)"`
+ podCommands := splitContainerCommand(command)
+
+ assert.Len(t, podCommands, 3)
+ assert.Equal(t, "/bin/bash", podCommands[0])
+ assert.Equal(t, "-c", podCommands[1])
+ assert.Equal(t, "ls && echo 'hello' && $(cat /path/to/a/resource)", podCommands[2])
+}
+
+func TestUserTaskSingleCommand(t *testing.T) {
+ command := `cat /path/to/a/resource`
+ podCommands := splitContainerCommand(command)
+
+ assert.Len(t, podCommands, 2)
+ assert.Equal(t, "cat", podCommands[0])
+ assert.Equal(t, "/path/to/a/resource", podCommands[1])
+}
diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go
index 11c4fdfaf..9bec0c22a 100644
--- a/pkg/trait/quarkus.go
+++ b/pkg/trait/quarkus.go
@@ -40,8 +40,9 @@ const (
)
var kitPriority = map[traitv1.QuarkusPackageType]string{
- traitv1.FastJarPackageType: "1000",
- traitv1.NativePackageType: "2000",
+ traitv1.FastJarPackageType: "1000",
+ traitv1.NativeSourcesPackageType: "2000",
+ traitv1.NativePackageType: "2100",
}
type quarkusTrait struct {
@@ -261,7 +262,7 @@ func (t *quarkusTrait) newIntegrationKit(e *Environment, packageType traitv1.Qua
Traits: propagateKitTraits(e),
}
- if packageType == traitv1.NativePackageType {
+ if packageType == traitv1.NativePackageType || packageType == traitv1.NativeSourcesPackageType {
kit.Spec.Sources = propagateSourcesRequiredAtBuildTime(e)
}
return kit
@@ -290,21 +291,29 @@ func propagateKitTraits(e *Environment) v1.IntegrationKitTraits {
}
func (t *quarkusTrait) applyWhenBuildSubmitted(e *Environment) error {
- build := getBuilderTask(e.Pipeline)
- if build == nil {
+ buildTask := getBuilderTask(e.Pipeline)
+ if buildTask == nil {
return fmt.Errorf("unable to find builder task: %s", e.Integration.Name)
}
+ packageTask := getPackageTask(e.Pipeline)
+ if packageTask == nil {
+ return fmt.Errorf("unable to find package task: %s", e.Integration.Name)
+ }
- if build.Maven.Properties == nil {
- build.Maven.Properties = make(map[string]string)
+ buildSteps, err := builder.StepsFrom(buildTask.Steps...)
+ if err != nil {
+ return err
}
+ buildSteps = append(buildSteps, builder.Quarkus.CommonSteps...)
- steps, err := builder.StepsFrom(build.Steps...)
+ packageSteps, err := builder.StepsFrom(packageTask.Steps...)
if err != nil {
return err
}
- steps = append(steps, builder.Quarkus.CommonSteps...)
+ if buildTask.Maven.Properties == nil {
+ buildTask.Maven.Properties = make(map[string]string)
+ }
native, err := t.isNativeKit(e)
if err != nil {
@@ -312,31 +321,35 @@ func (t *quarkusTrait) applyWhenBuildSubmitted(e *Environment) error {
}
if native {
- build.Maven.Properties["quarkus.package.type"] = string(traitv1.NativePackageType)
+ buildTask.Maven.Properties["quarkus.package.type"] = string(traitv1.NativeSourcesPackageType)
if len(e.IntegrationKit.Spec.Sources) > 0 {
- build.Sources = e.IntegrationKit.Spec.Sources
- steps = append(steps, builder.Quarkus.PrepareProjectWithSources)
- }
- steps = append(steps, builder.Image.NativeImageContext)
- // Spectrum does not rely on Dockerfile to assemble the image
- if e.Platform.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategySpectrum && e.Platform.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyJib {
- steps = append(steps, builder.Image.ExecutableDockerfile)
+ buildTask.Sources = e.IntegrationKit.Spec.Sources
+ buildSteps = append(buildSteps, builder.Quarkus.PrepareProjectWithSources)
}
+ packageSteps = append(packageSteps, builder.Image.NativeImageContext)
+ // Create the dockerfile, regardless it's later used or not by the publish strategy
+ packageSteps = append(packageSteps, builder.Image.ExecutableDockerfile)
} else {
- build.Maven.Properties["quarkus.package.type"] = string(traitv1.FastJarPackageType)
- steps = append(steps, builder.Quarkus.ComputeQuarkusDependencies, builder.Image.IncrementalImageContext)
- // Spectrum does not rely on Dockerfile to assemble the image
- if e.Platform.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategySpectrum && e.Platform.Status.Build.PublishStrategy != v1.IntegrationPlatformBuildPublishStrategyJib {
- steps = append(steps, builder.Image.JvmDockerfile)
- }
+ // Default, if nothing is specified
+ buildTask.Maven.Properties["quarkus.package.type"] = string(traitv1.FastJarPackageType)
+ packageSteps = append(packageSteps, builder.Quarkus.ComputeQuarkusDependencies)
+ // The LoadCamelQuarkusCatalog is required to have catalog information available by the builder
+ packageSteps = append(packageSteps, builder.Quarkus.LoadCamelQuarkusCatalog)
+ packageSteps = append(packageSteps, builder.Image.IncrementalImageContext)
+ // Create the dockerfile, regardless it's later used or not by the publish strategy
+ packageSteps = append(packageSteps, builder.Image.JvmDockerfile)
}
// Sort steps by phase
- sort.SliceStable(steps, func(i, j int) bool {
- return steps[i].Phase() < steps[j].Phase()
+ sort.SliceStable(buildSteps, func(i, j int) bool {
+ return buildSteps[i].Phase() < buildSteps[j].Phase()
+ })
+ sort.SliceStable(packageSteps, func(i, j int) bool {
+ return packageSteps[i].Phase() < packageSteps[j].Phase()
})
- build.Steps = builder.StepIDsFor(steps...)
+ buildTask.Steps = builder.StepIDsFor(buildSteps...)
+ packageTask.Steps = builder.StepIDsFor(packageSteps...)
return nil
}
@@ -346,7 +359,7 @@ func (t *quarkusTrait) isNativeKit(e *Environment) (bool, error) {
case 0:
return false, nil
case 1:
- return types[0] == traitv1.NativePackageType, nil
+ return types[0] == traitv1.NativePackageType || types[0] == traitv1.NativeSourcesPackageType, nil
default:
return false, fmt.Errorf("kit %q has more than one package type", e.IntegrationKit.Name)
}
diff --git a/pkg/trait/quarkus_test.go b/pkg/trait/quarkus_test.go
index 3b4ab5de2..331eb8c13 100644
--- a/pkg/trait/quarkus_test.go
+++ b/pkg/trait/quarkus_test.go
@@ -43,8 +43,11 @@ func TestConfigureQuarkusTraitBuildSubmitted(t *testing.T) {
build := getBuilderTask(environment.Pipeline)
assert.NotNil(t, t, build)
+ assert.Len(t, build.Steps, len(builder.Quarkus.CommonSteps))
- assert.Len(t, build.Steps, len(builder.Quarkus.CommonSteps)+3)
+ packageTask := getPackageTask(environment.Pipeline)
+ assert.NotNil(t, t, packageTask)
+ assert.Len(t, packageTask.Steps, 4)
}
func TestConfigureDisabledQuarkusTraitShouldFail(t *testing.T) {
@@ -109,6 +112,9 @@ func createNominalQuarkusTest() (*quarkusTrait, *Environment) {
{
Builder: &v1.BuilderTask{},
},
+ {
+ Package: &v1.BuilderTask{},
+ },
},
Platform: &v1.IntegrationPlatform{},
}
diff --git a/pkg/trait/util.go b/pkg/trait/util.go
index 0f5f89de1..e047576eb 100644
--- a/pkg/trait/util.go
+++ b/pkg/trait/util.go
@@ -340,6 +340,15 @@ func getBuilderTask(tasks []v1.Task) *v1.BuilderTask {
return nil
}
+func getPackageTask(tasks []v1.Task) *v1.BuilderTask {
+ for i, task := range tasks {
+ if task.Package != nil {
+ return tasks[i].Package
+ }
+ }
+ return nil
+}
+
// Equals return if traits are the same.
func Equals(i1 Options, i2 Options) bool {
return reflect.DeepEqual(i1, i2)
diff --git a/resources/traits.yaml b/resources/traits.yaml
index 5145f1520..20d9e9e19 100755
--- a/resources/traits.yaml
+++ b/resources/traits.yaml
@@ -1304,10 +1304,10 @@ traits:
- Knative
- OpenShift
description: 'The Quarkus trait configures the Quarkus runtime. It''s enabled by
- default. NOTE: Compiling to a native executable, i.e. when using `package-type=native`,
- requires at least 4GiB of memory, so the Pod running the native build, that is
- either the operator Pod, or the build Pod (depending on the build strategy configured
- for the platform), must have enough memory available.'
+ default. NOTE: A native based compilation will be forced to use a `pod` build
+ strategy. Compiling to a native executable, i.e. when using `package-type=native`,
+ requires at least 4GiB of memory, so the Pod running the native build, must have
+ enough memory available.'
properties:
- name: enabled
type: bool
@@ -1315,12 +1315,13 @@ traits:
property.
- name: package-type
type: '[]github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait.QuarkusPackageType'
- description: The Quarkus package types, either `fast-jar` or `native` (default
- `fast-jar`). In case both `fast-jar` and `native` are specified, two `IntegrationKit`
- resources are created, with the `native` kit having precedence over the `fast-jar`
- one once ready. The order influences the resolution of the current kit for the
- integration. The kit corresponding to the first package type will be assigned
- to the integration in case no existing kit that matches the integration exists.
+ description: The Quarkus package types, `fast-jar`, `native-sources` or `native`
+ (default `fast-jar`). `native` is deprecated. In case both `fast-jar` and `native`
+ or `native-sources` are specified, two `IntegrationKit` resources are created,
+ with the native kit having precedence over the `fast-jar` one once ready. The
+ order influences the resolution of the current kit for the integration. The
+ kit corresponding to the first package type will be assigned to the integration
+ in case no existing kit that matches the integration exists.
- name: registry
platform: false
profiles: