Skip to content

Scaffold the Go project, CLI skeleton, and cloud authentication#7

Merged
berendt merged 6 commits into
mainfrom
implement/issue-2-scaffold-cli-auth
Jun 24, 2026
Merged

Scaffold the Go project, CLI skeleton, and cloud authentication#7
berendt merged 6 commits into
mainfrom
implement/issue-2-scaffold-cli-auth

Conversation

@berendt

@berendt berendt commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Closes #2

Summary

Lays down the repository foundation that every other package will build on: a Go module, the cmd / internal package layout, a cobra-based CLI exposing the neutron command namespace, and clouds.yaml-based authentication that yields a working gophercloud v2 NetworkV2 client. Global flags, structured logging, and CI (build, vet, lint, test) are wired here, and the previously-open module-path and CLI-framework decisions are settled.

Demoable on its own: neutron --help lists the subcommands, and neutron list-networks authenticates against the configured cloud and issues one trivial NetworkV2 call as an end-to-end auth/connectivity smoke test.

Change set (in commit order)

  1. 5b653dc Initialize Go module and add .gitignore — Adds go.mod (module github.com/B42Labs/openstack-tester, go 1.26.1) with the gophercloud/gophercloud/v2 and spf13/cobra direct dependencies plus the resolved go.sum, and a .gitignore covering the built binary, Go test/coverage artifacts, and editor/OS files.

  2. bce2f01 Add config package for clouds.yaml NetworkV2 auth — Introduces internal/config with NewNetworkClient(ctx, cloudName). It parses clouds.yaml (selecting the cloud from OS_CLOUD when cloudName is empty), builds an authenticated provider client with TLS config, and returns a NetworkV2 service client, wrapping every failure path with context. Ships a unit test (config_test.go) covering the no-cloud and missing-file error paths, and an integration-tagged test (config_integration_test.go) that exercises a real cloud, skipped unless OS_CLOUD is set.

  3. 8e6e2a2 Add cobra CLI skeleton with neutron stub subcommands — Adds the cmd/openstack-tester binary: main.go (root command execution with a context.Background()), root.go (root command, the --os-cloud / --concurrency / --timeout / --seed / --log-level persistent flags, and slog-based structured logging configured in PersistentPreRunE), neutron.go (the neutron namespace with generate, apply, status, report, cleanup, and verify stubs that return a not-implemented error), and list_networks.go (a working list-networks subcommand wired to internal/config). root_test.go asserts subcommand/flag registration, log-level parsing, that neutron --help runs, and that the stubs return errors.

  4. 25cf16e Add CI workflow for build, vet, lint, and test — Adds .github/workflows/ci.yml (a build job running go build/go vet/go test and a lint job running golangci-lint, both pinned by commit SHA and reading the Go version from go.mod) plus a minimal v2-schema .golangci.yml.

  5. 9d11432 Record resolved module-path and CLI decisions in README — Updates the README status to "Phase 1 in progress" and marks the two open decisions as resolved: CLI framework is cobra, and the module path is github.com/B42Labs/openstack-tester at the repository root.

Notes / divergences from the issue

  • Module path & layout — The issue's design doc floated github.com/osism/testbed/contrib/openstack-tester under a contrib/ directory as a candidate. This branch resolves the open decision to github.com/B42Labs/openstack-tester with the module at the repository root (no contrib/), and records that in the README.
  • CI scope — The issue asks for "build, lint, vet"; the workflow additionally runs go test ./.... That is a superset of what was requested and keeps the unit tests gated in CI.
  • list-networks — Beyond the six stub subcommands, neutron list-networks is implemented as a real read-only NetworkV2 call. This is the "trivial API call such as listing networks" the issue names as the demo criterion, rather than an extra feature.

Implemented by planwerk-review a24f4d9 with Claude:claude-opus-4-8

berendt added 6 commits June 24, 2026 09:07
Establish the module path github.com/B42Labs/openstack-tester
(rooted at the repository root) and ignore the built binary and
common Go/editor artifacts. This settles the module-path open
decision from the README.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Berendt <berendt@b42labs.com>
Add internal/config.NewNetworkClient, which parses clouds.yaml via
gophercloud v2 (honoring OS_CLOUD, overridable with an explicit cloud
name) and returns an authenticated NetworkV2 service client.

Error paths are covered by a hermetic unit test; the happy path runs
against a real cloud behind the 'integration' build tag, since this
package is a ports-and-adapters seam to OpenStack.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Berendt <berendt@b42labs.com>
Add the openstack-tester binary: a cobra root command with the five
global flags (--os-cloud, --concurrency, --timeout, --seed,
--log-level), slog structured logging configured from --log-level, and
the neutron command namespace. The six documented subcommands
(generate, apply, status, report, cleanup, verify) are stubs; the
working list-networks subcommand authenticates and issues one trivial
NetworkV2 call as an end-to-end smoke test.

This settles the CLI-framework open decision (cobra).

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Berendt <berendt@b42labs.com>
Run go build, go vet, go test, and golangci-lint on every push to main
and on pull requests. Third-party actions are pinned by commit SHA with
a version comment per supply-chain hygiene, and the Go version is read
from go.mod so CI and the module stay in sync.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Berendt <berendt@b42labs.com>
Update the status blurb to reflect the scaffold, CLI skeleton, and
clouds.yaml authentication now existing, and mark the CLI-framework
(cobra) and module-path (github.com/B42Labs/openstack-tester) open
decisions as resolved.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Berendt <berendt@b42labs.com>
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christian Berendt <berendt@b42labs.com>
@berendt
berendt marked this pull request as ready for review June 24, 2026 07:45
@berendt
berendt merged commit c3145fc into main Jun 24, 2026
2 checks passed
@berendt
berendt deleted the implement/issue-2-scaffold-cli-auth branch June 24, 2026 07:45
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.

Scaffold the Go project, CLI skeleton, and cloud authentication

1 participant