refactor(cmd): move GCP key provisioning into configure_gcp_keys.go by cristim · Pull Request #2263 · LeanerCloud/cloud-commitments-cli · GitHub
Skip to content

refactor(cmd): move GCP key provisioning into configure_gcp_keys.go - #2263

Merged
cristim merged 1 commit into
mainfrom
refactor/split-configure-gcp-keys
Oct 17, 2026
Merged

cristim merged 1 commit into
mainfrom
refactor/split-configure-gcp-keys

Conversation

@cristim

@cristim cristim commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Refs #1834. This is part 1 of the configure_gcp.go split. Part 2 will bring that file under the 500-line cap.

Summary

This PR moves the GCP service-account key provisioning group out of cmd/configure_gcp.go into a new cmd/configure_gcp_keys.go. The move changes no logic, signatures, names, or comments; the only other edits are to the imports. configure_gcp.go goes from 1069 lines to 839, and the new file is 243 lines.

Moved symbols:

  • gcpKeyProvisioner, iamKeyProvisioner (with its CreateKey and DeleteKey methods), newIAMKeyProvisioner
  • createKeyError
  • createGCPServiceAccountKey, deleteGCPServiceAccountKey
  • writeServiceAccountKey, uploadGCPCredentialsFile, deleteMintedGCPKeyRemotely
  • gcloudDeleteKeyCommand, mintedGCPKeyFilename, newMintedGCPKeyPath, removeMintedGCPKey

The callers that stay in configure_gcp.go are getGCPCredentialsFilePath and gcpStepCreateKey. They are part of the wizard flow, so they belong there.

Evidence (local, macOS, GOTOOLCHAIN=go1.26.9)

  • Pure move: after excluding the package line and import blocks, the sorted removed and added lines from git diff -U0 are identical. Both the author and an independent reviewer checked this.
  • go build -o /dev/null ./cmd passes. go vet ./... passes. go test -race ./cmd/... passes, including 92 GCP tests.
  • golangci-lint v2.10.1 reports 0 issues. scripts/test-git-secrets-allowlist.sh passes 44/44.
  • Review: two passes by an independent non-author reviewer (sonnet, high) found no actionable findings at bc21eaba.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • GCP credential and service-account key operations now clean up temporary local files and, where possible, remote keys after failures. Error messages also provide clearer recovery guidance when a key may have been created despite an error.

Pure move, no logic, signature, name or comment changes. Moves
gcpKeyProvisioner, iamKeyProvisioner (CreateKey/DeleteKey),
createKeyError, newIAMKeyProvisioner, createGCPServiceAccountKey,
deleteGCPServiceAccountKey, writeServiceAccountKey,
uploadGCPCredentialsFile, deleteMintedGCPKeyRemotely,
gcloudDeleteKeyCommand, mintedGCPKeyFilename, newMintedGCPKeyPath and
removeMintedGCPKey out of configure_gcp.go.

cmd/configure_gcp.go: 1069 -> 839 lines. New cmd/configure_gcp_keys.go:
243 lines.

Refs #1834

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cristim cristim added priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/internal Team-internal only effort/l Weeks type/chore Maintenance / non-user-visible triaged Item has been triaged labels Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

@cristim
cristim merged commit 3c1d551 into main Oct 17, 2026
12 checks passed
@cristim
cristim deleted the refactor/split-configure-gcp-keys branch October 18, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/l Weeks impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/chore Maintenance / non-user-visible urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant