Skip to content

Respect KITOPS_HOME in library config path#1189

Open
puneetdixit200 wants to merge 4 commits into
kitops-ml:mainfrom
puneetdixit200:fix-kitops-home-library
Open

Respect KITOPS_HOME in library config path#1189
puneetdixit200 wants to merge 4 commits into
kitops-ml:mainfrom
puneetdixit200:fix-kitops-home-library

Conversation

@puneetdixit200
Copy link
Copy Markdown

Description

Add constants.ConfigPath() so library callers can resolve the KitOps root storage directory with $KITOPS_HOME support and the existing platform default fallback. The root command now delegates environment/default path resolution to that helper while preserving --config flag precedence.

Regression coverage verifies both $KITOPS_HOME and default fallback behavior.

Linked issues

Fixes #1171

AI-Assisted Code

  • This PR contains AI-generated code that I have reviewed and tested
  • I take full responsibility for all code in this PR, regardless of how it was created

Tests

  • GOMODCACHE=$PWD/.gomodcache GOCACHE=$PWD/.gocache go test ./pkg/lib/constants
  • GOMODCACHE=$PWD/.gomodcache GOCACHE=$PWD/.gocache go test ./pkg/lib/constants ./cmd
  • git diff --check

Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
Comment thread cmd/root.go Outdated
Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
Signed-off-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
@puneetdixit200
Copy link
Copy Markdown
Author

Addressed in f401174. The root command now delegates the shared environment/default path resolution to constants.ConfigPath() and only applies the --config flag override separately, so the same resolution is not duplicated in cmd/root.go.

@puneetdixit200
Copy link
Copy Markdown
Author

The duplicate lookup concern is addressed in the current head: getConfigHome now applies the explicit --config override and then calls constants.ConfigPath() once for KITOPS_HOME/default resolution. I reran go test ./pkg/lib/constants ./cmd locally and it passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Library usage of Kit does not take KITOPS_HOME into account

2 participants