Skip to content

feat(config): merge per-provider YAML into a single onctl.yaml - #930

Merged
cdalar merged 3 commits into
mainfrom
feat/single-onctl-yaml-config
Jun 20, 2026
Merged

cdalar merged 3 commits into
mainfrom
feat/single-onctl-yaml-config

Conversation

@cdalar

@cdalar cdalar commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace gcp.yaml/azure.yaml (and the previously-removed hetzner.yaml/aws.yaml/fc.yaml/onctl.yaml) with a single onctl.yaml written by onctl init, holding every provider's settings pre-filled with working defaults under its own section. CLI flags still override it.
  • Drop the ~45-line viper.SetDefault() block in cmd/common.go now that the YAML file is the single source of truth for defaults.
  • onctl init is required again: initState() is fatal if onctl.yaml can't be loaded, for every provider, matching pre-zero-yaml-flags behavior.

Test plan

  • go build ./...
  • go vet ./...
  • golangci-lint run ./... (0 issues)
  • go test ./... (all pass)
  • Manual smoke test: no config present → fatal "no configuration directory found... run onctl init" error
  • Manual smoke test: after onctl init, onctl list works against real Hetzner credentials with no other config
  • Verified --type/--location/--username (shared flags backing different per-provider defaults, e.g. hetzner.vm.type=cpx21 vs aws.vm.type=t2.micro) still resolve correctly purely from the YAML's provider sections

https://claude.ai/code/session_01PTkspGQd3qXJbJaxqaoMSu

Replace gcp.yaml/azure.yaml (and the previously-removed hetzner.yaml/
aws.yaml/fc.yaml/onctl.yaml) with one onctl.yaml written by `onctl init`,
holding every provider's settings pre-filled with working defaults under
its own commented section. CLI flags still override it.

Drop the ~45-line viper.SetDefault() block in cmd/common.go now that the
YAML file is the single source of truth for defaults; `onctl init` is
required again (initState() is fatal if onctl.yaml can't be loaded, for
every provider, matching pre-zero-yaml-flags behavior).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5dd9b82e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/common.go Resolved
The test called initializeOnctlEnv() without overriding HOME, so on a
clean runner it created a real ~/.onctl directory. Under Go's test
shuffling that leaked into later tests (e.g. TestReadConfig_NoConfigDirectory)
which assert no config directory exists, causing flaky CI failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RpWaEWJM7WzPajfLGjjQSu
@codecov

codecov Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.58%. Comparing base (4fb4a31) to head (d5204e7).

Files with missing lines Patch % Lines
cmd/init.go 75.00% 2 Missing and 2 partials ⚠️
cmd/common.go 75.00% 1 Missing ⚠️
cmd/root.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #930      +/-   ##
==========================================
- Coverage   22.98%   22.58%   -0.41%     
==========================================
  Files          42       42              
  Lines        4194     4176      -18     
==========================================
- Hits          964      943      -21     
+ Misses       3115     3114       -1     
- Partials      115      119       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… files

initializeOnctlEnv treated any existing .onctl directory as fully
initialized, even one created before the single-onctl.yaml config that
only had per-provider yaml files. That left ReadConfig permanently
failing with "no configuration directory found" since onctl.yaml was
never written. Now both init and every ReadConfig call populate a
missing onctl.yaml and print a warning when legacy per-provider files
(aws.yaml, azure.yaml, fc.yaml, gcp.yaml, hetzner.yaml) are present,
since their settings are silently ignored by the new single-file config.

Also isolates HOME in TestInitializeOnctlEnv_Coverage, a second
instance of the same un-isolated-HOME bug fixed for
TestInitializeOnctlEnv_NewDirectory in the previous commit.
@cdalar
cdalar merged commit 30f3333 into main Jun 20, 2026
17 checks passed
@cdalar
cdalar deleted the feat/single-onctl-yaml-config branch August 19, 2026 13:53
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.

2 participants

⌂ 换网址