From c69116f0b3369898113451e01278cb2e350a9caf Mon Sep 17 00:00:00 2001
From: Guilherme Caponetto <638737+caponetto@users.noreply.github.com>
Date: Thu, 25 Apr 2024 15:55:19 -0300
Subject: [PATCH] Minor fixes to SLWT container images
---
.../Containerfile | 2 +-
.../package.json | 8 +++++---
.../src/editor/hooks/useDeployDropdownItems.tsx | 6 ++----
.../deploy/strategies/KogitoProjectDeployment.ts | 2 +-
.../dropdown/OpenShiftDeploymentDropdownItem.tsx | 4 ++--
.../src/openshift/swfDevMode/DevModeConstants.ts | 2 +-
packages/sonataflow-deployment-webapp/README.md | 6 +++---
packages/sonataflow-deployment-webapp/pom.xml | 8 ++++----
pnpm-lock.yaml | 3 +++
repo/graph.dot | 1 +
repo/graph.json | 5 +++++
11 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/packages/serverless-logic-web-tools-swf-builder-image/Containerfile b/packages/serverless-logic-web-tools-swf-builder-image/Containerfile
index a88d528f7c7..bc454086b22 100644
--- a/packages/serverless-logic-web-tools-swf-builder-image/Containerfile
+++ b/packages/serverless-logic-web-tools-swf-builder-image/Containerfile
@@ -26,6 +26,6 @@ COPY dist-dev/webapp/ src/main/resources/META-INF/resources/
RUN rm .dockerignore .gitignore README.md \
&& rm -rf .mvn/ src/main/java/ \
&& mvn quarkus:add-extension -Dextensions="quarkus-jsonp,quarkus-smallrye-openapi,quarkus-resteasy,smallrye-health" \
- && echo -e '\nquarkus.http.enable-compression=true\nquarkus.swagger-ui.always-include=true\nquarkus.http.host=0.0.0.0\nquarkus.http.cors=true\nquarkus.http.cors.origins=*' >> src/main/resources/application.properties \
+ && echo -e '\nquarkus.http.enable-compression=true\nquarkus.swagger-ui.always-include=true\nquarkus.http.host=0.0.0.0\nquarkus.http.cors=true\nquarkus.http.cors.origins=*\nkogito.service.url=http://localhost:8080' >> src/main/resources/application.properties \
&& mvn clean package -B -ntp \
&& rm -rf target/
diff --git a/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json b/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json
index 3d8425a8d37..30f229432da 100644
--- a/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json
+++ b/packages/serverless-logic-web-tools-swf-dev-mode-image/package.json
@@ -19,8 +19,9 @@
"build:prod:linux": "run-script-if --bool \"$(build-env containerImages.build)\" --then \"pnpm copy:assets\" \"pnpm image:podman:build\"",
"build:prod:win32": "echo \"Build not supported on Windows\"",
"cleanup": "rimraf dist-dev && mkdir dist-dev",
- "copy:assets": "pnpm copy:serverless-logic-web-tools-swf-deployment-quarkus-app",
- "copy:serverless-logic-web-tools-swf-deployment-quarkus-app": "cp -R ./node_modules/@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app/ ./dist-dev/serverless-logic-web-tools-swf-deployment-quarkus-app",
+ "copy:assets": "pnpm copy:serverless-logic-web-tools-swf-deployment-quarkus-app && pnpm copy:sonataflow-deployment-webapp",
+ "copy:serverless-logic-web-tools-swf-deployment-quarkus-app": "cp -R ./node_modules/@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app/ ./dist-dev/serverless-logic-web-tools-swf-deployment-quarkus-app && mkdir -p ./dist-dev/serverless-logic-web-tools-swf-deployment-quarkus-app/src/main/resources/META-INF/resources/",
+ "copy:sonataflow-deployment-webapp": "cp -R ./node_modules/sonataflow-deployment-webapp/dist/* ./dist-dev/serverless-logic-web-tools-swf-deployment-quarkus-app/src/main/resources/META-INF/resources",
"image:docker:build": "run-script-if --bool $([ $(command -v docker) ] && echo true || echo false) --then \"docker build --ulimit nofile=5000:5000 $(echo $(build-env swfDevModeImage.buildTags) | xargs printf -- \"-t $(build-env swfDevModeImageEnv.registry)/$(build-env swfDevModeImageEnv.account)/$(build-env swfDevModeImageEnv.name):%s\n\" | xargs echo) --build-arg KOGITO_IMAGE_TAG=$(build-env swfDevModeImage.kogitoImageTag) .\" --else \"echo Docker not found, skipping image build.\"",
"image:podman:build": "run-script-if --bool $([ $(command -v podman) ] && echo true || echo false) --then \"podman build --ulimit nofile=5000:5000 $(echo $(build-env swfDevModeImage.buildTags) | xargs printf -- \"-t $(build-env swfDevModeImageEnv.registry)/$(build-env swfDevModeImageEnv.account)/$(build-env swfDevModeImageEnv.name):%s\n\" | xargs echo) --build-arg KOGITO_IMAGE_TAG=$(build-env swfDevModeImage.kogitoImageTag) -f Containerfile\" --else \"echo Podman not found, skipping image build.\""
},
@@ -29,6 +30,7 @@
"@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app": "workspace:*",
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env": "workspace:*",
"rimraf": "^3.0.2",
- "run-script-os": "^1.1.6"
+ "run-script-os": "^1.1.6",
+ "sonataflow-deployment-webapp": "workspace:*"
}
}
\ No newline at end of file
diff --git a/packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx b/packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx
index 88b991e6aec..3ae57de0182 100644
--- a/packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx
+++ b/packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx
@@ -106,9 +106,7 @@ export function useDeployDropdownItems(props: Props) {
data-testid="alert-dev-mode-ready"
actionClose={}
actionLinks={
- window.open(routeUrl, "_blank")}>
- {"Go to Serverless Workflow Dev UI ↗"}
-
+ window.open(routeUrl, "_blank")}>{"Go to Dev Mode ↗"}
}
>
<>
@@ -236,7 +234,7 @@ export function useDeployDropdownItems(props: Props) {
return;
}
uploadToDevModeSuccessAlert.close();
- devModeReadyAlert.show({ routeUrl: devMode.endpoints!.swfDevUi, filePaths: result.uploadedPaths });
+ devModeReadyAlert.show({ routeUrl: devMode.endpoints!.base, filePaths: result.uploadedPaths });
window.clearInterval(fetchDevModeDeploymentTask);
}, FETCH_DEV_MODE_DEPLOYMENT_POLLING_TIME);
} else {
diff --git a/packages/serverless-logic-web-tools/src/openshift/deploy/strategies/KogitoProjectDeployment.ts b/packages/serverless-logic-web-tools/src/openshift/deploy/strategies/KogitoProjectDeployment.ts
index f831e2cc92f..e2417520278 100644
--- a/packages/serverless-logic-web-tools/src/openshift/deploy/strategies/KogitoProjectDeployment.ts
+++ b/packages/serverless-logic-web-tools/src/openshift/deploy/strategies/KogitoProjectDeployment.ts
@@ -69,7 +69,7 @@ export class KogitoProjectDeployment extends DeploymentStrategy {
importBaseImage: `FROM ${BaseBuilder.CONTAINER_IMAGE}`,
setupEnvVars: `ENV ${BaseBuilder.ENV}`,
createProjectFolder: `RUN mkdir ${projectPaths.folders.root}/`,
- copyFilesIntoContainer: `COPY . ${projectPaths.folders.root}/`,
+ copyFilesIntoContainer: `COPY --chown=kogito:root . ${projectPaths.folders.root}/`,
configCluster: {
setServer: `${BaseBuilder.KUBECTL_PATH} config set-cluster ${clusterName} --server=${this.args.openShiftConnection.host}`,
setCredentials: `${BaseBuilder.KUBECTL_PATH} config set-credentials ${clusterCredentialsName} --token=${this.args.openShiftConnection.token}`,
diff --git a/packages/serverless-logic-web-tools/src/openshift/dropdown/OpenShiftDeploymentDropdownItem.tsx b/packages/serverless-logic-web-tools/src/openshift/dropdown/OpenShiftDeploymentDropdownItem.tsx
index 4458befeafe..fbb1f72b03c 100644
--- a/packages/serverless-logic-web-tools/src/openshift/dropdown/OpenShiftDeploymentDropdownItem.tsx
+++ b/packages/serverless-logic-web-tools/src/openshift/dropdown/OpenShiftDeploymentDropdownItem.tsx
@@ -67,8 +67,8 @@ export function OpenShiftDeploymentDropdownItem(props: Props) {
const onDeploymentClicked = useCallback(() => {
const endpoints = buildEndpoints(props.deployment.routeUrl);
- window.open(props.deployment.devMode ? endpoints.swfDevUi : endpoints.base, "_blank");
- }, [props.deployment.devMode, props.deployment.routeUrl]);
+ window.open(endpoints.base, "_blank");
+ }, [props.deployment.routeUrl]);
const onRestoreClicked = useCallback(async () => {
if (isRestoring) {
diff --git a/packages/serverless-logic-web-tools/src/openshift/swfDevMode/DevModeConstants.ts b/packages/serverless-logic-web-tools/src/openshift/swfDevMode/DevModeConstants.ts
index a3f6427ac21..5e5cec51f04 100644
--- a/packages/serverless-logic-web-tools/src/openshift/swfDevMode/DevModeConstants.ts
+++ b/packages/serverless-logic-web-tools/src/openshift/swfDevMode/DevModeConstants.ts
@@ -76,7 +76,7 @@ export const buildEndpoints = (routeUrl: string): DevModeEndpoints => ({
base: routeUrl,
upload: `${routeUrl}/upload`,
quarkusDevUi: `${routeUrl}/q/dev`,
- swfDevUi: `${routeUrl}/q/dev/org.kie.kogito.kogito-quarkus-serverless-workflow-devui/workflowInstances`,
+ swfDevUi: `${routeUrl}/q/dev-ui/org.apache.kie.sonataflow.sonataflow-quarkus-devui/workflows`,
swaggerUi: `${routeUrl}/q/swagger-ui`,
health: {
live: `${routeUrl}/q/health/live`,
diff --git a/packages/sonataflow-deployment-webapp/README.md b/packages/sonataflow-deployment-webapp/README.md
index 231977ccadf..daf62e7b84d 100644
--- a/packages/sonataflow-deployment-webapp/README.md
+++ b/packages/sonataflow-deployment-webapp/README.md
@@ -50,7 +50,7 @@ To create a consumer app for local tests following the Quarkus Getting Started A
unpack-webjar
- process-resources
+ generate-resources
unpack
@@ -106,7 +106,7 @@ Add a plugin to unpack and copy the Webjar in the plugins section
unpack-sonataflow-deployment-webapp
- process-resources
+ generate-resources
unpack
@@ -130,7 +130,7 @@ Add a plugin to unpack and copy the Webjar in the plugins section
copy-sonataflow-deployment-webapp-resources
- process-resources
+ generate-resources
copy-resources
diff --git a/packages/sonataflow-deployment-webapp/pom.xml b/packages/sonataflow-deployment-webapp/pom.xml
index bb82fa96c88..f29a03b0bf3 100644
--- a/packages/sonataflow-deployment-webapp/pom.xml
+++ b/packages/sonataflow-deployment-webapp/pom.xml
@@ -7,15 +7,15 @@
~ 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.
+ ~ under the License.
-->
copy-webjar-resources
- process-resources
+ generate-resources
copy-resources
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5a86b6da345..5bcd702d26a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -9623,6 +9623,9 @@ importers:
run-script-os:
specifier: ^1.1.6
version: 1.1.6
+ sonataflow-deployment-webapp:
+ specifier: workspace:*
+ version: link:../sonataflow-deployment-webapp
packages/serverless-logic-web-tools-swf-dev-mode-image-env:
devDependencies:
diff --git a/repo/graph.dot b/repo/graph.dot
index 14246cfa2fa..e7cff4e8f00 100644
--- a/repo/graph.dot
+++ b/repo/graph.dot
@@ -492,6 +492,7 @@ digraph G {
"@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/serverless-logic-web-tools-swf-deployment-quarkus-app" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env" [ style = "dashed", color = "black" ];
+ "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image" -> "sonataflow-deployment-webapp" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env" -> "@kie-tools/root-env" [ style = "dashed", color = "black" ];
"@kie-tools/serverless-workflow-combined-editor" -> "@kie-tools/serverless-workflow-diagram-editor-assets" [ style = "solid", color = "blue" ];
"@kie-tools/serverless-workflow-combined-editor" -> "@kie-tools/serverless-workflow-text-editor" [ style = "solid", color = "blue" ];
diff --git a/repo/graph.json b/repo/graph.json
index 58f94cda243..98b68c15b07 100644
--- a/repo/graph.json
+++ b/repo/graph.json
@@ -1066,6 +1066,11 @@
"target": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image-env",
"weight": 1
},
+ {
+ "source": "@kie-tools/serverless-logic-web-tools-swf-dev-mode-image",
+ "target": "sonataflow-deployment-webapp",
+ "weight": 1
+ },
{
"source": "@kie-tools/serverless-workflow-diagram-editor",
"target": "@kie-tools/maven-config-setup-helper",