Skip to content

Commit

Permalink
fix service set resposne with version and label support
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhil-024 committed Jan 21, 2025
1 parent 9342f7c commit 501e5fb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
18 changes: 3 additions & 15 deletions cmd/deploy/service-set.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func executeDeployServiceSet(cmd *cobra.Command) {
log.Fatal(fmt.Sprintf("Failed to list services with conflicting versions: %s", errs.Error()))
return
}
var serviceNames []string
for _, service := range services.Services {

allowedInputsSlice := []string{Yes, No}
Expand All @@ -97,23 +96,12 @@ func executeDeployServiceSet(cmd *cobra.Command) {

if val != Yes {
log.Info(fmt.Sprintf("Skipping service %s from deploy", service.Name))
serviceNames = append(serviceNames, service.Name)
}
// Remove services from deployServiceSetRequest
var updatedServices []*serviceProto.ServiceIdentifier
for _, svc := range deployServiceSetRequest.Services {
shouldRemove := false
for _, name := range serviceNames {
if svc.ServiceName == name {
shouldRemove = true
break
for _, svc := range deployServiceSetRequest.Services {
if svc.ServiceName == service.Name {
svc.ForceFlag = false
}
}
if !shouldRemove {
updatedServices = append(updatedServices, svc)
}
}
deployServiceSetRequest.Services = updatedServices

}

Expand Down
4 changes: 2 additions & 2 deletions internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (e *Service) DeployServiceSet(ctx *context.Context, request *serviceProto.D
spinnerInstance.Stop()
var buf bytes.Buffer
table := tablewriter.NewWriter(&buf)
table.SetHeader([]string{"Service Name", "Version", "Tags", "Action", "Status", "Error"})
table.SetHeader([]string{"Service Name", "Version", "Action", "Status", "Error"})
for _, serviceResponse := range response.GetServices() {
var errorMessage string
if serviceResponse.ServiceResponse.ServiceStatus.ServiceStatus == "FAILED" {
Expand All @@ -124,7 +124,6 @@ func (e *Service) DeployServiceSet(ctx *context.Context, request *serviceProto.D
row := []string{
serviceResponse.ServiceIdentifier.ServiceName,
serviceResponse.ServiceIdentifier.ServiceVersion,
serviceResponse.ServiceIdentifier.Tags,
serviceResponse.ServiceResponse.ServiceStatus.ServiceAction,
serviceResponse.ServiceResponse.ServiceStatus.ServiceStatus,
errorMessage,
Expand Down Expand Up @@ -342,6 +341,7 @@ func (e *Service) ConvertToDeployServiceSetRequest(serviceSet *serviceDto.Servic
ServiceName: service.Name,
ServiceVersion: service.Version,
Tags: service.Tags,
ForceFlag: true,
})
}

Expand Down
Binary file removed odin
Binary file not shown.
1 change: 1 addition & 0 deletions proto/dream11/od/service/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ message ServiceIdentifier {
string service_name = 1;
string service_version = 2;
string tags = 3;
bool force_flag = 4;
}

message DeployReleasedServiceRequest {
Expand Down
26 changes: 18 additions & 8 deletions proto/gen/go/dream11/od/service/v1/service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 501e5fb

Please sign in to comment.