ricardozanini commented on code in PR #3181: URL: https://github.com/apache/incubator-kie-tools/pull/3181#discussion_r2143688237
########## packages/kogito-images-install-helper/index.js: ########## @@ -0,0 +1,95 @@ +/* + * 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 path = require("path"); +const replaceInFile = require("replace-in-file"); +const { setupMavenConfigFile, buildTailFromPackageJsonDependencies } = require("@kie-tools/maven-base"); + +// Constants for dependent packages +const PYTHON_VENV_PKG = "@kie-tools/python-venv"; +const IMAGE_COMMON_PKG = "@kie-tools/sonataflow-image-common"; + +/** + * Shared install routine for bumping versions, configuring Maven and updating YAMLs/features. + * @param {{ imageEnv: { buildTag:string, registry:string, account:string, name:string }, resourceDir?: string, finalImageName: string, requiresMvn: boolean }} options + */ +function runSharedInstall({ imageEnv, resourceDir = "./resources", finalImageName, requiresMvn = true }) { + if (!finalImageName) { + throw new Error("'finalImageName' parameter is required"); + } + if (!imageEnv) { + throw new Error("'imageEnv' parameter is required"); + } + + // 1) Maven revision and tail + if (requiresMvn) { + const { version } = require(path.resolve(__dirname, "package.json")); + setupMavenConfigFile( + ` + -Drevision=${version} + -Dmaven.repo.local.tail=${buildTailFromPackageJsonDependencies()} Review Comment: It uses the current `package.json`, which is ok since all of them share the same version? -- 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]
