Skip to content

Respect KITOPS_HOME in library config path - #1189

Merged
amisevsk merged 4 commits into
kitops-ml:mainfrom
puneetdixit200:fix-kitops-home-library
Jun 22, 2026
Merged

Respect KITOPS_HOME in library config path#1189
amisevsk merged 4 commits into
kitops-ml:mainfrom
puneetdixit200:fix-kitops-home-library

Conversation

@puneetdixit200

Copy link
Copy Markdown
Contributor

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
Contributor 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
Contributor 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.

@amisevsk amisevsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @puneetdixit200

@amisevsk
amisevsk merged commit c8f6bfd into kitops-ml:main Jun 22, 2026
8 checks passed
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