wmedvede commented on code in PR #710:
URL:
https://github.com/apache/incubator-kie-kogito-docs/pull/710#discussion_r1995324050
##########
serverlessworkflow/modules/ROOT/pages/cloud/config-maven.adoc:
##########
@@ -0,0 +1,115 @@
+// Note: This section can grow over time to add more Maven-related
configuration and guides
+= Adding a custom Maven Mirror to {product_name} images
+:compat-mode!:
+// Metadata:
+:description: Adding a custom maven mirror to images
+:keywords: maven, mirror, central, sonatype
+// links
+:maven_mirror_guide:
https://maven.apache.org/guides/mini/guide-mirror-settings.html
+
+This document describes how to configure the internal Maven settings on
{product_name} images so that the maven process can access a custom mirror
registry.
+
+By default either the {product_name} Builder and Devmode images have all the
required Java libraries to run. In some scenarios, such as adding a custom
Quarkus Extension, the internal system will require to
+access the Maven Central registry.
+
+In case you are running under restricted network access, you may point the
container to access an internal mirror instead. See more information about this
procedure on the link:{maven_mirror_guide}[Guide to Mirror Settings] on the
Maven documentation.
+
+== Configuring the Maven Mirror on the Operator
+
+=== Adding a Maven Mirror when building workflows
+
+You may edit either the `SonataFlowBuild` or `SonataFlowPlatform` custom
resources and add the variable `MAVEN_MIRROR_URL`.
+
+.Maven Mirror configuration example on SonataFlowBuild
+[source,yaml,subs="attributes+"]
+----
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlowBuild
+metadata:
+ name: my-workflow
+spec:
+ # supreessed for brevity
+ envs:
+ - name: MAVEN_MIRROR_URL
+ value: http://my.company.registry.local
+----
+
+Changing the `SonataFlowBuild` it will only impact the given workflow instance
it represents. In this case, a workflow instance in the same namespace with the
name `my-workflow`.
+
+To change the Maven mirror for all build instances for the `preview` profile,
you have to change the given `SonataFlowPlatform` within the same namespace.
+
+.Maven Mirror configuration example on SonataFlowPlatform
+[source,yaml,subs="attributes+"]
+----
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlowPlatform
Review Comment:
With SFP like this:
```
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowPlatform
metadata:
name: sonataflow-platform
spec:
services:
dataIndex:
enabled: true
jobService:
enabled: true
build:
template:
envs:
- name: MAVEN_MIRROR_URL
value: http://my.company.registry.local
```
We can see the generated build working as expected, i.e., I picked-up the
mirror configuration:

##########
serverlessworkflow/modules/ROOT/pages/cloud/config-maven.adoc:
##########
@@ -0,0 +1,115 @@
+// Note: This section can grow over time to add more Maven-related
configuration and guides
+= Adding a custom Maven Mirror to {product_name} images
+:compat-mode!:
+// Metadata:
+:description: Adding a custom maven mirror to images
+:keywords: maven, mirror, central, sonatype
+// links
+:maven_mirror_guide:
https://maven.apache.org/guides/mini/guide-mirror-settings.html
+
+This document describes how to configure the internal Maven settings on
{product_name} images so that the maven process can access a custom mirror
registry.
+
+By default either the {product_name} Builder and Devmode images have all the
required Java libraries to run. In some scenarios, such as adding a custom
Quarkus Extension, the internal system will require to
+access the Maven Central registry.
+
+In case you are running under restricted network access, you may point the
container to access an internal mirror instead. See more information about this
procedure on the link:{maven_mirror_guide}[Guide to Mirror Settings] on the
Maven documentation.
+
+== Configuring the Maven Mirror on the Operator
+
+=== Adding a Maven Mirror when building workflows
+
+You may edit either the `SonataFlowBuild` or `SonataFlowPlatform` custom
resources and add the variable `MAVEN_MIRROR_URL`.
+
+.Maven Mirror configuration example on SonataFlowBuild
+[source,yaml,subs="attributes+"]
+----
+apiVersion: sonataflow.org/v1alpha08
Review Comment:
I'm not sure this variant is 100% recommendable.
Note that the SonataFlowBuild is created by the recon cycle, so I think
potential changes here might be overridden at any moment? I wasn't here at the
time the build process was designed, maybe it's not overridden by design, and
if a build exists, that build will be picked-up intentionally (see Use case 2
below), IDK this part, or maybe it can be overridden in the future.
**Use case 1:**
1. created a SonataFlow
2. I let the regular build to finish
3. I have got locally the automatically generated SonataFlowBuild.
4. I have modified that SonataFlowBuild
```
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowBuild
metadata:
name: greet2
namespace: test
spec:
envs:
- name: MAVEN_MIRROR_URL
value: http://my.company.registry.local
```
I have applied the modification, oc apply -f the_build.yaml
With the following results:
1. No new build is started
2. If I start a new build using the existing OpenShift BuildConfig
3. The modifications in the SFB are not picked up, since the OpenShift
BuildConfig was generated before.
So in this flow, the modifications are not picked-up
**Use Case 2:**
1. I create the modifyed my_build.yaml **before deploying** the SonataFlow,
since we know what the generated SonataFlowBuild name will be.
```
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowBuild
metadata:
name: greet2
namespace: test
spec:
envs:
- name: MAVEN_MIRROR_URL
value: http://my.company.registry.local
```
In the operator logs we can see these errors:
`E0314 09:55:57.361511 1 controller.go:316] "msg"="Reconciler error"
"error"="SonataFlow.sonataflow.org \"greet2\" not found"
"SonataFlowBuild"={"name":"greet2","namespace":"test"}
"controller"="sonataflowbuild" "controllerGroup"="sonataflow.org"
"controllerKind"="SonataFlowBuild" "logger"="sonataflow-manager"
"name"="greet2" "namespace"="test"
"reconcileID"="0185c1b2-974f-4d5d-ab93-d2ef969afc46"`
and of course, no OpenShift build is created, etc.
2) ok, now we deploy the SonataFlow. But no build is started immediately. We
can see the workflow status like this:
```
NAME PROFILE VERSION URL READY REASON
apiVersion: sonataflow.org/v1alpha08
greet2 preview 1.0 False WaitingForBuild
```
3) After some time, on new recon cycle it looks like the like the existing
build is picked up, and an OpenShit build starts.
In the build logs we can see:

So, it looks like the mirror configuration was picked up.
In that particular configuration build won't work well, I'm using a fake
mirror, but it in the presence of a real mirror, it's expected that the build
will finish successfully.
**Open questions:** IDK if this existing SonataFlowBuild is potentially
merged with build template configurations that could exist in the existing
SonataFlowPlatform if any? (if an existing SFB has precedence I'd expect that
no)
**Conclusion:** If the existing build is picked-up by design and not
overridden, I'd suggest explaining a bit more detailed the sequence on how to
make "Use case 2" work.
"Use case 1" is not working, if it's expected to do, will definitively need
some love.
##########
serverlessworkflow/modules/ROOT/pages/cloud/config-maven.adoc:
##########
@@ -0,0 +1,115 @@
+// Note: This section can grow over time to add more Maven-related
configuration and guides
+= Adding a custom Maven Mirror to {product_name} images
+:compat-mode!:
+// Metadata:
+:description: Adding a custom maven mirror to images
+:keywords: maven, mirror, central, sonatype
+// links
+:maven_mirror_guide:
https://maven.apache.org/guides/mini/guide-mirror-settings.html
+
+This document describes how to configure the internal Maven settings on
{product_name} images so that the maven process can access a custom mirror
registry.
+
+By default either the {product_name} Builder and Devmode images have all the
required Java libraries to run. In some scenarios, such as adding a custom
Quarkus Extension, the internal system will require to
+access the Maven Central registry.
+
+In case you are running under restricted network access, you may point the
container to access an internal mirror instead. See more information about this
procedure on the link:{maven_mirror_guide}[Guide to Mirror Settings] on the
Maven documentation.
+
+== Configuring the Maven Mirror on the Operator
+
+=== Adding a Maven Mirror when building workflows
+
+You may edit either the `SonataFlowBuild` or `SonataFlowPlatform` custom
resources and add the variable `MAVEN_MIRROR_URL`.
+
+.Maven Mirror configuration example on SonataFlowBuild
+[source,yaml,subs="attributes+"]
+----
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlowBuild
+metadata:
+ name: my-workflow
+spec:
+ # supreessed for brevity
+ envs:
+ - name: MAVEN_MIRROR_URL
+ value: http://my.company.registry.local
+----
+
+Changing the `SonataFlowBuild` it will only impact the given workflow instance
it represents. In this case, a workflow instance in the same namespace with the
name `my-workflow`.
+
+To change the Maven mirror for all build instances for the `preview` profile,
you have to change the given `SonataFlowPlatform` within the same namespace.
+
+.Maven Mirror configuration example on SonataFlowPlatform
+[source,yaml,subs="attributes+"]
+----
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlowPlatform
+metadata:
+ name: my-platform
+spec:
+ build:
+ template:
+ envs:
+ - name: MAVEN_MIRROR_URL
+ value: http://my.company.registry.local
+----
+
+When a workflow builder instance runs, it will use this information to
configure the internal Maven settings file to use this URL as the default
mirror to external locations, such as the Maven Central repository.
+
+For more information about building workflows with the operator see
xref:cloud/operator/build-and-deploy-workflows.adoc[].
+
+=== Adding a Maven Mirror when deploying on Development Mode
+
+When deploying workflows in `devmode`, you may also add the Maven Mirror to
the `SonataFlow` custom resource.
+
+.Maven Mirror configuration example on SonataFlow
+[source,yaml,subs="attributes+"]
+----
+apiVersion: sonataflow.org/v1alpha08
+kind: SonataFlow
+metadata:
+ name: greeting
+ annotations:
+ sonataflow.org/description: Greeting example on k8s!
+ sonataflow.org/version: 0.0.1
+ sonataflow.org/profile: dev
+spec:
+ podTemplate:
+ container:
+ envs:
Review Comment:
Couple of considerations here:
I think the configuration for this case should be using the **env** field
and not **envs**, still see my comments below:
**Configuration using envs**
I have used a configuration using **envs**
In the generated POD, I can see this:

:point_up: It looks like no environment parameters were passed to the POD
The POD starts as expected, etc., and looks to be working fine, see log
here: https://gist.github.com/wmedvede/593fac2ed15e9a72a9b57e89bb46b987
**Configuration using env**
My workflow is like this:
```
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlow
metadata:
name: greet
annotations:
sonataflow.org/description: YAML based greeting workflow
sonataflow.org/version: '1.0'
sonataflow.org/expressionLang: jsonpath
sonataflow.org/profile: dev
spec:
podTemplate:
container:
env:
- name: MAVEN_MIRROR_URL
value: http://my.company.registry.local
```
In the generated POD, I can see this:

:point_up: Good!, the POD has the expected env var.
The pod starts and works like expected, see logs here:
https://gist.github.com/wmedvede/c983bec2d0135749479c362ac3f082c5
**Howerver I'd expect and error, since we have configured a fake mirror
http://my.company.registry.local**
Looks like this is not working well, or I'm doing something wrong.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]