Migrate CLI to v1 public API; retire v1beta1 and v1alpha1 (except IDE)#2093
Draft
jeremybeard wants to merge 4 commits intomainfrom
Draft
Migrate CLI to v1 public API; retire v1beta1 and v1alpha1 (except IDE)#2093jeremybeard wants to merge 4 commits intomainfrom
jeremybeard wants to merge 4 commits intomainfrom
Conversation
Swaps the three generated clients (astro-client-core, astro-client-iam-core, astro-client-platform-core) for a single astro-client-v1 against the versioned v1.0 public API, and shrinks astro-client-v1alpha1 to the IDE (Polaris Project / Polaris Session) tags - the only area the v1 spec does not yet cover. Structural adaptations required by v1: - ApiToken: scope is carried on the token itself; per-scope create/update/rotate/delete endpoints collapse to CreateApiToken / UpdateApiToken / UpdateApiTokenRoles / RotateApiToken / DeleteApiToken. Token creation is now a two-step CreateApiToken + UpdateApiTokenRoles flow. - Users/teams: role mutations go through UpdateUserRoles / UpdateTeamRoles with full-role-set replacement (read-modify-write). - Deployment create/update: most optional fields are pointer-typed; helpers ptrOf, ConvertCreateQueuesToUpdate, and ConvertHybridQueuesToUpdate absorb the shape changes. - Deployment: WorkloadIdentity -> EffectiveWorkloadIdentity. - Deploys: UpdateDeploy(BundleTarballVersion) -> FinalizeDeploy. - Deploy git metadata: v1 has no equivalent yet; retrieveLocalGitMetadata returns a local struct and the Git field is not attached to CreateDeployRequest. TODO(v1-migration) markers flag this for a future PR that re-enables the feature once the server exposes it. Endpoints with no v1 equivalent stay pinned on v1alpha1 and are marked with TODO(v1-migration) comments: - pkg/astroauth/config.go (AuthConfigEndpoint) - pkg/telemetry/telemetry.go (TelemetryAPIURL) Generated client tooling: - scripts/patch-v1-gen.sh strips invalid auto-setter lines that oapi-codegen emits for v1 discriminator children whose 'type' property is no longer listed as required. - .mockery.yaml targets astro-client-v1 and astro-client-v1alpha1. Test migration: test files that reference v1alpha1 types are tagged with '//go:build v1_migration_legacy_tests' and will be re-enabled as each package's tests are adapted to v1. The rest of the test suite passes.
The IDE client (v1alpha1) no longer exposes GetWorkspace after the v1alpha1 shrink. Thread the v1 public client into ExportProject -> resolveProjectID -> createNewProject and reintroduce getWorkspaceName against v1's GetWorkspace so the "Successfully created project …" message prints the workspace name again instead of its ID.
Removes the v1_migration_legacy_tests build tag from 22 test files and
brings them onto the unified astrov1 client. Most migrations were
mechanical (imports, unified response types, optional->pointer field
shapes, scoped ApiToken/UserRole models, WorkerQueueRequest vs
UpdateWorkerQueueRequest splits).
Test-only changes:
- cmd/cloud/{organization,workspace,deployment}_test.go: dropped
user/team/token cases whose split-client API no longer exists
(unified under ListUsers/UpdateUserRoles/ListTeams/UpdateTeamRoles/
ListApiTokens/UpdateApiToken). Service-layer coverage at
cloud/{user,team,organization,workspace-token,deployment}/ now
exercises this logic.
- cloud/deploy/bundle_test.go: skip TestBundleDeploy_GitMetadataRetrieved
while v1 CreateDeployRequest lacks Git metadata support.
- cloud/workspace-token: one subtest skipped (unreachable error branch
in unified flow).
Production fixes surfaced by tests:
- cloud/deployment/inspect/inspect.go: format DeploymentEnvironmentVariable
UpdatedAt as RFC3339 string before handing it to the mapstructure
target (v1 type changed from string to time.Time; inspect output
was broken for any deployment with env vars).
- cmd/cloud/deployment.go: uppercase the --cloud-provider flag value
before validating against ClusterCloudProvider enum constants (AWS,
GCP, AZURE) so lowercase input keeps working.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Retires the
astro-client-core(v1alpha1),astro-client-iam-core(iam/v1beta1), andastro-client-platform-core(platform/v1beta1) generated clients in favor of a single unifiedastro-client-v1client built from the publicversioned/v1.0spec released in astronomer/astro#37986.astro-client-v1/— unified client, tags for Organization/Workspace/Cluster/Deployment/Deploy/User/Team/ApiToken/Environment/Authorization/etc.astro-client-core/→astro-client-v1alpha1/, shrunk to IDE-only (Polaris Project,Polaris Sessiontags).astro-client-iam-core/,astro-client-platform-core/,cloud/platformclient/.private/v1alpha1/cli/auth-config(pkg/astroauth/config.go) and/v1alpha1/telemetry(pkg/telemetry/telemetry.go).Net diff vs
main: 101 files changed, +30,845 / −62,765.Notable production fixes surfaced during migration
cloud/deployment/inspect/inspect.go: formatDeploymentEnvironmentVariable.UpdatedAtas RFC3339 before mapstructure decode (v1 changed the field fromstringtotime.Time; inspect was broken for any deployment with env vars).cmd/cloud/deployment.go: uppercase--cloud-providerinput before validating against theClusterCloudProviderenum (AWS/GCP/AZURE) so lowercase input keeps working.Deferred (marked with TODOs / test skips)
CreateDeployRequestpending v1 server-side support (one bundle-deploy test ist.Skipped).Test plan
go build ./...cleanmake lintcleango test ./...passesastro login(v1/users/self)astro organization list/switchastro workspace list/switchastro deployment list/create/update/delete/logsastro deployment token list/create;astro workspace token …;astro organization token …astro deployment team list/astro workspace team list(newworkspaceId/deploymentIdquery params)astro ide project list/export/import(still on v1alpha1)astro api cloud …regression