fantonangeli commented on code in PR #2573:
URL: 
https://github.com/apache/incubator-kie-tools/pull/2573#discussion_r1753355983


##########
packages/sonataflow-management-console-image/package.json:
##########
@@ -15,6 +15,10 @@
   "scripts": {
     "build:dev": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && run-script-if --bool \"$(build-env containerImages.build)\" 
--then \"pnpm image:docker:build\"",
     "build:prod": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && run-script-if --bool \"$(build-env containerImages.build)\" 
--then \"pnpm image:docker:build\"",
+    "cekit:build": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && cekit:copy && pnpm cekit:setup:env && make -C ./dist-dev build",
+    "cekit:copy": "run-script-os",
+    "cekit:copy:linux:darwin": "rimraf dist-dev && cp -R 
./node_modules/@kie-tools/sonataflow-image-common/resources ./dist-dev/ && cp 
-R resources/* ./dist-dev/",

Review Comment:
   Do we miss `cekit:copy:linux:win32`, even just an `echo` for consistency?
   ie: 
https://github.com/apache/incubator-kie-tools/blob/7b1cb0392c725b02263317b2db60404ab953f431/packages/serverless-logic-web-tools-base-builder-image/package.json#L19



##########
packages/sonataflow-management-console-image/package.json:
##########
@@ -15,6 +15,10 @@
   "scripts": {
     "build:dev": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && run-script-if --bool \"$(build-env containerImages.build)\" 
--then \"pnpm image:docker:build\"",
     "build:prod": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && run-script-if --bool \"$(build-env containerImages.build)\" 
--then \"pnpm image:docker:build\"",
+    "cekit:build": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && cekit:copy && pnpm cekit:setup:env && make -C ./dist-dev build",
+    "cekit:copy": "run-script-os",
+    "cekit:copy:linux:darwin": "rimraf dist-dev && cp -R 
./node_modules/@kie-tools/sonataflow-image-common/resources ./dist-dev/ && cp 
-R resources/* ./dist-dev/",

Review Comment:
   `rimraf` was deleting the build of the previous commands, and the first `cp 
-R` was copying a dir inside `dist-dev`
   ```suggestion
       "cekit:copy:linux:darwin": "cp -R 
./node_modules/@kie-tools/sonataflow-image-common/resources/* ./dist-dev/ && cp 
-R resources/* ./dist-dev/",
   ```



##########
packages/sonataflow-management-console-image/resources/incubator-kie-sonataflow-management-console-image.yaml:
##########
@@ -0,0 +1,56 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+- name: "docker.io/apache/incubator-kie-sonataflow-devmode"
+  from: "registry.access.redhat.com/ubi9/httpd-24:1-336.1725850633"
+  version: "0.0.0"
+  description: "SonataFlow Management Console Image"
+
+  labels:
+    - name: "io.quarkus.platform.version"
+      value: "### SET ME DURING BUILD PROCESS ###"
+    - name: "org.kie.kogito.version"
+      value: "### SET ME DURING BUILD PROCESS ###"
+    - name: "maintainer"
+      value: "Apache KIE <[email protected]>"
+    - name: "io.k8s.description"
+      value: "SonataFlow Management Console Image."
+    - name: "io.k8s.display-name"
+      value: "Sonataflow Management Console"
+    - name: "io.openshift.tags"
+      value: "sonataflow,serverless,workflow"
+    - name: "io.openshift.expose-services"
+      value: "$KOGITO_MANAGEMENT_CONSOLE_PORT:http"

Review Comment:
   ```suggestion
         value: "$SONATAFLOW_MANAGEMENT_CONSOLE_PORT:http"
   ```



##########
packages/sonataflow-management-console-image/resources/modules/sonataflow/management-console/module.yaml:
##########
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+schema_version: 1
+name: org.kie.sonataflow.management.console
+version: "0.0.0"
+description: "SonataFlow Management Console Launch Scripts and Configurations"
+
+execute:
+  - script: configure-httpd.sh
+
+artifacts:
+  - name: management-console-app

Review Comment:
   I get this error but IDK what should be the path:
   `2024-09-11 13:19:01,133 resource.py:229        INFO  Copying resource 
'management-console-app'...
   2024-09-11 13:19:01,133 resource.py:254        WARNING Cekit is not able to 
fetch resource 'management-console-app' automatically. Please use cekit-cache 
command to add this artifact manually.
   2024-09-11 13:19:01,134 cli.py:544        ERROR Error copying resource: 
'management-console-app'. See logs for more info.`



##########
packages/sonataflow-management-console-image/resources/modules/sonataflow/management-console/configure-httpd.sh:
##########
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+set -e
+
+SOURCES_DIR=/tmp/artifacts
+SCRIPT_DIR=$(dirname "${0}")
+MGMT_CONSOLE_HOME="${KOGITO_HOME}/management-console"
+
+# Configure the default httpd conf
+echo "Mutex posixsem" >> "${HTTPD_MAIN_CONF_PATH}/httpd.conf"
+sed -i -e "/#ServerName www.example.com:80/aHeader set Content-Security-Policy 
\"frame-ancestors 'self';\"" "${HTTPD_MAIN_CONF_PATH}/httpd.conf"
+sed -i -e 's/Options Indexes FollowSymLinks/Options -Indexes +FollowSymLinks/' 
"${HTTPD_MAIN_CONF_PATH}/httpd.conf"
+sed -i "s/Listen 80/Listen ${KOGITO_MANAGEMENT_CONSOLE_PORT}/g" 
"${HTTPD_MAIN_CONF_PATH}/httpd.conf"
+sed -i "s/#ServerName www.example.com:80/ServerName 
127.0.0.1:${KOGITO_MANAGEMENT_CONSOLE_PORT}/g" 
"${HTTPD_MAIN_CONF_PATH}/httpd.conf"

Review Comment:
   in this package we use `SONATAFLOW_MANAGEMENT_CONSOLE_PORT` instead 
`KOGITO_MANAGEMENT_CONSOLE_PORT`
   ```suggestion
   sed -i "s/Listen 80/Listen ${SONATAFLOW_MANAGEMENT_CONSOLE_PORT}/g" 
"${HTTPD_MAIN_CONF_PATH}/httpd.conf"
   sed -i "s/#ServerName www.example.com:80/ServerName 
127.0.0.1:${SONATAFLOW_MANAGEMENT_CONSOLE_PORT}/g" 
"${HTTPD_MAIN_CONF_PATH}/httpd.conf"
   ```



##########
packages/sonataflow-management-console-image/package.json:
##########
@@ -15,6 +15,10 @@
   "scripts": {
     "build:dev": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && run-script-if --bool \"$(build-env containerImages.build)\" 
--then \"pnpm image:docker:build\"",
     "build:prod": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && run-script-if --bool \"$(build-env containerImages.build)\" 
--then \"pnpm image:docker:build\"",
+    "cekit:build": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && cekit:copy && pnpm cekit:setup:env && make -C ./dist-dev build",

Review Comment:
   make was not receiving env vars
   ```suggestion
       "cekit:build": "pnpm cleanup && pnpm env-json:schema:generate && pnpm 
copy:assets && pnpm cekit:copy && pnpm cekit:setup:env make -C ./dist-dev 
build",
   ```



##########
packages/sonataflow-management-console-image/resources/incubator-kie-sonataflow-management-console-image.yaml:
##########
@@ -0,0 +1,56 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+- name: "docker.io/apache/incubator-kie-sonataflow-devmode"
+  from: "registry.access.redhat.com/ubi9/httpd-24:1-336.1725850633"
+  version: "0.0.0"
+  description: "SonataFlow Management Console Image"
+
+  labels:
+    - name: "io.quarkus.platform.version"
+      value: "### SET ME DURING BUILD PROCESS ###"
+    - name: "org.kie.kogito.version"
+      value: "### SET ME DURING BUILD PROCESS ###"
+    - name: "maintainer"
+      value: "Apache KIE <[email protected]>"
+    - name: "io.k8s.description"
+      value: "SonataFlow Management Console Image."
+    - name: "io.k8s.display-name"
+      value: "Sonataflow Management Console"
+    - name: "io.openshift.tags"
+      value: "sonataflow,serverless,workflow"
+    - name: "io.openshift.expose-services"
+      value: "$KOGITO_MANAGEMENT_CONSOLE_PORT:http"
+
+  modules:
+    repositories:
+      - path: modules
+    install:
+      - name: org.kie.kogito.system.user
+      - name: org.kie.kogito.logging
+      - name: org.kie.kogito.project.versions
+      - name: org.kie.sonataflow.management.console
+
+  ports:
+    - value: $KOGITO_MANAGEMENT_CONSOLE_PORT

Review Comment:
   it doesn't seems to me that it really takes the env var here. If I hard code 
`8080` I don't have the message:
   `["Value 'SONATAFLOW_MANAGEMENT_CONSOLE_PORT' is not of type 'int'. Path: 
'/value'"]`
    
   ```suggestion
       - value: $SONATAFLOW_MANAGEMENT_CONSOLE_PORT
   ```



-- 
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]

Reply via email to