wmedvede commented on code in PR #2697:
URL:
https://github.com/apache/incubator-kie-tools/pull/2697#discussion_r1891844042
##########
packages/kogito-db-migrator-tool-image/package.json:
##########
@@ -0,0 +1,44 @@
+{
+ "private": true,
+ "name": "@kie-tools/kogito-db-migrator-tool-image",
+ "version": "0.0.0",
+ "description": "",
+ "license": "Apache-2.0",
+ "homepage": "https://github.com/apache/incubator-kie-tools",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/apache/incubator-kie-tools.git"
+ },
+ "bugs": {
+ "url": "https://github.com/apache/incubator-kie-tools/issues"
+ },
+ "scripts": {
+ "build": ". ./node_modules/@kie-tools/python-venv/venv/bin/activate &&
pnpm copy-assets && pnpm image:build && rimraf build && rimraf target && rimraf
dist-tests-e2e",
Review Comment:
I don't understand why this image has a different pattern in the scripts
than for example the Data Index Postgresql one.
Not sure if this different pattern might be related with the issue commented
here:
https://github.com/apache/incubator-kie-tools/pull/2697#discussion_r1890155297
But I have seen the following weird pattern:
See image below, when we build the DI image, I can see that a **build**
directory was generated, and the specified artifacts copied there, etc.
However, for the migrator image, no **build** directory was generated.

##########
packages/kogito-db-migrator-tool-image/resources/modules/kogito-postgres-db-migration-deps/module.yaml:
##########
@@ -0,0 +1,26 @@
+#
+# 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.kogito.postgresql.db-migration-deps
+version: "main"
+artifacts:
+ # The following artifact comes from the package kogito-db-migrator-tool
during the pnpm build:dev phase
+ - name: sonataflow-db-migrator-quarkus-app
Review Comment:
I think this now should be named as: **kogito-db-migrator-tool-quarkus-app**
##########
packages/kogito-db-migrator-tool-image/install.js:
##########
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+const { execSync } = require("child_process");
+const fs = require("fs");
+
+const { env } = require("./env");
+const path = require("path");
+const pythonVenvDir =
path.dirname(require.resolve("@kie-tools/python-venv/package.json"));
+const sonataflowImageCommonDir =
path.dirname(require.resolve("@kie-tools/sonataflow-image-common/package.json"));
+const replaceInFile = require("replace-in-file");
+
+const activateCmd =
+ process.platform === "win32"
+ ? `${pythonVenvDir}\\venv\\Scripts\\Activate.bat`
+ : `. ${pythonVenvDir}/venv/bin/activate`;
+
+execSync(
+ `${activateCmd} && \
+ python3 ${sonataflowImageCommonDir}/resources/scripts/versions_manager.py
--bump-to ${env.kogitoDbMigratorToolImage.buildTag} --source-folder
./resources`,
+ { stdio: "inherit" }
+);
+
+// Find and read the -image.yaml file
+const resourcesPath = path.resolve(__dirname, "./resources");
+const files = fs.readdirSync(resourcesPath);
+const imageYamlFiles = files.filter((fileName) =>
fileName.endsWith("image.yaml"));
+if (imageYamlFiles.length !== 1) {
+ throw new Error("There should only be one image.yaml file on ./resources!");
+}
+const originalYamlPath = path.join(resourcesPath, imageYamlFiles[0]);
+let imageYaml = fs.readFileSync(originalYamlPath, "utf8");
+
+const imageUrl =
`${env.kogitoDbMigratorToolImage.registry}/${env.kogitoDbMigratorToolImage.account}/${env.kogitoDbMigratorToolImage.name}`;
+
+// Replace the whole string between quotes ("") with the image name
+imageYaml =
imageYaml.replace(/(?<=")(.*incubator-kie-kogito-service-db-migration-postgresql.*)(?=")/gm,
imageUrl);
Review Comment:
This replace should now use:
imageYaml =
imageYaml.replace(/(?<=")(.*kie-kogito-db-migrator-tool.*)(?=")/gm, imageUrl);
to be consistent with the name, and the same usages in other images.
--
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]