Skip to content

Track deployment region #1114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cmd/cli/command/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ func (m *mockFabricService) CheckToS(context.Context, *connect.Request[emptypb.E

func (m *mockFabricService) WhoAmI(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[defangv1.WhoAmIResponse], error) {
return connect.NewResponse(&defangv1.WhoAmIResponse{
Tenant: "default",
Account: "default",
Region: "us-west-2",
Tier: defangv1.SubscriptionTier_HOBBY,
Tenant: "default",
ProviderAccountId: "default",
Region: "us-west-2",
Tier: defangv1.SubscriptionTier_HOBBY,
}), nil
}

Expand Down
4 changes: 3 additions & 1 deletion src/pkg/cli/client/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ func (m MockFabricClient) ListDeployments(ctx context.Context, req *defangv1.Lis
{
Id: "a1b2c3",
Project: "test",
Provider: "aws",
Provider: defangv1.Provider_AWS,
ProviderAccountId: "1234567890",
ProviderString: "aws",
Region: "us-test-2",
Timestamp: timestamppb.Now(),
},
},
Expand Down
4 changes: 3 additions & 1 deletion src/pkg/cli/composeDown.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ func ComposeDown(ctx context.Context, projectName string, c client.FabricClient,
Action: defangv1.DeploymentAction_DEPLOYMENT_ACTION_DOWN,
Id: etag,
Project: projectName,
Provider: string(accountInfo.Provider()),
Provider: accountInfo.Provider().EnumValue(),
ProviderAccountId: accountInfo.AccountID(),
ProviderString: string(accountInfo.Provider()),
Region: accountInfo.Region(),
Timestamp: timestamppb.New(time.Now()),
},
})
Expand Down
4 changes: 3 additions & 1 deletion src/pkg/cli/composeUp.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ func ComposeUp(ctx context.Context, project *compose.Project, fabric client.Fabr
Action: defangv1.DeploymentAction_DEPLOYMENT_ACTION_UP,
Id: resp.Etag,
Project: project.Name,
Provider: string(accountInfo.Provider()),
Provider: accountInfo.Provider().EnumValue(),
ProviderAccountId: accountInfo.AccountID(),
ProviderString: string(accountInfo.Provider()),
Region: accountInfo.Region(),
Timestamp: timestamppb.New(timestamp),
},
})
Expand Down
6 changes: 4 additions & 2 deletions src/pkg/cli/deploymentsList.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type PrintDeployment struct {
Deployment string
Provider string
DeployedAt string
Region string
}

func DeploymentsList(ctx context.Context, projectName string, client client.GrpcClient) error {
Expand All @@ -34,10 +35,11 @@ func DeploymentsList(ctx context.Context, projectName string, client client.Grpc
for i, d := range response.Deployments {
deployments[i] = PrintDeployment{
Deployment: d.Id,
Provider: d.Provider,
Provider: d.ProviderString, // TODO: use Provider
DeployedAt: d.Timestamp.AsTime().Format(time.RFC3339),
Region: d.Region,
}
}

return term.Table(deployments, []string{"Deployment", "Provider", "DeployedAt"})
return term.Table(deployments, []string{"Deployment", "Provider", "DeployedAt"}) // TODO: add region
}
4 changes: 3 additions & 1 deletion src/pkg/cli/deploymentsList_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ func (g *mockListDeploymentsHandler) ListDeployments(ctx context.Context, req *c
{
Id: "a1b2c3",
Project: "test",
Provider: "playground",
Provider: defangv1.Provider_DEFANG,
ProviderAccountId: "1234567890",
ProviderString: "playground",
Region: "us-test-2",
Timestamp: timestamppb.Now(),
},
}
Expand Down
8 changes: 4 additions & 4 deletions src/pkg/cli/whoami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ type grpcWhoamiMockHandler struct {

func (g *grpcWhoamiMockHandler) WhoAmI(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[defangv1.WhoAmIResponse], error) {
return connect.NewResponse(&defangv1.WhoAmIResponse{
Tenant: "tenant-1",
Account: "playground",
Region: "us-test-2",
Tier: defangv1.SubscriptionTier_PRO,
Tenant: "tenant-1",
ProviderAccountId: "playground",
Region: "us-test-2",
Tier: defangv1.SubscriptionTier_PRO,
}), nil
}

Expand Down
1,536 changes: 781 additions & 755 deletions src/protos/io/defang/v1/fabric.pb.go

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/protos/io/defang/v1/fabric.proto
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,14 @@ enum DeploymentAction {
}

message Deployment {
string id = 1;
string id = 1; // aka etag
string project = 2;
string provider = 3;
string provider_string = 3 [ deprecated = true ]; // was: provider
string provider_account_id = 4;
google.protobuf.Timestamp timestamp = 5;
DeploymentAction action = 6;
string region = 7;
Provider provider = 8;
}

message PutDeploymentRequest { Deployment deployment = 1; }
Expand Down Expand Up @@ -660,7 +662,7 @@ message SetOptionsRequest {

message WhoAmIResponse {
string tenant = 1;
string account = 2;
string provider_account_id = 2;
string region = 3;
string user_id = 4;
SubscriptionTier tier = 5;
Expand Down
Loading