fix: separate gitops root from render output
This commit is contained in:
@@ -205,6 +205,7 @@ function parseArgs(argv) {
|
||||
lane: process.env.HWLAB_GITOPS_LANE || "g14",
|
||||
nodeId: process.env.HWLAB_NODE_ID || "G14",
|
||||
outDir: defaultOutDir,
|
||||
gitopsRoot: defaultOutDir,
|
||||
catalogPath: defaultCatalogPath,
|
||||
imageTagMode: process.env.HWLAB_ARTIFACT_IMAGE_TAG_MODE || "short",
|
||||
registryPrefix: defaultRegistryPrefix,
|
||||
@@ -228,6 +229,7 @@ function parseArgs(argv) {
|
||||
if (arg === "--lane") args.lane = readOption(argv, ++index, arg);
|
||||
else if (arg === "--node") args.nodeId = readOption(argv, ++index, arg);
|
||||
else if (arg === "--out") args.outDir = readOption(argv, ++index, arg);
|
||||
else if (arg === "--gitops-root") args.gitopsRoot = readOption(argv, ++index, arg);
|
||||
else if (arg === "--catalog-path") args.catalogPath = readOption(argv, ++index, arg);
|
||||
else if (arg === "--image-tag-mode") args.imageTagMode = readOption(argv, ++index, arg);
|
||||
else if (arg === "--registry-prefix") args.registryPrefix = readOption(argv, ++index, arg).replace(/\/+$/u, "");
|
||||
@@ -289,6 +291,7 @@ function usage() {
|
||||
" --lane LANE g14 or runtime lane such as v02/v03/v04; default: g14",
|
||||
` --node NODE deployment node id from deploy.nodes; default: ${process.env.HWLAB_NODE_ID || "G14"}`,
|
||||
` --out DIR default: ${defaultOutDir}`,
|
||||
` --gitops-root DIR path inside GitOps repo; default comes from deploy.nodes.<node>.gitopsRoot`,
|
||||
` --catalog-path PATH default: ${defaultCatalogPath}`,
|
||||
" --image-tag-mode MODE short or full; v02 uses full source commit IDs",
|
||||
` --source-repo URL default: ${defaultSourceRepo}`,
|
||||
@@ -739,7 +742,7 @@ function gitopsTargetForProfile(profile) {
|
||||
}
|
||||
|
||||
function gitopsRootForArgs(args) {
|
||||
return String(args.outDir || defaultOutDir).replace(/\/+$/u, "");
|
||||
return String(args.gitopsRoot || defaultOutDir).replace(/\/+$/u, "");
|
||||
}
|
||||
|
||||
function gitopsPathForProfile(args, profile) {
|
||||
|
||||
@@ -14,6 +14,7 @@ export type GitOpsRenderArgs = {
|
||||
lane: string;
|
||||
nodeId?: string;
|
||||
outDir: string;
|
||||
gitopsRoot?: string;
|
||||
sourceBranch: string;
|
||||
gitopsBranch: string;
|
||||
catalogPath: string;
|
||||
@@ -148,11 +149,10 @@ export function applyRuntimeLaneDeployConfig(args: GitOpsRenderArgs, deploy: Dep
|
||||
const defaultRuntimeEndpoint = defaults.defaultRuntimeEndpoint ?? "http://74.48.78.17:17667";
|
||||
const defaultWebEndpoint = defaults.defaultWebEndpoint ?? "http://74.48.78.17:17666";
|
||||
const defaultSourceRepo = defaults.defaultSourceRepo ?? "git@github.com:pikasTech/HWLAB.git";
|
||||
const defaultOutDir = defaults.defaultGitopsRoot ?? defaultGitopsRoot;
|
||||
const defaultCatalog = `deploy/artifact-catalog.${args.lane}.json`;
|
||||
|
||||
if (!result.nodeId || result.nodeId === defaultNodeId) result.nodeId = nodeId;
|
||||
if (result.outDir === defaultOutDir) result.outDir = gitopsRootForNode(deploy, nodeId, defaults);
|
||||
if (!result.gitopsRoot || result.gitopsRoot === (defaults.defaultGitopsRoot ?? defaultGitopsRoot)) result.gitopsRoot = gitopsRootForNode(deploy, nodeId, defaults);
|
||||
if (result.sourceBranch === defaultBranch || result.sourceBranch === versionName) result.sourceBranch = laneConfig.sourceBranch ?? versionName;
|
||||
if (result.gitopsBranch === defaultGitopsBranch || result.gitopsBranch === `${versionName}-gitops`) result.gitopsBranch = laneConfig.gitopsBranch ?? `${versionName}-gitops`;
|
||||
if (result.catalogPath === defaultCatalogPath || result.catalogPath === defaultCatalog) result.catalogPath = laneConfig.artifactCatalog ?? defaultCatalog;
|
||||
|
||||
Reference in New Issue
Block a user