Skip to content

Commit

Permalink
feat: Quarkus native source
Browse files Browse the repository at this point in the history
* 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 apache#4648
  • Loading branch information
squakez committed Oct 4, 2023
1 parent dc25083 commit da6b735
Show file tree
Hide file tree
Showing 33 changed files with 1,566 additions and 281 deletions.
513 changes: 508 additions & 5 deletions config/crd/bases/camel.apache.org_builds.yaml

Large diffs are not rendered by default.

22 changes: 12 additions & 10 deletions config/crd/bases/camel.apache.org_integrationkits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 24 additions & 20 deletions config/crd/bases/camel.apache.org_integrationplatforms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 12 additions & 10 deletions config/crd/bases/camel.apache.org_integrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 13 additions & 10 deletions config/crd/bases/camel.apache.org_kameletbindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 13 additions & 10 deletions config/crd/bases/camel.apache.org_pipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 to influence the behavior of the build (ie, adding any plugin or configuration you can use when xref:pipeline/pipeline.adoc[running a pipeline]).
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 influence the behavior of the build (ie, adding any plugin or configuration you can use when xref:pipeline/pipeline.adoc[running a pipeline]).

[[publish-strategy]]
== Publish strategy
Expand Down
46 changes: 31 additions & 15 deletions docs/modules/ROOT/partials/apis/camel-k-crds.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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]*
Expand Down Expand Up @@ -5191,13 +5206,6 @@ a S2iTask, for S2I strategy
a JibTask, for Jib strategy
|`custom` +
*xref:#_camel_apache_org_v1_UserTask[UserTask]*
|
|===
Expand Down Expand Up @@ -5625,6 +5633,14 @@ string
|
the command to execute
Deprecated: use ContainerCommands
|`commands` +
[]string
|
the command to execute
Expand Down Expand Up @@ -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]
Expand All @@ -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"]
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions docs/modules/traits/pages/quarkus.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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**.
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit da6b735

Please sign in to comment.