Skip to content

feat(create): expose AWS config as CLI flags; drop required aws.yaml - #926

Merged
cdalar merged 2 commits into
mainfrom
feat/aws-zero-yaml-flags
Jun 19, 2026
Merged

cdalar merged 2 commits into
mainfrom
feat/aws-zero-yaml-flags

Conversation

@cdalar

@cdalar cdalar commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

  • go build ./..., go vet ./..., gofmt -l . clean
  • go test ./... passes (full suite)
  • Extended cmd/flags_defaults_test.go with AWS cases; restructured the shared-flag assertions into a defaults-check pass then an override pass (documented why in the test comment)

Mirrors the Hetzner pass (#918) for AWS so the provider works with no
.onctl YAML.

- setDefaults() (cmd/common.go): viper.SetDefault for aws.location
  (eu-central-1), aws.vm.type (t2.micro), aws.vm.username (ubuntu),
  matching the deleted aws.yaml. aws.vm.image is left undefaulted;
  provideraws.GetImages already falls back to the Ubuntu AMI name
  pattern when it's empty.
- Bind the existing generic --type/--location/--username/--image
  create flags to aws.vm.type/aws.location/aws.vm.username/aws.vm.image
  too, the same way --username already drives both hetzner.vm.username
  and fc.vm.username.
- Relax the --image guard in createCmd.Run to allow aws in addition to
  hetzner (opt.Vm.Image itself stays Hetzner-only/snapshot-ID specific;
  AWS reads the image purely through the aws.vm.image viper key).
- Remove embedded internal/files/init/aws.yaml (onctl init no longer
  scaffolds it).
- cmd/root.go initState(): aws joins hetzner/fc in the providers for
  which a missing/unreadable .onctl is non-fatal.
- Extend flags_defaults_test.go with aws.* cases. Restructured the
  shared-flag assertions into a defaults-check pass followed by an
  override pass: once a flag bound to multiple provider keys is
  Set (even back to its own value), viper's flag layer outranks
  SetDefault for every key bound to it, so checking defaults and
  overrides in the same loop iteration broke later per-provider
  defaults sharing that flag.

@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: 3daff62eb1

ℹ️ 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/root.go Resolved
Comment thread cmd/create.go Resolved
@codecov

codecov Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.68421% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.98%. Comparing base (0a15f82) to head (72193d1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/create.go 50.00% 4 Missing ⚠️
cmd/root.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #926      +/-   ##
==========================================
+ Coverage   22.76%   22.98%   +0.22%     
==========================================
  Files          42       42              
  Lines        4182     4194      +12     
==========================================
+ Hits          952      964      +12     
- Misses       3114     3115       +1     
+ Partials      116      115       -1     

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

…ile image for AWS

ReadConfig was returning before reading onctl.yaml whenever the now-optional
provider-specific YAML was missing, silently dropping shared settings
(ssh keys, cloud-init timeout) for hetzner/fc/aws. Reorder so the general
config always loads first.

Also copy opt.Vm.Image into the aws.vm.image viper key after MergeConfig,
since provideraws.GetImages only reads that key and previously ignored
vm.image set via --file config (the --image flag already bound to it).

Addresses Codex review feedback on PR #926.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y5Rqe638fXqErzeUoMJcfe
@cdalar
cdalar merged commit 4fb4a31 into main Jun 19, 2026
19 checks passed
@cdalar
cdalar deleted the feat/aws-zero-yaml-flags 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

⌂ 换网址