From 85710ec0cc893690ccdb4e8ec7a8f0576087af5f Mon Sep 17 00:00:00 2001 From: Asutosh Das Date: Wed, 18 Sep 2024 19:10:51 +0530 Subject: [PATCH] feat: added deployment failed message in deployment history (#5845) * feat: added updated api specs for orchestrator/application/deployment-history api * feat: added deployment failed message in deployment history * updated migration version * FailedStatusUpdateOption signature updated * fixed GetEmailById method * updated migration version * updated migration version * updated migration message formatting * handled rbac for the source changing to external-ci * change in patch source info of cdpipeline config object * resolved the comments after 1st review --------- Co-authored-by: Rajeev --- .../deployment/CommonDeploymentRestHandler.go | 2 +- api/auth/user/UserRestHandler.go | 2 +- api/helm-app/gRPC/applist.pb.go | 784 +++++++++--------- api/helm-app/gRPC/applist.proto | 1 + api/helm-app/gRPC/applist_grpc.pb.go | 126 ++- api/restHandler/UserAttributesRestHandler.go | 6 +- .../DeploymentPipelineRestHandler.go | 47 +- cmd/external-app/wire_gen.go | 2 +- .../pipelineConfig/CdWorfkflowRepository.go | 114 +-- .../pipelineConfig/CiWorkflowRepository.go | 101 +-- .../pipelineConfig/PipelineRepository.go | 5 +- .../pipelineConfig/bean/cdWorkflow/bean.go | 54 ++ pkg/app/AppListingService.go | 7 +- pkg/app/AppService.go | 17 +- .../status/PipelineStatusTimelineService.go | 4 +- pkg/appStore/bean/bean.go | 13 + pkg/appStore/installedApp/adapter/Adapter.go | 67 ++ .../repository/InstalledAppRepository.go | 115 ++- .../repository/InstalledAppVersionHistory.go | 49 +- .../service/AppStoreDeploymentDBService.go | 120 +-- .../service/AppStoreDeploymentService.go | 40 +- .../service/EAMode/EAModeDeploymentService.go | 4 +- .../service/EAMode/InstalledAppDBService.go | 26 + .../FullMode/InstalledAppDBExtendedService.go | 21 +- .../deployment/DeploymentStatusService.go | 54 +- .../deployment/FullModeDeploymentService.go | 72 +- pkg/auth/user/UserService.go | 81 +- pkg/auth/user/bean/bean.go | 2 + pkg/bean/app.go | 5 + .../gitOps/config/GitOpsConfigReadService.go | 2 +- .../devtronApps/PostStageTriggerService.go | 4 +- .../devtronApps/PreStageTriggerService.go | 11 +- .../trigger/devtronApps/TriggerService.go | 25 +- .../UserDeploymentRequestRepository.go | 4 +- .../in/AppStoreAppsEventProcessorService.go | 9 +- .../in/WorkflowEventProcessorService.go | 21 +- .../out/WorkflowEventPublishService.go | 11 +- .../AppDeploymentTypeChangeManager.go | 3 +- pkg/pipeline/CdHandler.go | 2 +- pkg/pipeline/CiHandler.go | 11 +- pkg/pipeline/CiService.go | 11 +- .../DeploymentPipelineConfigService.go | 5 +- pkg/pipeline/WorkflowService.go | 20 +- pkg/pipeline/WorkflowServiceIT_test.go | 9 +- .../history/ConfigMapHistoryService.go | 2 +- .../DeploymentTemplateHistoryService.go | 2 +- .../history/PipelineStrategyHistoryService.go | 2 +- pkg/pipeline/types/CiCdConfig.go | 147 ++-- pkg/pipeline/types/Workflow.go | 5 +- pkg/workflow/cd/CdWorkflowCommonService.go | 27 +- pkg/workflow/cd/bean/bean.go | 42 +- pkg/workflow/dag/WorkflowDagExecutor.go | 21 +- pkg/workflow/status/WorkflowStatusService.go | 21 +- ...01900_helm_app_deployment_message.down.sql | 3 + ...9001900_helm_app_deployment_message.up.sql | 3 + .../helmApp/deployment-history-api-spec.yaml | 244 ++++++ 56 files changed, 1533 insertions(+), 1075 deletions(-) create mode 100644 internal/sql/repository/pipelineConfig/bean/cdWorkflow/bean.go create mode 100644 scripts/sql/29001900_helm_app_deployment_message.down.sql create mode 100644 scripts/sql/29001900_helm_app_deployment_message.up.sql create mode 100644 specs/helmApp/deployment-history-api-spec.yaml diff --git a/api/appStore/deployment/CommonDeploymentRestHandler.go b/api/appStore/deployment/CommonDeploymentRestHandler.go index 0116386e9e..462c09b58a 100644 --- a/api/appStore/deployment/CommonDeploymentRestHandler.go +++ b/api/appStore/deployment/CommonDeploymentRestHandler.go @@ -171,7 +171,7 @@ func (handler *CommonDeploymentRestHandlerImpl) GetDeploymentHistory(w http.Resp } //rbac block ends here - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + ctx, cancel := context.WithTimeout(r.Context(), 30*time.Second) defer cancel() res, err := handler.appStoreDeploymentService.GetDeploymentHistory(ctx, installedAppDto) if err != nil { diff --git a/api/auth/user/UserRestHandler.go b/api/auth/user/UserRestHandler.go index 76a6342abe..187030b220 100644 --- a/api/auth/user/UserRestHandler.go +++ b/api/auth/user/UserRestHandler.go @@ -1038,7 +1038,7 @@ func (handler UserRestHandlerImpl) SyncOrchestratorToCasbin(w http.ResponseWrite common.WriteJsonResp(w, err, "Unauthorized User", http.StatusUnauthorized) return } - userEmailId, err := handler.userService.GetEmailById(userId) + userEmailId, err := handler.userService.GetActiveEmailById(userId) if err != nil { handler.logger.Errorw("service err, SyncOrchestratorToCasbin", "err", err, "userId", userId) common.WriteJsonResp(w, err, nil, http.StatusInternalServerError) diff --git a/api/helm-app/gRPC/applist.pb.go b/api/helm-app/gRPC/applist.pb.go index f2c54b4b67..9b2bd2ce39 100644 --- a/api/helm-app/gRPC/applist.pb.go +++ b/api/helm-app/gRPC/applist.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.28.1 // protoc v3.9.1 // source: api/helm-app/gRPC/applist.proto @@ -2192,6 +2192,7 @@ type HelmAppDeploymentDetail struct { DeployedAt *timestamp.Timestamp `protobuf:"bytes,4,opt,name=deployedAt,proto3" json:"deployedAt,omitempty"` DeployedBy string `protobuf:"bytes,5,opt,name=deployedBy,proto3" json:"deployedBy,omitempty"` Status string `protobuf:"bytes,6,opt,name=status,proto3" json:"status,omitempty"` + Message string `protobuf:"bytes,7,opt,name=message,proto3" json:"message,omitempty"` } func (x *HelmAppDeploymentDetail) Reset() { @@ -2268,6 +2269,13 @@ func (x *HelmAppDeploymentDetail) GetStatus() string { return "" } +func (x *HelmAppDeploymentDetail) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + type HelmAppDeploymentHistory struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -4521,7 +4529,7 @@ var file_api_helm_app_gRPC_applist_proto_rawDesc = []byte{ 0x72, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x81, 0x02, 0x0a, 0x17, 0x48, 0x65, 0x6c, 0x6d, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x9b, 0x02, 0x0a, 0x17, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x34, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x68, 0x61, @@ -4537,400 +4545,402 @@ var file_api_helm_app_gRPC_applist_proto_rawDesc = []byte{ 0x64, 0x41, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x42, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x42, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x62, 0x0a, 0x18, 0x48, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x62, 0x0a, 0x18, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, + 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, + 0x79, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, + 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x46, 0x0a, 0x11, 0x64, 0x65, 0x70, 0x6c, 0x6f, - 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x44, 0x65, 0x70, 0x6c, - 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x11, 0x64, 0x65, - 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x22, - 0x85, 0x02, 0x0a, 0x0b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x40, 0x0a, 0x11, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x41, 0x70, 0x70, 0x44, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x44, 0x65, 0x70, - 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x11, - 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, - 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x72, - 0x69, 0x64, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, - 0x22, 0x0a, 0x0c, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x61, 0x64, 0x6d, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x61, 0x64, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4a, 0x73, 0x6f, 0x6e, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x53, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x4a, 0x73, 0x6f, 0x6e, 0x22, 0xd2, 0x01, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x0d, 0x63, 0x6c, 0x75, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x11, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, + 0x6e, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x40, 0x0a, 0x11, 0x64, 0x65, 0x70, + 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x41, + 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x11, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, + 0x65, 0x64, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x24, 0x0a, 0x0d, 0x64, + 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x72, + 0x69, 0x64, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x65, 0x72, + 0x67, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x65, 0x61, 0x64, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x65, 0x61, 0x64, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4a, 0x73, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4a, 0x73, 0x6f, + 0x6e, 0x22, 0xd2, 0x01, 0x0a, 0x0d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3d, 0x0a, 0x10, 0x6f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x10, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x35, 0x0a, 0x17, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, + 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x22, 0x34, 0x0a, + 0x18, 0x55, 0x6e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x22, 0x97, 0x01, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x3d, 0x0a, 0x10, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x10, 0x6f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x20, - 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, - 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x35, 0x0a, 0x17, - 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, - 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, - 0x65, 0x73, 0x74, 0x22, 0x34, 0x0a, 0x18, 0x55, 0x6e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, - 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x97, 0x01, 0x0a, 0x11, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, - 0x34, 0x0a, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x10, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, 0x0a, 0x15, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, - 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x72, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, - 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x12, - 0x1e, 0x0a, 0x0a, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0a, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x12, - 0x31, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, 0x12, 0x1e, - 0x0a, 0x0a, 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x32, - 0x0a, 0x16, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x17, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, - 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, - 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x72, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x12, 0x2c, 0x0a, 0x11, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x64, 0x65, 0x70, - 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x56, - 0x0a, 0x18, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, - 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, - 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, - 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x59, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x22, 0xa9, 0x01, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x72, 0x74, - 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, - 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x38, 0x0a, 0x17, 0x61, 0x6c, 0x6c, 0x6f, - 0x77, 0x49, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x49, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0xa7, 0x04, 0x0a, 0x15, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x11, - 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x72, 0x65, 0x6c, - 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1c, - 0x0a, 0x09, 0x63, 0x68, 0x61, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, - 0x63, 0x68, 0x61, 0x72, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, - 0x12, 0x3a, 0x0a, 0x0f, 0x63, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, - 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x43, 0x68, 0x61, 0x72, - 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x63, 0x68, 0x61, - 0x72, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, - 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, - 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x0a, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x12, 0x43, 0x0a, 0x12, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, - 0x74, 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x12, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x73, 0x4f, 0x43, 0x49, 0x52, 0x65, 0x70, 0x6f, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x49, 0x73, 0x4f, 0x43, 0x49, 0x52, 0x65, 0x70, 0x6f, 0x12, - 0x3e, 0x0a, 0x1a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x1a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, - 0x31, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x71, 0x0a, 0x19, - 0x42, 0x75, 0x6c, 0x6b, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x54, 0x0a, 0x19, 0x42, 0x75, 0x6c, - 0x6b, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x52, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, - 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x32, 0x0a, 0x16, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x22, 0x29, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x74, - 0x0a, 0x16, 0x52, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, + 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x72, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x88, 0x02, + 0x0a, 0x15, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x69, 0x73, + 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x68, + 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x68, 0x61, + 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x0c, + 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, + 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x4b, 0x38, 0x73, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4b, 0x38, + 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x32, 0x0a, 0x16, 0x55, 0x70, 0x67, 0x72, + 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x89, 0x01, 0x0a, + 0x17, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5f, 0x0a, 0x15, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, - 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, - 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, - 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, - 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x71, 0x0a, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x54, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x54, 0x0a, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, - 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x19, 0x42, - 0x75, 0x6c, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xeb, 0x01, 0x0a, 0x18, 0x48, 0x65, 0x6c, - 0x6d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, - 0x61, 0x6d, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x68, - 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, - 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x75, - 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x52, 0x75, - 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4b, 0x38, 0x73, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x35, 0x0a, 0x19, 0x48, 0x65, 0x6c, 0x6d, 0x49, 0x6e, - 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x28, 0x0a, - 0x0c, 0x43, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, - 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x49, 0x0a, 0x03, 0x47, 0x76, 0x6b, 0x12, 0x14, - 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, - 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4b, 0x69, - 0x6e, 0x64, 0x22, 0x6d, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, - 0x6c, 0x74, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x03, 0x67, 0x76, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x04, 0x2e, 0x47, 0x76, 0x6b, 0x52, 0x03, 0x67, 0x76, 0x6b, 0x12, 0x43, 0x0a, 0x12, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x12, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x22, 0x88, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, - 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, - 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x88, 0x01, 0x0a, - 0x12, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x72, 0x65, 0x65, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x0c, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x52, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0c, - 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x0f, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x22, 0x2a, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x72, 0x74, - 0x4e, 0x6f, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, - 0x74, 0x65, 0x73, 0x22, 0xeb, 0x03, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, - 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, 0x6f, - 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x41, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, - 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, - 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x22, - 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x49, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x49, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x4f, 0x0a, 0x16, 0x52, 0x65, - 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x52, 0x65, 0x6d, - 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x30, 0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x65, 0x72, 0x74, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x22, 0xd5, 0x01, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4f, 0x0a, 0x16, - 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x52, - 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x2e, 0x0a, - 0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3a, 0x0a, - 0x0f, 0x53, 0x53, 0x48, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x53, 0x53, 0x48, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0f, 0x53, 0x53, 0x48, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x29, 0x0a, 0x0b, 0x50, 0x72, 0x6f, - 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x78, - 0x79, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x78, - 0x79, 0x55, 0x72, 0x6c, 0x22, 0xa1, 0x01, 0x0a, 0x0f, 0x53, 0x53, 0x48, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, 0x0a, 0x10, 0x53, 0x53, 0x48, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x10, 0x53, 0x53, 0x48, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x53, 0x48, 0x55, 0x73, 0x65, 0x72, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x53, 0x53, 0x48, 0x55, 0x73, - 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x53, 0x48, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x53, 0x53, 0x48, - 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x53, 0x48, 0x41, - 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x53, - 0x48, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x22, 0x35, 0x0a, 0x13, 0x4f, 0x43, 0x49, 0x52, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x1e, 0x0a, 0x0a, 0x49, 0x73, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0a, 0x49, 0x73, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x2a, - 0x38, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x52, 0x4f, - 0x58, 0x59, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x53, 0x53, 0x48, 0x10, 0x01, 0x12, 0x0a, 0x0a, - 0x06, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x10, 0x02, 0x32, 0xa6, 0x0d, 0x0a, 0x12, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x39, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0f, 0x2e, 0x41, 0x70, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, - 0x41, 0x70, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x41, 0x0a, 0x14, 0x4c, - 0x69, 0x73, 0x74, 0x46, 0x6c, 0x75, 0x78, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x12, 0x0f, 0x2e, 0x41, 0x70, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x46, 0x6c, 0x75, 0x78, 0x41, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x2f, - 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x11, - 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x0a, 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x00, 0x12, - 0x2f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x11, 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0a, 0x2e, 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x00, - 0x12, 0x34, 0x0a, 0x09, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x11, 0x2e, - 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x12, 0x2e, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0b, 0x55, 0x6e, 0x48, 0x69, 0x62, 0x65, - 0x72, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x11, 0x2e, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x48, 0x69, 0x62, 0x65, 0x72, - 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, - 0x0a, 0x14, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, - 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x11, 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, - 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x48, 0x65, 0x6c, 0x6d, - 0x41, 0x70, 0x70, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x69, 0x73, - 0x74, 0x6f, 0x72, 0x79, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x11, 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x52, 0x65, 0x6c, - 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x12, 0x47, 0x65, - 0x74, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x18, 0x2e, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x10, - 0x55, 0x6e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x12, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x1a, 0x19, 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, - 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x12, 0x16, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, - 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x55, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4c, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, - 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x2e, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x16, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, - 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, - 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x1b, 0x55, 0x70, 0x67, - 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x43, - 0x68, 0x61, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x11, 0x64, 0x65, + 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x56, 0x0a, 0x18, 0x44, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, + 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, + 0x22, 0xa9, 0x01, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x12, 0x38, 0x0a, 0x17, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x49, 0x6e, 0x73, 0x65, 0x63, + 0x75, 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x17, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x49, 0x6e, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa7, 0x04, 0x0a, + 0x15, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x72, + 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, + 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, + 0x61, 0x72, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x12, 0x3a, 0x0a, 0x0f, 0x63, 0x68, + 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x0f, 0x63, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x70, 0x6f, + 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4b, 0x38, 0x73, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, + 0x79, 0x4d, 0x61, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x68, 0x69, 0x73, 0x74, + 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x78, 0x12, 0x43, 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x72, 0x65, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x49, + 0x73, 0x4f, 0x43, 0x49, 0x52, 0x65, 0x70, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, + 0x49, 0x73, 0x4f, 0x43, 0x49, 0x52, 0x65, 0x70, 0x6f, 0x12, 0x3e, 0x0a, 0x1a, 0x69, 0x6e, 0x73, + 0x74, 0x61, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x69, + 0x73, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x1a, 0x69, + 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x0c, 0x63, 0x68, 0x61, + 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x0c, + 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x71, 0x0a, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x54, 0x0a, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x17, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x12, 0x49, - 0x73, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, - 0x64, 0x12, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x66, 0x69, 0x65, 0x72, 0x1a, 0x10, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0f, 0x52, 0x6f, 0x6c, - 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x17, 0x2e, 0x52, - 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0d, 0x54, 0x65, 0x6d, - 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x49, 0x6e, 0x73, - 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, - 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x11, - 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x42, 0x75, 0x6c, - 0x6b, 0x12, 0x1a, 0x2e, 0x42, 0x75, 0x6c, 0x6b, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, + 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x19, + 0x42, 0x75, 0x6c, 0x6b, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x32, 0x0a, 0x16, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x29, 0x0a, + 0x0f, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x74, 0x0a, 0x16, 0x52, 0x6f, 0x6c, 0x6c, + 0x62, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x40, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5f, + 0x0a, 0x15, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x61, 0x6e, + 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, + 0x71, 0x0a, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, + 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x1d, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, - 0x68, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x74, 0x12, 0x19, 0x2e, 0x48, - 0x65, 0x6c, 0x6d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x49, 0x6e, - 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x65, - 0x73, 0x12, 0x16, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x43, 0x68, 0x61, 0x72, - 0x74, 0x4e, 0x6f, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x52, 0x0a, 0x1d, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x68, 0x61, 0x72, - 0x74, 0x12, 0x16, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x55, 0x70, 0x67, 0x72, - 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x13, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x4f, 0x43, 0x49, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x13, 0x2e, 0x52, 0x65, - 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, - 0x1a, 0x14, 0x2e, 0x4f, 0x43, 0x49, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5c, 0x0a, 0x23, 0x47, 0x65, 0x74, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x72, 0x65, 0x65, 0x46, 0x6f, 0x72, 0x45, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, - 0x1c, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x75, - 0x78, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x15, 0x2e, 0x46, 0x6c, 0x75, - 0x78, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x0e, 0x2e, 0x46, 0x6c, 0x75, 0x78, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x1a, 0x12, 0x2e, 0x44, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x64, 0x65, 0x76, 0x74, 0x72, 0x6f, 0x6e, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6b, 0x75, - 0x62, 0x65, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x62, 0x65, 0x61, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, - 0x2f, 0x67, 0x52, 0x50, 0x43, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x19, 0x42, 0x75, 0x6c, 0x6b, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0xeb, 0x01, 0x0a, 0x18, 0x48, 0x65, 0x6c, 0x6d, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, 0x6c, 0x12, + 0x31, 0x0a, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x72, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x52, 0x11, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x52, 0x75, 0x6e, 0x49, 0x6e, 0x43, 0x74, 0x78, + 0x12, 0x1e, 0x0a, 0x0a, 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4b, 0x38, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x22, 0x35, 0x0a, 0x19, 0x48, 0x65, 0x6c, 0x6d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x43, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x28, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x72, 0x74, + 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x22, 0x49, 0x0a, 0x03, 0x47, 0x76, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x18, + 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x22, 0x6d, 0x0a, 0x0e, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x16, + 0x0a, 0x03, 0x67, 0x76, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x04, 0x2e, 0x47, 0x76, + 0x6b, 0x52, 0x03, 0x67, 0x76, 0x6b, 0x12, 0x43, 0x0a, 0x12, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x12, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0x88, 0x01, 0x0a, 0x12, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x12, 0x37, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x88, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x54, 0x72, 0x65, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x37, 0x0a, + 0x0c, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x0c, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x52, 0x0f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, + 0x73, 0x22, 0x2a, 0x0a, 0x12, 0x43, 0x68, 0x61, 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x74, 0x65, 0x73, 0x22, 0xeb, 0x03, + 0x0a, 0x12, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x61, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x41, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x41, 0x77, 0x73, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, + 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, + 0x52, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x52, 0x65, 0x70, 0x6f, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, 0x73, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x12, 0x4f, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, + 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, + 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x16, 0x52, + 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x13, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x22, 0xd5, 0x01, 0x0a, 0x16, + 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x4f, 0x0a, 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, + 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, + 0x16, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x2e, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, + 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x78, + 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3a, 0x0a, 0x0f, 0x53, 0x53, 0x48, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x10, 0x2e, 0x53, 0x53, 0x48, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x0f, 0x53, 0x53, 0x48, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x22, 0x29, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x72, 0x6c, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x72, 0x6c, 0x22, 0xa1, + 0x01, 0x0a, 0x0f, 0x53, 0x53, 0x48, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x12, 0x2a, 0x0a, 0x10, 0x53, 0x53, 0x48, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x53, 0x53, + 0x48, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, + 0x0a, 0x0b, 0x53, 0x53, 0x48, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x53, 0x53, 0x48, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x53, 0x48, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x53, 0x53, 0x48, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x53, 0x48, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x53, 0x48, 0x41, 0x75, 0x74, 0x68, 0x4b, + 0x65, 0x79, 0x22, 0x35, 0x0a, 0x13, 0x4f, 0x43, 0x49, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x73, 0x4c, + 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x49, + 0x73, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x64, 0x49, 0x6e, 0x2a, 0x38, 0x0a, 0x16, 0x52, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x52, 0x4f, 0x58, 0x59, 0x10, 0x00, 0x12, 0x07, + 0x0a, 0x03, 0x53, 0x53, 0x48, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x49, 0x52, 0x45, 0x43, + 0x54, 0x10, 0x02, 0x32, 0xa6, 0x0d, 0x0a, 0x12, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x39, 0x0a, 0x10, 0x4c, 0x69, + 0x73, 0x74, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0f, + 0x2e, 0x41, 0x70, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x10, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, 0x64, 0x41, 0x70, 0x70, 0x4c, 0x69, 0x73, + 0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x41, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x6c, 0x75, + 0x78, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x0f, 0x2e, + 0x41, 0x70, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, + 0x2e, 0x46, 0x6c, 0x75, 0x78, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x4c, 0x69, 0x73, 0x74, 0x22, 0x00, 0x30, 0x01, 0x12, 0x2f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x41, + 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x11, 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0a, 0x2e, 0x41, 0x70, + 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x00, 0x12, 0x2f, 0x0a, 0x0c, 0x47, 0x65, 0x74, + 0x41, 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x11, 0x2e, 0x41, 0x70, 0x70, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0a, 0x2e, 0x41, + 0x70, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x48, 0x69, + 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x12, 0x11, 0x2e, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x48, 0x69, 0x62, + 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x36, 0x0a, 0x0b, 0x55, 0x6e, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x12, + 0x11, 0x2e, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x48, 0x69, 0x62, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x44, + 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, + 0x12, 0x11, 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x41, 0x70, 0x70, 0x44, 0x65, 0x70, + 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x00, + 0x12, 0x32, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x59, 0x61, 0x6d, + 0x6c, 0x12, 0x11, 0x2e, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x44, 0x65, 0x73, 0x69, 0x72, + 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x2e, 0x4f, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x44, 0x65, 0x73, + 0x69, 0x72, 0x65, 0x64, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x10, 0x55, 0x6e, 0x69, 0x6e, 0x73, 0x74, + 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x12, 0x2e, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x1a, 0x19, + 0x2e, 0x55, 0x6e, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x55, + 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x16, 0x2e, + 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x4c, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x18, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x19, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, + 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x12, 0x16, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x1b, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x43, 0x68, 0x61, 0x72, 0x74, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x16, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x55, 0x70, 0x67, + 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x12, 0x49, 0x73, 0x52, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x12, 0x2e, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x1a, + 0x10, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0f, 0x52, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x17, 0x2e, 0x52, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, + 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x10, 0x2e, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x0d, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, + 0x68, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x54, + 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4d, 0x0a, 0x11, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x42, 0x75, 0x6c, 0x6b, 0x12, 0x1a, 0x2e, 0x42, 0x75, + 0x6c, 0x6b, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x42, 0x75, 0x6c, 0x6b, 0x54, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x1d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, + 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x43, 0x68, 0x61, 0x72, 0x74, 0x12, 0x19, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6c, 0x6c, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1a, 0x2e, 0x48, 0x65, 0x6c, 0x6d, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x43, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x39, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x65, 0x73, 0x12, 0x16, 0x2e, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x43, 0x68, 0x61, 0x72, 0x74, 0x4e, 0x6f, 0x74, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x1d, 0x55, 0x70, + 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, + 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x68, 0x61, 0x72, 0x74, 0x12, 0x16, 0x2e, 0x55, 0x70, + 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, + 0x0a, 0x13, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x43, 0x49, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x13, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, + 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x1a, 0x14, 0x2e, 0x4f, 0x43, 0x49, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x5c, 0x0a, 0x23, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x54, 0x72, 0x65, 0x65, 0x46, 0x6f, 0x72, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x1c, 0x2e, 0x45, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x72, 0x65, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x54, 0x72, 0x65, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x3b, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x46, 0x6c, 0x75, 0x78, 0x41, 0x70, 0x70, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x12, 0x15, 0x2e, 0x46, 0x6c, 0x75, 0x78, 0x41, 0x70, 0x70, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x46, 0x6c, + 0x75, 0x78, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x00, 0x12, 0x3d, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x12, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x1a, 0x12, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x65, + 0x64, 0x41, 0x70, 0x70, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x76, 0x74, 0x72, + 0x6f, 0x6e, 0x2d, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x6c, 0x69, 0x6e, 0x6b, + 0x2f, 0x62, 0x65, 0x61, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x52, 0x50, 0x43, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/helm-app/gRPC/applist.proto b/api/helm-app/gRPC/applist.proto index f904a4b25d..8bb8de371f 100644 --- a/api/helm-app/gRPC/applist.proto +++ b/api/helm-app/gRPC/applist.proto @@ -252,6 +252,7 @@ message HelmAppDeploymentDetail { google.protobuf.Timestamp deployedAt = 4; string deployedBy = 5; string status = 6; + string message = 7; } message HelmAppDeploymentHistory { diff --git a/api/helm-app/gRPC/applist_grpc.pb.go b/api/helm-app/gRPC/applist_grpc.pb.go index ee3364edc5..fabade6bcb 100644 --- a/api/helm-app/gRPC/applist_grpc.pb.go +++ b/api/helm-app/gRPC/applist_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.2.0 // - protoc v3.9.1 // source: api/helm-app/gRPC/applist.proto @@ -18,34 +18,6 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 -const ( - ApplicationService_ListApplications_FullMethodName = "/ApplicationService/ListApplications" - ApplicationService_ListFluxApplications_FullMethodName = "/ApplicationService/ListFluxApplications" - ApplicationService_GetAppDetail_FullMethodName = "/ApplicationService/GetAppDetail" - ApplicationService_GetAppStatus_FullMethodName = "/ApplicationService/GetAppStatus" - ApplicationService_Hibernate_FullMethodName = "/ApplicationService/Hibernate" - ApplicationService_UnHibernate_FullMethodName = "/ApplicationService/UnHibernate" - ApplicationService_GetDeploymentHistory_FullMethodName = "/ApplicationService/GetDeploymentHistory" - ApplicationService_GetValuesYaml_FullMethodName = "/ApplicationService/GetValuesYaml" - ApplicationService_GetDesiredManifest_FullMethodName = "/ApplicationService/GetDesiredManifest" - ApplicationService_UninstallRelease_FullMethodName = "/ApplicationService/UninstallRelease" - ApplicationService_UpgradeRelease_FullMethodName = "/ApplicationService/UpgradeRelease" - ApplicationService_GetDeploymentDetail_FullMethodName = "/ApplicationService/GetDeploymentDetail" - ApplicationService_InstallRelease_FullMethodName = "/ApplicationService/InstallRelease" - ApplicationService_UpgradeReleaseWithChartInfo_FullMethodName = "/ApplicationService/UpgradeReleaseWithChartInfo" - ApplicationService_IsReleaseInstalled_FullMethodName = "/ApplicationService/IsReleaseInstalled" - ApplicationService_RollbackRelease_FullMethodName = "/ApplicationService/RollbackRelease" - ApplicationService_TemplateChart_FullMethodName = "/ApplicationService/TemplateChart" - ApplicationService_TemplateChartBulk_FullMethodName = "/ApplicationService/TemplateChartBulk" - ApplicationService_InstallReleaseWithCustomChart_FullMethodName = "/ApplicationService/InstallReleaseWithCustomChart" - ApplicationService_GetNotes_FullMethodName = "/ApplicationService/GetNotes" - ApplicationService_UpgradeReleaseWithCustomChart_FullMethodName = "/ApplicationService/UpgradeReleaseWithCustomChart" - ApplicationService_ValidateOCIRegistry_FullMethodName = "/ApplicationService/ValidateOCIRegistry" - ApplicationService_GetResourceTreeForExternalResources_FullMethodName = "/ApplicationService/GetResourceTreeForExternalResources" - ApplicationService_GetFluxAppDetail_FullMethodName = "/ApplicationService/GetFluxAppDetail" - ApplicationService_GetReleaseDetails_FullMethodName = "/ApplicationService/GetReleaseDetails" -) - // ApplicationServiceClient is the client API for ApplicationService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -86,7 +58,7 @@ func NewApplicationServiceClient(cc grpc.ClientConnInterface) ApplicationService } func (c *applicationServiceClient) ListApplications(ctx context.Context, in *AppListRequest, opts ...grpc.CallOption) (ApplicationService_ListApplicationsClient, error) { - stream, err := c.cc.NewStream(ctx, &ApplicationService_ServiceDesc.Streams[0], ApplicationService_ListApplications_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &ApplicationService_ServiceDesc.Streams[0], "/ApplicationService/ListApplications", opts...) if err != nil { return nil, err } @@ -118,7 +90,7 @@ func (x *applicationServiceListApplicationsClient) Recv() (*DeployedAppList, err } func (c *applicationServiceClient) ListFluxApplications(ctx context.Context, in *AppListRequest, opts ...grpc.CallOption) (ApplicationService_ListFluxApplicationsClient, error) { - stream, err := c.cc.NewStream(ctx, &ApplicationService_ServiceDesc.Streams[1], ApplicationService_ListFluxApplications_FullMethodName, opts...) + stream, err := c.cc.NewStream(ctx, &ApplicationService_ServiceDesc.Streams[1], "/ApplicationService/ListFluxApplications", opts...) if err != nil { return nil, err } @@ -151,7 +123,7 @@ func (x *applicationServiceListFluxApplicationsClient) Recv() (*FluxApplicationL func (c *applicationServiceClient) GetAppDetail(ctx context.Context, in *AppDetailRequest, opts ...grpc.CallOption) (*AppDetail, error) { out := new(AppDetail) - err := c.cc.Invoke(ctx, ApplicationService_GetAppDetail_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetAppDetail", in, out, opts...) if err != nil { return nil, err } @@ -160,7 +132,7 @@ func (c *applicationServiceClient) GetAppDetail(ctx context.Context, in *AppDeta func (c *applicationServiceClient) GetAppStatus(ctx context.Context, in *AppDetailRequest, opts ...grpc.CallOption) (*AppStatus, error) { out := new(AppStatus) - err := c.cc.Invoke(ctx, ApplicationService_GetAppStatus_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetAppStatus", in, out, opts...) if err != nil { return nil, err } @@ -169,7 +141,7 @@ func (c *applicationServiceClient) GetAppStatus(ctx context.Context, in *AppDeta func (c *applicationServiceClient) Hibernate(ctx context.Context, in *HibernateRequest, opts ...grpc.CallOption) (*HibernateResponse, error) { out := new(HibernateResponse) - err := c.cc.Invoke(ctx, ApplicationService_Hibernate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/Hibernate", in, out, opts...) if err != nil { return nil, err } @@ -178,7 +150,7 @@ func (c *applicationServiceClient) Hibernate(ctx context.Context, in *HibernateR func (c *applicationServiceClient) UnHibernate(ctx context.Context, in *HibernateRequest, opts ...grpc.CallOption) (*HibernateResponse, error) { out := new(HibernateResponse) - err := c.cc.Invoke(ctx, ApplicationService_UnHibernate_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/UnHibernate", in, out, opts...) if err != nil { return nil, err } @@ -187,7 +159,7 @@ func (c *applicationServiceClient) UnHibernate(ctx context.Context, in *Hibernat func (c *applicationServiceClient) GetDeploymentHistory(ctx context.Context, in *AppDetailRequest, opts ...grpc.CallOption) (*HelmAppDeploymentHistory, error) { out := new(HelmAppDeploymentHistory) - err := c.cc.Invoke(ctx, ApplicationService_GetDeploymentHistory_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetDeploymentHistory", in, out, opts...) if err != nil { return nil, err } @@ -196,7 +168,7 @@ func (c *applicationServiceClient) GetDeploymentHistory(ctx context.Context, in func (c *applicationServiceClient) GetValuesYaml(ctx context.Context, in *AppDetailRequest, opts ...grpc.CallOption) (*ReleaseInfo, error) { out := new(ReleaseInfo) - err := c.cc.Invoke(ctx, ApplicationService_GetValuesYaml_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetValuesYaml", in, out, opts...) if err != nil { return nil, err } @@ -205,7 +177,7 @@ func (c *applicationServiceClient) GetValuesYaml(ctx context.Context, in *AppDet func (c *applicationServiceClient) GetDesiredManifest(ctx context.Context, in *ObjectRequest, opts ...grpc.CallOption) (*DesiredManifestResponse, error) { out := new(DesiredManifestResponse) - err := c.cc.Invoke(ctx, ApplicationService_GetDesiredManifest_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetDesiredManifest", in, out, opts...) if err != nil { return nil, err } @@ -214,7 +186,7 @@ func (c *applicationServiceClient) GetDesiredManifest(ctx context.Context, in *O func (c *applicationServiceClient) UninstallRelease(ctx context.Context, in *ReleaseIdentifier, opts ...grpc.CallOption) (*UninstallReleaseResponse, error) { out := new(UninstallReleaseResponse) - err := c.cc.Invoke(ctx, ApplicationService_UninstallRelease_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/UninstallRelease", in, out, opts...) if err != nil { return nil, err } @@ -223,7 +195,7 @@ func (c *applicationServiceClient) UninstallRelease(ctx context.Context, in *Rel func (c *applicationServiceClient) UpgradeRelease(ctx context.Context, in *UpgradeReleaseRequest, opts ...grpc.CallOption) (*UpgradeReleaseResponse, error) { out := new(UpgradeReleaseResponse) - err := c.cc.Invoke(ctx, ApplicationService_UpgradeRelease_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/UpgradeRelease", in, out, opts...) if err != nil { return nil, err } @@ -232,7 +204,7 @@ func (c *applicationServiceClient) UpgradeRelease(ctx context.Context, in *Upgra func (c *applicationServiceClient) GetDeploymentDetail(ctx context.Context, in *DeploymentDetailRequest, opts ...grpc.CallOption) (*DeploymentDetailResponse, error) { out := new(DeploymentDetailResponse) - err := c.cc.Invoke(ctx, ApplicationService_GetDeploymentDetail_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetDeploymentDetail", in, out, opts...) if err != nil { return nil, err } @@ -241,7 +213,7 @@ func (c *applicationServiceClient) GetDeploymentDetail(ctx context.Context, in * func (c *applicationServiceClient) InstallRelease(ctx context.Context, in *InstallReleaseRequest, opts ...grpc.CallOption) (*InstallReleaseResponse, error) { out := new(InstallReleaseResponse) - err := c.cc.Invoke(ctx, ApplicationService_InstallRelease_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/InstallRelease", in, out, opts...) if err != nil { return nil, err } @@ -250,7 +222,7 @@ func (c *applicationServiceClient) InstallRelease(ctx context.Context, in *Insta func (c *applicationServiceClient) UpgradeReleaseWithChartInfo(ctx context.Context, in *InstallReleaseRequest, opts ...grpc.CallOption) (*UpgradeReleaseResponse, error) { out := new(UpgradeReleaseResponse) - err := c.cc.Invoke(ctx, ApplicationService_UpgradeReleaseWithChartInfo_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/UpgradeReleaseWithChartInfo", in, out, opts...) if err != nil { return nil, err } @@ -259,7 +231,7 @@ func (c *applicationServiceClient) UpgradeReleaseWithChartInfo(ctx context.Conte func (c *applicationServiceClient) IsReleaseInstalled(ctx context.Context, in *ReleaseIdentifier, opts ...grpc.CallOption) (*BooleanResponse, error) { out := new(BooleanResponse) - err := c.cc.Invoke(ctx, ApplicationService_IsReleaseInstalled_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/IsReleaseInstalled", in, out, opts...) if err != nil { return nil, err } @@ -268,7 +240,7 @@ func (c *applicationServiceClient) IsReleaseInstalled(ctx context.Context, in *R func (c *applicationServiceClient) RollbackRelease(ctx context.Context, in *RollbackReleaseRequest, opts ...grpc.CallOption) (*BooleanResponse, error) { out := new(BooleanResponse) - err := c.cc.Invoke(ctx, ApplicationService_RollbackRelease_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/RollbackRelease", in, out, opts...) if err != nil { return nil, err } @@ -277,7 +249,7 @@ func (c *applicationServiceClient) RollbackRelease(ctx context.Context, in *Roll func (c *applicationServiceClient) TemplateChart(ctx context.Context, in *InstallReleaseRequest, opts ...grpc.CallOption) (*TemplateChartResponse, error) { out := new(TemplateChartResponse) - err := c.cc.Invoke(ctx, ApplicationService_TemplateChart_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/TemplateChart", in, out, opts...) if err != nil { return nil, err } @@ -286,7 +258,7 @@ func (c *applicationServiceClient) TemplateChart(ctx context.Context, in *Instal func (c *applicationServiceClient) TemplateChartBulk(ctx context.Context, in *BulkInstallReleaseRequest, opts ...grpc.CallOption) (*BulkTemplateChartResponse, error) { out := new(BulkTemplateChartResponse) - err := c.cc.Invoke(ctx, ApplicationService_TemplateChartBulk_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/TemplateChartBulk", in, out, opts...) if err != nil { return nil, err } @@ -295,7 +267,7 @@ func (c *applicationServiceClient) TemplateChartBulk(ctx context.Context, in *Bu func (c *applicationServiceClient) InstallReleaseWithCustomChart(ctx context.Context, in *HelmInstallCustomRequest, opts ...grpc.CallOption) (*HelmInstallCustomResponse, error) { out := new(HelmInstallCustomResponse) - err := c.cc.Invoke(ctx, ApplicationService_InstallReleaseWithCustomChart_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/InstallReleaseWithCustomChart", in, out, opts...) if err != nil { return nil, err } @@ -304,7 +276,7 @@ func (c *applicationServiceClient) InstallReleaseWithCustomChart(ctx context.Con func (c *applicationServiceClient) GetNotes(ctx context.Context, in *InstallReleaseRequest, opts ...grpc.CallOption) (*ChartNotesResponse, error) { out := new(ChartNotesResponse) - err := c.cc.Invoke(ctx, ApplicationService_GetNotes_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetNotes", in, out, opts...) if err != nil { return nil, err } @@ -313,7 +285,7 @@ func (c *applicationServiceClient) GetNotes(ctx context.Context, in *InstallRele func (c *applicationServiceClient) UpgradeReleaseWithCustomChart(ctx context.Context, in *UpgradeReleaseRequest, opts ...grpc.CallOption) (*UpgradeReleaseResponse, error) { out := new(UpgradeReleaseResponse) - err := c.cc.Invoke(ctx, ApplicationService_UpgradeReleaseWithCustomChart_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/UpgradeReleaseWithCustomChart", in, out, opts...) if err != nil { return nil, err } @@ -322,7 +294,7 @@ func (c *applicationServiceClient) UpgradeReleaseWithCustomChart(ctx context.Con func (c *applicationServiceClient) ValidateOCIRegistry(ctx context.Context, in *RegistryCredential, opts ...grpc.CallOption) (*OCIRegistryResponse, error) { out := new(OCIRegistryResponse) - err := c.cc.Invoke(ctx, ApplicationService_ValidateOCIRegistry_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/ValidateOCIRegistry", in, out, opts...) if err != nil { return nil, err } @@ -331,7 +303,7 @@ func (c *applicationServiceClient) ValidateOCIRegistry(ctx context.Context, in * func (c *applicationServiceClient) GetResourceTreeForExternalResources(ctx context.Context, in *ExternalResourceTreeRequest, opts ...grpc.CallOption) (*ResourceTreeResponse, error) { out := new(ResourceTreeResponse) - err := c.cc.Invoke(ctx, ApplicationService_GetResourceTreeForExternalResources_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetResourceTreeForExternalResources", in, out, opts...) if err != nil { return nil, err } @@ -340,7 +312,7 @@ func (c *applicationServiceClient) GetResourceTreeForExternalResources(ctx conte func (c *applicationServiceClient) GetFluxAppDetail(ctx context.Context, in *FluxAppDetailRequest, opts ...grpc.CallOption) (*FluxAppDetail, error) { out := new(FluxAppDetail) - err := c.cc.Invoke(ctx, ApplicationService_GetFluxAppDetail_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetFluxAppDetail", in, out, opts...) if err != nil { return nil, err } @@ -349,7 +321,7 @@ func (c *applicationServiceClient) GetFluxAppDetail(ctx context.Context, in *Flu func (c *applicationServiceClient) GetReleaseDetails(ctx context.Context, in *ReleaseIdentifier, opts ...grpc.CallOption) (*DeployedAppDetail, error) { out := new(DeployedAppDetail) - err := c.cc.Invoke(ctx, ApplicationService_GetReleaseDetails_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, "/ApplicationService/GetReleaseDetails", in, out, opts...) if err != nil { return nil, err } @@ -532,7 +504,7 @@ func _ApplicationService_GetAppDetail_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetAppDetail_FullMethodName, + FullMethod: "/ApplicationService/GetAppDetail", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetAppDetail(ctx, req.(*AppDetailRequest)) @@ -550,7 +522,7 @@ func _ApplicationService_GetAppStatus_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetAppStatus_FullMethodName, + FullMethod: "/ApplicationService/GetAppStatus", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetAppStatus(ctx, req.(*AppDetailRequest)) @@ -568,7 +540,7 @@ func _ApplicationService_Hibernate_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_Hibernate_FullMethodName, + FullMethod: "/ApplicationService/Hibernate", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).Hibernate(ctx, req.(*HibernateRequest)) @@ -586,7 +558,7 @@ func _ApplicationService_UnHibernate_Handler(srv interface{}, ctx context.Contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_UnHibernate_FullMethodName, + FullMethod: "/ApplicationService/UnHibernate", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).UnHibernate(ctx, req.(*HibernateRequest)) @@ -604,7 +576,7 @@ func _ApplicationService_GetDeploymentHistory_Handler(srv interface{}, ctx conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetDeploymentHistory_FullMethodName, + FullMethod: "/ApplicationService/GetDeploymentHistory", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetDeploymentHistory(ctx, req.(*AppDetailRequest)) @@ -622,7 +594,7 @@ func _ApplicationService_GetValuesYaml_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetValuesYaml_FullMethodName, + FullMethod: "/ApplicationService/GetValuesYaml", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetValuesYaml(ctx, req.(*AppDetailRequest)) @@ -640,7 +612,7 @@ func _ApplicationService_GetDesiredManifest_Handler(srv interface{}, ctx context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetDesiredManifest_FullMethodName, + FullMethod: "/ApplicationService/GetDesiredManifest", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetDesiredManifest(ctx, req.(*ObjectRequest)) @@ -658,7 +630,7 @@ func _ApplicationService_UninstallRelease_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_UninstallRelease_FullMethodName, + FullMethod: "/ApplicationService/UninstallRelease", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).UninstallRelease(ctx, req.(*ReleaseIdentifier)) @@ -676,7 +648,7 @@ func _ApplicationService_UpgradeRelease_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_UpgradeRelease_FullMethodName, + FullMethod: "/ApplicationService/UpgradeRelease", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).UpgradeRelease(ctx, req.(*UpgradeReleaseRequest)) @@ -694,7 +666,7 @@ func _ApplicationService_GetDeploymentDetail_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetDeploymentDetail_FullMethodName, + FullMethod: "/ApplicationService/GetDeploymentDetail", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetDeploymentDetail(ctx, req.(*DeploymentDetailRequest)) @@ -712,7 +684,7 @@ func _ApplicationService_InstallRelease_Handler(srv interface{}, ctx context.Con } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_InstallRelease_FullMethodName, + FullMethod: "/ApplicationService/InstallRelease", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).InstallRelease(ctx, req.(*InstallReleaseRequest)) @@ -730,7 +702,7 @@ func _ApplicationService_UpgradeReleaseWithChartInfo_Handler(srv interface{}, ct } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_UpgradeReleaseWithChartInfo_FullMethodName, + FullMethod: "/ApplicationService/UpgradeReleaseWithChartInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).UpgradeReleaseWithChartInfo(ctx, req.(*InstallReleaseRequest)) @@ -748,7 +720,7 @@ func _ApplicationService_IsReleaseInstalled_Handler(srv interface{}, ctx context } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_IsReleaseInstalled_FullMethodName, + FullMethod: "/ApplicationService/IsReleaseInstalled", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).IsReleaseInstalled(ctx, req.(*ReleaseIdentifier)) @@ -766,7 +738,7 @@ func _ApplicationService_RollbackRelease_Handler(srv interface{}, ctx context.Co } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_RollbackRelease_FullMethodName, + FullMethod: "/ApplicationService/RollbackRelease", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).RollbackRelease(ctx, req.(*RollbackReleaseRequest)) @@ -784,7 +756,7 @@ func _ApplicationService_TemplateChart_Handler(srv interface{}, ctx context.Cont } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_TemplateChart_FullMethodName, + FullMethod: "/ApplicationService/TemplateChart", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).TemplateChart(ctx, req.(*InstallReleaseRequest)) @@ -802,7 +774,7 @@ func _ApplicationService_TemplateChartBulk_Handler(srv interface{}, ctx context. } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_TemplateChartBulk_FullMethodName, + FullMethod: "/ApplicationService/TemplateChartBulk", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).TemplateChartBulk(ctx, req.(*BulkInstallReleaseRequest)) @@ -820,7 +792,7 @@ func _ApplicationService_InstallReleaseWithCustomChart_Handler(srv interface{}, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_InstallReleaseWithCustomChart_FullMethodName, + FullMethod: "/ApplicationService/InstallReleaseWithCustomChart", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).InstallReleaseWithCustomChart(ctx, req.(*HelmInstallCustomRequest)) @@ -838,7 +810,7 @@ func _ApplicationService_GetNotes_Handler(srv interface{}, ctx context.Context, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetNotes_FullMethodName, + FullMethod: "/ApplicationService/GetNotes", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetNotes(ctx, req.(*InstallReleaseRequest)) @@ -856,7 +828,7 @@ func _ApplicationService_UpgradeReleaseWithCustomChart_Handler(srv interface{}, } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_UpgradeReleaseWithCustomChart_FullMethodName, + FullMethod: "/ApplicationService/UpgradeReleaseWithCustomChart", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).UpgradeReleaseWithCustomChart(ctx, req.(*UpgradeReleaseRequest)) @@ -874,7 +846,7 @@ func _ApplicationService_ValidateOCIRegistry_Handler(srv interface{}, ctx contex } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_ValidateOCIRegistry_FullMethodName, + FullMethod: "/ApplicationService/ValidateOCIRegistry", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).ValidateOCIRegistry(ctx, req.(*RegistryCredential)) @@ -892,7 +864,7 @@ func _ApplicationService_GetResourceTreeForExternalResources_Handler(srv interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetResourceTreeForExternalResources_FullMethodName, + FullMethod: "/ApplicationService/GetResourceTreeForExternalResources", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetResourceTreeForExternalResources(ctx, req.(*ExternalResourceTreeRequest)) @@ -910,7 +882,7 @@ func _ApplicationService_GetFluxAppDetail_Handler(srv interface{}, ctx context.C } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetFluxAppDetail_FullMethodName, + FullMethod: "/ApplicationService/GetFluxAppDetail", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetFluxAppDetail(ctx, req.(*FluxAppDetailRequest)) @@ -928,7 +900,7 @@ func _ApplicationService_GetReleaseDetails_Handler(srv interface{}, ctx context. } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ApplicationService_GetReleaseDetails_FullMethodName, + FullMethod: "/ApplicationService/GetReleaseDetails", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ApplicationServiceServer).GetReleaseDetails(ctx, req.(*ReleaseIdentifier)) diff --git a/api/restHandler/UserAttributesRestHandler.go b/api/restHandler/UserAttributesRestHandler.go index 6188244499..2ccb41a5ba 100644 --- a/api/restHandler/UserAttributesRestHandler.go +++ b/api/restHandler/UserAttributesRestHandler.go @@ -73,7 +73,7 @@ func (handler *UserAttributesRestHandlerImpl) AddUserAttributes(w http.ResponseW // common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden) // return //} - emailId, err := handler.userService.GetEmailById(userId) + emailId, err := handler.userService.GetActiveEmailById(userId) if err != nil { handler.logger.Errorw("request err, UpdateUserAttributes", "err", err, "payload", dto) common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden) @@ -119,7 +119,7 @@ func (handler *UserAttributesRestHandlerImpl) UpdateUserAttributes(w http.Respon // return //} - emailId, err := handler.userService.GetEmailById(userId) + emailId, err := handler.userService.GetActiveEmailById(userId) if err != nil { handler.logger.Errorw("request err, UpdateUserAttributes", "err", err, "payload", dto) common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden) @@ -165,7 +165,7 @@ func (handler *UserAttributesRestHandlerImpl) GetUserAttribute(w http.ResponseWr dto := attributes.UserAttributesDto{} - emailId, err := handler.userService.GetEmailById(userId) + emailId, err := handler.userService.GetActiveEmailById(userId) if err != nil { handler.logger.Errorw("request err, UpdateUserAttributes", "err", err, "payload", dto) common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden) diff --git a/api/restHandler/app/pipeline/configure/DeploymentPipelineRestHandler.go b/api/restHandler/app/pipeline/configure/DeploymentPipelineRestHandler.go index 091a77a40a..80bffe6275 100644 --- a/api/restHandler/app/pipeline/configure/DeploymentPipelineRestHandler.go +++ b/api/restHandler/app/pipeline/configure/DeploymentPipelineRestHandler.go @@ -237,14 +237,26 @@ func (handler *PipelineConfigRestHandlerImpl) CreateCdPipeline(w http.ResponseWr common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden) return } + ok := true for _, deploymentPipeline := range cdPipeline.Pipelines { - if deploymentPipeline.EnvironmentId > 0 { - object := handler.enforcerUtil.GetAppRBACByAppNameAndEnvId(app.AppName, deploymentPipeline.EnvironmentId) - handler.Logger.Debugw("Triggered Request By:", "object", object) - if ok := handler.enforcer.Enforce(token, casbin.ResourceEnvironment, casbin.ActionCreate, object); !ok { - common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden) + //handling case of change of source from CI_PIPELINE to external-ci type (other change of type any -> any has been handled in ci-pipeline/patch api) + if deploymentPipeline.IsSwitchCiPipelineRequest() { + cdPipelines, err := handler.getCdPipelinesForCdPatchRbac(deploymentPipeline) + if err != nil && !errors.Is(err, pg.ErrNoRows) { + handler.Logger.Errorw("error in finding cdPipelines by deploymentPipeline", "deploymentPipeline", deploymentPipeline, "err", err) + common.WriteJsonResp(w, err, nil, http.StatusInternalServerError) return } + ok = handler.checkCiPatchAccess(token, resourceName, cdPipelines) + + } else if deploymentPipeline.EnvironmentId > 0 { + object := handler.enforcerUtil.GetAppRBACByAppNameAndEnvId(app.AppName, deploymentPipeline.EnvironmentId) + handler.Logger.Debugw("Triggered Request By:", "object", object) + ok = handler.enforcer.Enforce(token, casbin.ResourceEnvironment, casbin.ActionCreate, object) + } + if !ok { + common.WriteJsonResp(w, fmt.Errorf("unauthorized user"), "Unauthorized User", http.StatusForbidden) + return } } //RBAC @@ -2561,3 +2573,28 @@ func (handler *PipelineConfigRestHandlerImpl) GetGitOpsConfiguration(w http.Resp } common.WriteJsonResp(w, nil, appGitOpsConfig, http.StatusOK) } + +// this is being used for getting all cdPipelines in the case of changing the source from any [except] -> external-ci +func (handler *PipelineConfigRestHandlerImpl) getCdPipelinesForCdPatchRbac(deploymentPipeline *bean.CDPipelineConfigObject) (cdPipelines []*pipelineConfig.Pipeline, err error) { + componentId, componentType := deploymentPipeline.PatchSourceInfo() + // the appWorkflowId can be taken from patchRequest.AppWorkflowId but doing this can make 2 sources of truth to find the workflow + sourceAppWorkflowMapping, err := handler.appWorkflowService.FindWFMappingByComponent(componentType, componentId) + if err != nil { + handler.Logger.Errorw("error in finding the appWorkflowMapping using componentId and componentType", "componentType", componentType, "componentId", componentId, "err", err) + return nil, err + } + cdPipelineWFMappings, err := handler.appWorkflowService.FindWFCDMappingsByWorkflowId(sourceAppWorkflowMapping.AppWorkflowId) + if err != nil { + handler.Logger.Errorw("error in finding the appWorkflowMappings of cd pipeline for an appWorkflow", "appWorkflowId", sourceAppWorkflowMapping.AppWorkflowId, "err", err) + return cdPipelines, err + } + if len(cdPipelineWFMappings) == 0 { + return + } + + cdPipelineIds := make([]int, 0, len(cdPipelineWFMappings)) + for _, cdWfMapping := range cdPipelineWFMappings { + cdPipelineIds = append(cdPipelineIds, cdWfMapping.ComponentId) + } + return handler.pipelineRepository.FindByIdsIn(cdPipelineIds) +} diff --git a/cmd/external-app/wire_gen.go b/cmd/external-app/wire_gen.go index ab3bca55cd..bab4ef2b47 100644 --- a/cmd/external-app/wire_gen.go +++ b/cmd/external-app/wire_gen.go @@ -1,6 +1,6 @@ // Code generated by Wire. DO NOT EDIT. -//go:generate go run github.com/google/wire/cmd/wire +//go:generate go run -mod=mod github.com/google/wire/cmd/wire //go:build !wireinject // +build !wireinject diff --git a/internal/sql/repository/pipelineConfig/CdWorfkflowRepository.go b/internal/sql/repository/pipelineConfig/CdWorfkflowRepository.go index 0187274fea..59a4427515 100644 --- a/internal/sql/repository/pipelineConfig/CdWorfkflowRepository.go +++ b/internal/sql/repository/pipelineConfig/CdWorfkflowRepository.go @@ -20,12 +20,11 @@ import ( "context" "errors" "fmt" - "github.com/devtron-labs/common-lib/utils/k8s/health" apiBean "github.com/devtron-labs/devtron/api/bean" - argoApplication "github.com/devtron-labs/devtron/client/argocdServer/bean" "github.com/devtron-labs/devtron/client/gitSensor" "github.com/devtron-labs/devtron/internal/sql/repository" repository2 "github.com/devtron-labs/devtron/internal/sql/repository/imageTagging" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/sql" "github.com/go-pg/pg" @@ -84,46 +83,12 @@ type CdWorkflowRepositoryImpl struct { logger *zap.SugaredLogger } -type WorkflowStatus int - -const ( - WF_UNKNOWN WorkflowStatus = iota - REQUEST_ACCEPTED - ENQUEUED - QUE_ERROR - WF_STARTED - DROPPED_STALE - DEQUE_ERROR - TRIGGER_ERROR -) - -const ( - WorkflowStarting = "Starting" - WorkflowInQueue = "Queued" - WorkflowInitiated = "Initiating" - WorkflowInProgress = "Progressing" - WorkflowAborted = "Aborted" - WorkflowFailed = "Failed" - WorkflowSucceeded = "Succeeded" - WorkflowTimedOut = "TimedOut" - WorkflowUnableToFetchState = "UnableToFetch" - WorkflowTypeDeploy = "DEPLOY" - WorkflowTypePre = "PRE" - WorkflowTypePost = "POST" -) - -var WfrTerminalStatusList = []string{WorkflowAborted, WorkflowFailed, WorkflowSucceeded, argoApplication.HIBERNATING, string(health.HealthStatusHealthy), string(health.HealthStatusDegraded)} - -func (a WorkflowStatus) String() string { - return [...]string{"WF_UNKNOWN", "REQUEST_ACCEPTED", "ENQUEUED", "QUE_ERROR", "WF_STARTED", "DROPPED_STALE", "DEQUE_ERROR", "TRIGGER_ERROR"}[a] -} - type CdWorkflow struct { - tableName struct{} `sql:"cd_workflow" pg:",discard_unknown_columns"` - Id int `sql:"id,pk"` - CiArtifactId int `sql:"ci_artifact_id"` - PipelineId int `sql:"pipeline_id"` - WorkflowStatus WorkflowStatus `sql:"workflow_status,notnull"` + tableName struct{} `sql:"cd_workflow" pg:",discard_unknown_columns"` + Id int `sql:"id,pk"` + CiArtifactId int `sql:"ci_artifact_id"` + PipelineId int `sql:"pipeline_id"` + WorkflowStatus cdWorkflow.WorkflowStatus `sql:"workflow_status,notnull"` Pipeline *Pipeline CiArtifact *repository.CiArtifact CdWorkflowRunner []CdWorkflowRunner @@ -151,53 +116,40 @@ type CdWorkflowConfig struct { CdArtifactLocationFormat string `sql:"cd_artifact_location_format"` } -type WorkflowExecutorType string - -var ErrorDeploymentSuperseded = errors.New(NEW_DEPLOYMENT_INITIATED) - -const ( - WORKFLOW_EXECUTOR_TYPE_AWF = "AWF" - WORKFLOW_EXECUTOR_TYPE_SYSTEM = "SYSTEM" - NEW_DEPLOYMENT_INITIATED = "A new deployment was initiated before this deployment completed!" - PIPELINE_DELETED = "The pipeline has been deleted!" - FOUND_VULNERABILITY = "Found vulnerability on image" - GITOPS_REPO_NOT_CONFIGURED = "GitOps repository is not configured for the app" -) - type CdWorkflowRunnerWithExtraFields struct { CdWorkflowRunner TotalCount int } type CdWorkflowRunner struct { - tableName struct{} `sql:"cd_workflow_runner" pg:",discard_unknown_columns"` - Id int `sql:"id,pk"` - Name string `sql:"name"` - WorkflowType apiBean.WorkflowType `sql:"workflow_type"` // pre,post,deploy - ExecutorType WorkflowExecutorType `sql:"executor_type"` // awf, system - Status string `sql:"status"` - PodStatus string `sql:"pod_status"` - Message string `sql:"message"` - StartedOn time.Time `sql:"started_on"` - FinishedOn time.Time `sql:"finished_on"` - Namespace string `sql:"namespace"` - LogLocation string `sql:"log_file_path"` - TriggeredBy int32 `sql:"triggered_by"` - CdWorkflowId int `sql:"cd_workflow_id"` - PodName string `sql:"pod_name"` - BlobStorageEnabled bool `sql:"blob_storage_enabled,notnull"` - RefCdWorkflowRunnerId int `sql:"ref_cd_workflow_runner_id,notnull"` - ImagePathReservationIds []int `sql:"image_path_reservation_ids" pg:",array,notnull"` - ReferenceId *string `sql:"reference_id"` + tableName struct{} `sql:"cd_workflow_runner" pg:",discard_unknown_columns"` + Id int `sql:"id,pk"` + Name string `sql:"name"` + WorkflowType apiBean.WorkflowType `sql:"workflow_type"` // pre,post,deploy + ExecutorType cdWorkflow.WorkflowExecutorType `sql:"executor_type"` // awf, system + Status string `sql:"status"` + PodStatus string `sql:"pod_status"` + Message string `sql:"message"` + StartedOn time.Time `sql:"started_on"` + FinishedOn time.Time `sql:"finished_on"` + Namespace string `sql:"namespace"` + LogLocation string `sql:"log_file_path"` + TriggeredBy int32 `sql:"triggered_by"` + CdWorkflowId int `sql:"cd_workflow_id"` + PodName string `sql:"pod_name"` + BlobStorageEnabled bool `sql:"blob_storage_enabled,notnull"` + RefCdWorkflowRunnerId int `sql:"ref_cd_workflow_runner_id,notnull"` + ImagePathReservationIds []int `sql:"image_path_reservation_ids" pg:",array,notnull"` + ReferenceId *string `sql:"reference_id"` CdWorkflow *CdWorkflow sql.AuditLog } func (c *CdWorkflowRunner) IsExternalRun() bool { var isExtCluster bool - if c.WorkflowType == WorkflowTypePre { + if c.WorkflowType == cdWorkflow.WorkflowTypePre { isExtCluster = c.CdWorkflow.Pipeline.RunPreStageInEnv - } else if c.WorkflowType == WorkflowTypePost { + } else if c.WorkflowType == cdWorkflow.WorkflowTypePost { isExtCluster = c.CdWorkflow.Pipeline.RunPostStageInEnv } return isExtCluster @@ -492,7 +444,7 @@ func (impl *CdWorkflowRepositoryImpl) FindLastUnFailedProcessedRunner(appId int, Where("p.environment_id = ?", environmentId). Where("p.app_id = ?", appId). Where("cd_workflow_runner.workflow_type = ?", apiBean.CD_WORKFLOW_TYPE_DEPLOY). - Where("cd_workflow_runner.status NOT IN (?)", pg.In([]string{WorkflowInitiated, WorkflowInQueue, WorkflowFailed})). + Where("cd_workflow_runner.status NOT IN (?)", pg.In([]string{cdWorkflow.WorkflowInitiated, cdWorkflow.WorkflowInQueue, cdWorkflow.WorkflowFailed})). Order("cd_workflow_runner.id DESC"). Join("inner join cd_workflow wf on wf.id = cd_workflow_runner.cd_workflow_id"). Join("inner join pipeline p on p.id = wf.pipeline_id"). @@ -557,7 +509,7 @@ func (impl *CdWorkflowRepositoryImpl) GetPreviousQueuedRunners(cdWfrId, pipeline Where("workflow_type = ?", apiBean.CD_WORKFLOW_TYPE_DEPLOY). Where("cd_workflow.pipeline_id = ?", pipelineId). Where("cd_workflow_runner.id < ?", cdWfrId). - Where("cd_workflow_runner.status = ?", WorkflowInQueue). + Where("cd_workflow_runner.status = ?", cdWorkflow.WorkflowInQueue). Select() return cdWfrs, err } @@ -567,7 +519,7 @@ func (impl *CdWorkflowRepositoryImpl) UpdateRunnerStatusToFailedForIds(errMsg st return nil } _, err := impl.dbConnection.Model((*CdWorkflowRunner)(nil)). - Set("status = ?", WorkflowFailed). + Set("status = ?", cdWorkflow.WorkflowFailed). Set("finished_on = ?", time.Now()). Set("updated_on = ?", time.Now()). Set("updated_by = ?", triggeredBy). @@ -763,8 +715,8 @@ func (impl *CdWorkflowRepositoryImpl) FetchArtifactsByCdPipelineIdV2(listingFilt func (impl *CdWorkflowRepositoryImpl) GetLatestTriggersOfHelmPipelinesStuckInNonTerminalStatuses(getPipelineDeployedWithinHours int) ([]*CdWorkflowRunner, error) { var wfrList []*CdWorkflowRunner - excludedStatusList := WfrTerminalStatusList - excludedStatusList = append(excludedStatusList, WorkflowInitiated, WorkflowInQueue, WorkflowStarting) + excludedStatusList := cdWorkflow.WfrTerminalStatusList + excludedStatusList = append(excludedStatusList, cdWorkflow.WorkflowInitiated, cdWorkflow.WorkflowInQueue, cdWorkflow.WorkflowStarting) err := impl.dbConnection. Model(&wfrList). Column("cd_workflow_runner.*", "CdWorkflow.id", "CdWorkflow.pipeline_id", "CdWorkflow.Pipeline.id", "CdWorkflow.Pipeline.app_id", "CdWorkflow.Pipeline.environment_id", "CdWorkflow.Pipeline.deployment_app_name", "CdWorkflow.Pipeline.deleted", "CdWorkflow.Pipeline.Environment"). @@ -776,7 +728,7 @@ func (impl *CdWorkflowRepositoryImpl) GetLatestTriggersOfHelmPipelinesStuckInNon " INNER JOIN cd_workflow_runner on cd_workflow.id = cd_workflow_runner.cd_workflow_id"+ " WHERE cd_workflow_runner.status != ?"+ " GROUP BY cd_workflow.pipeline_id"+ - " ORDER BY cd_workflow.pipeline_id desc)", WorkflowInQueue). + " ORDER BY cd_workflow.pipeline_id desc)", cdWorkflow.WorkflowInQueue). Where("(cd_workflow__pipeline.deployment_app_type=? or dc.deployment_app_type=?)", util.PIPELINE_DEPLOYMENT_TYPE_HELM, util.PIPELINE_DEPLOYMENT_TYPE_HELM). Where("cd_workflow_runner.started_on > NOW() - INTERVAL '? hours'", getPipelineDeployedWithinHours). Where("cd_workflow__pipeline.deleted=?", false). diff --git a/internal/sql/repository/pipelineConfig/CiWorkflowRepository.go b/internal/sql/repository/pipelineConfig/CiWorkflowRepository.go index 05800545ea..f54ad9ffcb 100644 --- a/internal/sql/repository/pipelineConfig/CiWorkflowRepository.go +++ b/internal/sql/repository/pipelineConfig/CiWorkflowRepository.go @@ -19,6 +19,7 @@ package pipelineConfig import ( "fmt" "github.com/devtron-labs/devtron/internal/sql/repository/helper" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/go-pg/pg" "go.uber.org/zap" "time" @@ -56,29 +57,29 @@ type CiWorkflowRepositoryImpl struct { } type CiWorkflow struct { - tableName struct{} `sql:"ci_workflow" pg:",discard_unknown_columns"` - Id int `sql:"id,pk"` - Name string `sql:"name"` - Status string `sql:"status"` - PodStatus string `sql:"pod_status"` - Message string `sql:"message"` - StartedOn time.Time `sql:"started_on"` - FinishedOn time.Time `sql:"finished_on"` - CiPipelineId int `sql:"ci_pipeline_id"` - Namespace string `sql:"namespace"` - BlobStorageEnabled bool `sql:"blob_storage_enabled,notnull"` - LogLocation string `sql:"log_file_path"` - GitTriggers map[int]GitCommit `sql:"git_triggers"` - TriggeredBy int32 `sql:"triggered_by"` - CiArtifactLocation string `sql:"ci_artifact_location"` - PodName string `sql:"pod_name"` - CiBuildType string `sql:"ci_build_type"` - EnvironmentId int `sql:"environment_id"` - ReferenceCiWorkflowId int `sql:"ref_ci_workflow_id"` - ParentCiWorkFlowId int `sql:"parent_ci_workflow_id"` - ExecutorType WorkflowExecutorType `sql:"executor_type"` //awf, system - ImagePathReservationId int `sql:"image_path_reservation_id"` - ImagePathReservationIds []int `sql:"image_path_reservation_ids" pg:",array"` + tableName struct{} `sql:"ci_workflow" pg:",discard_unknown_columns"` + Id int `sql:"id,pk"` + Name string `sql:"name"` + Status string `sql:"status"` + PodStatus string `sql:"pod_status"` + Message string `sql:"message"` + StartedOn time.Time `sql:"started_on"` + FinishedOn time.Time `sql:"finished_on"` + CiPipelineId int `sql:"ci_pipeline_id"` + Namespace string `sql:"namespace"` + BlobStorageEnabled bool `sql:"blob_storage_enabled,notnull"` + LogLocation string `sql:"log_file_path"` + GitTriggers map[int]GitCommit `sql:"git_triggers"` + TriggeredBy int32 `sql:"triggered_by"` + CiArtifactLocation string `sql:"ci_artifact_location"` + PodName string `sql:"pod_name"` + CiBuildType string `sql:"ci_build_type"` + EnvironmentId int `sql:"environment_id"` + ReferenceCiWorkflowId int `sql:"ref_ci_workflow_id"` + ParentCiWorkFlowId int `sql:"parent_ci_workflow_id"` + ExecutorType cdWorkflow.WorkflowExecutorType `sql:"executor_type"` //awf, system + ImagePathReservationId int `sql:"image_path_reservation_id"` + ImagePathReservationIds []int `sql:"image_path_reservation_ids" pg:",array"` CiPipeline *CiPipeline } @@ -91,33 +92,33 @@ func (ciWorkflow *CiWorkflow) IsExternalRunInJobType() bool { } type WorkflowWithArtifact struct { - Id int `json:"id"` - Name string `json:"name"` - PodName string `json:"podName"` - Status string `json:"status"` - PodStatus string `json:"pod_status"` - Message string `json:"message"` - StartedOn time.Time `json:"started_on"` - FinishedOn time.Time `json:"finished_on"` - CiPipelineId int `json:"ci_pipeline_id"` - Namespace string `json:"namespace"` - LogFilePath string `json:"log_file_path"` - GitTriggers map[int]GitCommit `json:"git_triggers"` - TriggeredBy int32 `json:"triggered_by"` - EmailId string `json:"email_id"` - Image string `json:"image"` - CiArtifactLocation string `json:"ci_artifact_location"` - CiArtifactId int `json:"ci_artifact_d"` - BlobStorageEnabled bool `json:"blobStorageEnabled"` - CiBuildType string `json:"ci_build_type"` - IsArtifactUploaded bool `json:"is_artifact_uploaded"` - EnvironmentId int `json:"environmentId"` - EnvironmentName string `json:"environmentName"` - RefCiWorkflowId int `json:"referenceCiWorkflowId"` - ParentCiWorkflowId int `json:"parent_ci_workflow_id"` - ExecutorType WorkflowExecutorType `json:"executor_type"` //awf, system - ImagePathReservationId int `json:"image_path_reservation_id"` - ImagePathReservationIds []int `json:"image_path_reservation_ids" pg:",array"` + Id int `json:"id"` + Name string `json:"name"` + PodName string `json:"podName"` + Status string `json:"status"` + PodStatus string `json:"pod_status"` + Message string `json:"message"` + StartedOn time.Time `json:"started_on"` + FinishedOn time.Time `json:"finished_on"` + CiPipelineId int `json:"ci_pipeline_id"` + Namespace string `json:"namespace"` + LogFilePath string `json:"log_file_path"` + GitTriggers map[int]GitCommit `json:"git_triggers"` + TriggeredBy int32 `json:"triggered_by"` + EmailId string `json:"email_id"` + Image string `json:"image"` + CiArtifactLocation string `json:"ci_artifact_location"` + CiArtifactId int `json:"ci_artifact_d"` + BlobStorageEnabled bool `json:"blobStorageEnabled"` + CiBuildType string `json:"ci_build_type"` + IsArtifactUploaded bool `json:"is_artifact_uploaded"` + EnvironmentId int `json:"environmentId"` + EnvironmentName string `json:"environmentName"` + RefCiWorkflowId int `json:"referenceCiWorkflowId"` + ParentCiWorkflowId int `json:"parent_ci_workflow_id"` + ExecutorType cdWorkflow.WorkflowExecutorType `json:"executor_type"` //awf, system + ImagePathReservationId int `json:"image_path_reservation_id"` + ImagePathReservationIds []int `json:"image_path_reservation_ids" pg:",array"` } type GitCommit struct { diff --git a/internal/sql/repository/pipelineConfig/PipelineRepository.go b/internal/sql/repository/pipelineConfig/PipelineRepository.go index 7ca6c44567..ddddc4f858 100644 --- a/internal/sql/repository/pipelineConfig/PipelineRepository.go +++ b/internal/sql/repository/pipelineConfig/PipelineRepository.go @@ -22,6 +22,7 @@ import ( "github.com/devtron-labs/devtron/internal/sql/models" "github.com/devtron-labs/devtron/internal/sql/repository/app" "github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" "github.com/devtron-labs/devtron/internal/util" util2 "github.com/devtron-labs/devtron/pkg/appStore/util" @@ -665,7 +666,7 @@ func (impl PipelineRepositoryImpl) GetArgoPipelinesHavingLatestTriggerStuckInNon group by pipeline_id, id order by pipeline_id, id desc)) and (p.deployment_app_type=? or dc.deployment_app_type=?) and p.deleted=?;` _, err := impl.dbConnection.Query(&pipelines, queryString, getPipelineDeployedBeforeMinutes, getPipelineDeployedWithinHours, - pg.In(append(WfrTerminalStatusList, WorkflowInitiated, WorkflowInQueue)), + pg.In(append(cdWorkflow.WfrTerminalStatusList, cdWorkflow.WorkflowInitiated, cdWorkflow.WorkflowInQueue)), bean.CD_WORKFLOW_TYPE_DEPLOY, util.PIPELINE_DEPLOYMENT_TYPE_ACD, util.PIPELINE_DEPLOYMENT_TYPE_ACD, false) if err != nil { impl.logger.Errorw("error in GetArgoPipelinesHavingLatestTriggerStuckInNonTerminalStatuses", "err", err) @@ -762,7 +763,7 @@ func (impl PipelineRepositoryImpl) FindDeploymentTypeByPipelineIds(cdPipelineIds "pco inner join pcos on pcos.id=pco.id" + " inner join pipeline p on p.id=pco.pipeline_id left join app_status aps on aps.app_id=p.app_id " + "and aps.env_id=p.environment_id;" - _, err := impl.dbConnection.Query(&deploymentType, query, pg.In(cdPipelineIds), bean.CD_WORKFLOW_TYPE_DEPLOY, pg.In([]string{WorkflowInitiated, WorkflowInQueue, WorkflowFailed})) + _, err := impl.dbConnection.Query(&deploymentType, query, pg.In(cdPipelineIds), bean.CD_WORKFLOW_TYPE_DEPLOY, pg.In([]string{cdWorkflow.WorkflowInitiated, cdWorkflow.WorkflowInQueue, cdWorkflow.WorkflowFailed})) if err != nil { return pipelineIdsMap, err } diff --git a/internal/sql/repository/pipelineConfig/bean/cdWorkflow/bean.go b/internal/sql/repository/pipelineConfig/bean/cdWorkflow/bean.go new file mode 100644 index 0000000000..645ef52eb2 --- /dev/null +++ b/internal/sql/repository/pipelineConfig/bean/cdWorkflow/bean.go @@ -0,0 +1,54 @@ +package cdWorkflow + +import ( + "errors" + "github.com/devtron-labs/common-lib/utils/k8s/health" + "github.com/devtron-labs/devtron/client/argocdServer/bean" +) + +var WfrTerminalStatusList = []string{WorkflowAborted, WorkflowFailed, WorkflowSucceeded, bean.HIBERNATING, string(health.HealthStatusHealthy), string(health.HealthStatusDegraded)} + +type WorkflowStatus int + +const ( + WF_UNKNOWN WorkflowStatus = iota + REQUEST_ACCEPTED + ENQUEUED + QUE_ERROR + WF_STARTED + DROPPED_STALE + DEQUE_ERROR + TRIGGER_ERROR +) + +const ( + WorkflowStarting = "Starting" + WorkflowInQueue = "Queued" + WorkflowInitiated = "Initiating" + WorkflowInProgress = "Progressing" + WorkflowAborted = "Aborted" + WorkflowFailed = "Failed" + WorkflowSucceeded = "Succeeded" + WorkflowTimedOut = "TimedOut" + WorkflowUnableToFetchState = "UnableToFetch" + WorkflowTypeDeploy = "DEPLOY" + WorkflowTypePre = "PRE" + WorkflowTypePost = "POST" +) + +func (a WorkflowStatus) String() string { + return [...]string{"WF_UNKNOWN", "REQUEST_ACCEPTED", "ENQUEUED", "QUE_ERROR", "WF_STARTED", "DROPPED_STALE", "DEQUE_ERROR", "TRIGGER_ERROR"}[a] +} + +var ErrorDeploymentSuperseded = errors.New(NEW_DEPLOYMENT_INITIATED) + +const ( + WORKFLOW_EXECUTOR_TYPE_AWF = "AWF" + WORKFLOW_EXECUTOR_TYPE_SYSTEM = "SYSTEM" + NEW_DEPLOYMENT_INITIATED = "A new deployment was initiated before this deployment completed!" + PIPELINE_DELETED = "The pipeline has been deleted!" + FOUND_VULNERABILITY = "Found vulnerability on image" + GITOPS_REPO_NOT_CONFIGURED = "GitOps repository is not configured for the app" +) + +type WorkflowExecutorType string diff --git a/pkg/app/AppListingService.go b/pkg/app/AppListingService.go index c889dba139..3825252084 100644 --- a/pkg/app/AppListingService.go +++ b/pkg/app/AppListingService.go @@ -20,6 +20,7 @@ import ( "context" "fmt" argoApplication "github.com/devtron-labs/devtron/client/argocdServer/bean" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/deployment/manifest/deployedAppMetrics" "net/http" "strconv" @@ -423,7 +424,7 @@ func (impl AppListingServiceImpl) ISLastReleaseStopType(appId, envId int) (bool, impl.Logger.Errorw("error in getting latest wfr by pipelineId", "err", err, "cdWorkflowId", override.CdWorkflowId) return false, err } - if slices.Contains([]string{pipelineConfig.WorkflowInitiated, pipelineConfig.WorkflowInQueue, pipelineConfig.WorkflowFailed}, cdWfr.Status) { + if slices.Contains([]string{cdWorkflow.WorkflowInitiated, cdWorkflow.WorkflowInQueue, cdWorkflow.WorkflowFailed}, cdWfr.Status) { return false, nil } return models.DEPLOYMENTTYPE_STOP == override.DeploymentType, nil @@ -450,7 +451,7 @@ func (impl AppListingServiceImpl) ISLastReleaseStopTypeV2(pipelineIds []int) (ma releaseMap[override.PipelineId] = false continue } - if slices.Contains([]string{pipelineConfig.WorkflowInitiated, pipelineConfig.WorkflowInQueue}, cdWfr.Status) { + if slices.Contains([]string{cdWorkflow.WorkflowInitiated, cdWorkflow.WorkflowInQueue}, cdWfr.Status) { releaseMap[override.PipelineId] = false continue } @@ -672,7 +673,7 @@ func (impl AppListingServiceImpl) fetchACDAppStatus(fetchAppListingRequest Fetch } } - if latestTriggeredWf.WorkflowStatus == pipelineConfig.WF_STARTED || latestTriggeredWf.WorkflowStatus == pipelineConfig.WF_UNKNOWN { + if latestTriggeredWf.WorkflowStatus == cdWorkflow.WF_STARTED || latestTriggeredWf.WorkflowStatus == cdWorkflow.WF_UNKNOWN { if pipeline.PreStageConfig != "" { if preCdStageRunner != nil && preCdStageRunner.Id != 0 { env.PreStageStatus = &preCdStageRunner.Status diff --git a/pkg/app/AppService.go b/pkg/app/AppService.go index 94b4e84dbe..7f7c3c0108 100644 --- a/pkg/app/AppService.go +++ b/pkg/app/AppService.go @@ -25,6 +25,7 @@ import ( argoApplication "github.com/devtron-labs/devtron/client/argocdServer/bean" "github.com/devtron-labs/devtron/internal/sql/models" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/adapter/cdWorkflow" + cdWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" common2 "github.com/devtron-labs/devtron/pkg/deployment/common" bean2 "github.com/devtron-labs/devtron/pkg/deployment/common/bean" @@ -361,7 +362,7 @@ func (impl *AppServiceImpl) UpdateDeploymentStatusForGitOpsPipelines(app *v1alph // not checking further and directly updating timedOutStatus err := impl.UpdateCdWorkflowRunnerByACDObject(app, cdWfr.Id, true) if err != nil { - impl.logger.Errorw("error on update cd workflow runner", "CdWorkflowId", pipelineOverride.CdWorkflowId, "status", pipelineConfig.WorkflowTimedOut, "err", err) + impl.logger.Errorw("error on update cd workflow runner", "CdWorkflowId", pipelineOverride.CdWorkflowId, "status", cdWorkflow2.WorkflowTimedOut, "err", err) return isSucceeded, isTimelineUpdated, pipelineOverride, err } return isSucceeded, isTimelineUpdated, pipelineOverride, nil @@ -428,7 +429,7 @@ func (impl *AppServiceImpl) UpdateDeploymentStatusForGitOpsPipelines(app *v1alph // not checking further and directly updating timedOutStatus err := impl.UpdateInstalledAppVersionHistoryByACDObject(app, installedAppVersionHistory.Id, true) if err != nil { - impl.logger.Errorw("error on update installedAppVersionHistory", "installedAppVersionHistory", installedAppVersionHistory.Id, "status", pipelineConfig.WorkflowTimedOut, "err", err) + impl.logger.Errorw("error on update installedAppVersionHistory", "installedAppVersionHistory", installedAppVersionHistory.Id, "status", cdWorkflow2.WorkflowTimedOut, "err", err) return isSucceeded, isTimelineUpdated, pipelineOverride, err } return isSucceeded, isTimelineUpdated, pipelineOverride, nil @@ -1113,13 +1114,13 @@ func (impl *AppServiceImpl) UpdateInstalledAppVersionHistoryByACDObject(app *v1a return err } if updateTimedOutStatus { - installedAppVersionHistory.Status = pipelineConfig.WorkflowTimedOut + installedAppVersionHistory.SetStatus(cdWorkflow2.WorkflowTimedOut) } else { if string(app.Status.Health.Status) == string(health.HealthStatusHealthy) { - installedAppVersionHistory.Status = pipelineConfig.WorkflowSucceeded + installedAppVersionHistory.SetStatus(cdWorkflow2.WorkflowSucceeded) installedAppVersionHistory.SetFinishedOn() } else { - installedAppVersionHistory.Status = pipelineConfig.WorkflowInProgress + installedAppVersionHistory.SetStatus(cdWorkflow2.WorkflowInProgress) } } installedAppVersionHistory.UpdatedBy = 1 @@ -1139,13 +1140,13 @@ func (impl *AppServiceImpl) UpdateCdWorkflowRunnerByACDObject(app *v1alpha1.Appl return err } if updateTimedOutStatus { - wfr.Status = pipelineConfig.WorkflowTimedOut + wfr.Status = cdWorkflow2.WorkflowTimedOut } else { if string(app.Status.Health.Status) == string(health.HealthStatusHealthy) { - wfr.Status = pipelineConfig.WorkflowSucceeded + wfr.Status = cdWorkflow2.WorkflowSucceeded wfr.FinishedOn = time.Now() } else { - wfr.Status = pipelineConfig.WorkflowInProgress + wfr.Status = cdWorkflow2.WorkflowInProgress } } wfr.UpdatedBy = 1 diff --git a/pkg/app/status/PipelineStatusTimelineService.go b/pkg/app/status/PipelineStatusTimelineService.go index ae0bd986c1..35e4c99f81 100644 --- a/pkg/app/status/PipelineStatusTimelineService.go +++ b/pkg/app/status/PipelineStatusTimelineService.go @@ -232,7 +232,7 @@ func (impl *PipelineStatusTimelineServiceImpl) FetchTimelines(appId, envId, wfrI } deploymentAppType = envDeploymentConfig.DeploymentAppType - triggeredByUserEmailId, err := impl.userService.GetEmailById(triggeredBy) + triggeredByUserEmailId, err := impl.userService.GetActiveEmailById(triggeredBy) if err != nil { impl.logger.Errorw("error in getting user email by id", "err", err, "userId", triggeredBy) return nil, err @@ -333,7 +333,7 @@ func (impl *PipelineStatusTimelineServiceImpl) FetchTimelinesForAppStore(install } installedAppVersionHistoryStatus = installedAppVersionHistory.Status deploymentAppType = deploymentConfig.DeploymentAppType - triggeredByUserEmailId, err := impl.userService.GetEmailById(installedAppVersionHistory.CreatedBy) + triggeredByUserEmailId, err := impl.userService.GetActiveEmailById(installedAppVersionHistory.CreatedBy) if err != nil { impl.logger.Errorw("error in getting user email by id", "err", err, "userId", installedAppVersionHistory.CreatedBy) return nil, err diff --git a/pkg/appStore/bean/bean.go b/pkg/appStore/bean/bean.go index 11a5238c8d..4fcd57fc0a 100644 --- a/pkg/appStore/bean/bean.go +++ b/pkg/appStore/bean/bean.go @@ -19,12 +19,15 @@ package appStoreBean import ( "encoding/json" "fmt" + "github.com/argoproj/gitops-engine/pkg/health" apiBean "github.com/devtron-labs/devtron/api/bean/gitOps" openapi "github.com/devtron-labs/devtron/api/helm-app/openapiClient" bean3 "github.com/devtron-labs/devtron/api/helm-app/service/bean" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/cluster/repository/bean" bean2 "github.com/devtron-labs/devtron/pkg/deployment/common/bean" "github.com/devtron-labs/devtron/util/gitUtil" + "slices" "time" ) @@ -495,3 +498,13 @@ type AppListDetail struct { // all helm app list, EA+ devtronapp DevtronApps *[]openapi.DevtronApp `json:"devtronApps,omitempty"` } + +var InstalledAppTerminalStatusList = []string{string(health.HealthStatusHealthy), cdWorkflow.WorkflowAborted, cdWorkflow.WorkflowFailed, cdWorkflow.WorkflowSucceeded} + +func IsTerminalStatus(status string) bool { + return slices.Contains(InstalledAppTerminalStatusList, status) +} + +func IsFailedStatus(status string) bool { + return status == cdWorkflow.WorkflowFailed +} diff --git a/pkg/appStore/installedApp/adapter/Adapter.go b/pkg/appStore/installedApp/adapter/Adapter.go index 16a7e8097c..583d5744da 100644 --- a/pkg/appStore/installedApp/adapter/Adapter.go +++ b/pkg/appStore/installedApp/adapter/Adapter.go @@ -17,9 +17,14 @@ package adapter import ( + "encoding/json" + "github.com/devtron-labs/devtron/api/helm-app/gRPC" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/util" appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean" + "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository" "github.com/devtron-labs/devtron/pkg/deployment/gitOps/git/bean" + "github.com/golang/protobuf/ptypes/timestamp" "helm.sh/helm/v3/pkg/chart" "path" ) @@ -51,3 +56,65 @@ func getRefProxyChartPath() string { template := appStoreBean.CHART_PROXY_TEMPLATE return path.Join(appStoreBean.RefChartProxyDirPath, template) } + +type UpdateVersionHistoryOperation func(installedAppVersionHistory *repository.InstalledAppVersionHistory) error + +// FailedStatusUpdateOption returns an UpdateVersionHistoryOperation that updates the status of the installed app version history to failed +func FailedStatusUpdateOption(userId int32, deploymentErr error) UpdateVersionHistoryOperation { + return func(installedAppVersionHistory *repository.InstalledAppVersionHistory) error { + if deploymentErr == nil { + // for failed status deploymentErr should not be nil + return nil + } + installedAppVersionHistory.MarkDeploymentFailed(deploymentErr) + installedAppVersionHistory.SetFinishedOn() + installedAppVersionHistory.UpdateAuditLog(userId) + return nil + } +} + +// SuccessStatusUpdateOption returns an UpdateVersionHistoryOperation that updates the status of the installed app version history to success +func SuccessStatusUpdateOption(deploymentAppType string, userId int32) UpdateVersionHistoryOperation { + return func(installedAppVersionHistory *repository.InstalledAppVersionHistory) error { + installedAppVersionHistory.SetStatus(cdWorkflow.WorkflowSucceeded) + installedAppVersionHistory.SetFinishedOn() + installedAppVersionHistory.UpdateAuditLog(userId) + // update helm release status config if helm installed app + // for ArgoCd installed app, we don't need to update the release status config + if util.IsHelmApp(deploymentAppType) { + helmInstallStatus := &appStoreBean.HelmReleaseStatusConfig{ + InstallAppVersionHistoryId: installedAppVersionHistory.Id, + Message: "Release Installed", + IsReleaseInstalled: true, + ErrorInInstallation: false, + } + data, err := json.Marshal(helmInstallStatus) + if err != nil { + return err + } + installedAppVersionHistory.HelmReleaseStatusConfig = string(data) + } + return nil + } +} + +func BuildDeploymentHistory(installedAppVersionModel *repository.InstalledAppVersions, sources []string, updateHistory *repository.InstalledAppVersionHistory, emailId string) *gRPC.HelmAppDeploymentDetail { + return &gRPC.HelmAppDeploymentDetail{ + ChartMetadata: &gRPC.ChartMetadata{ + ChartName: installedAppVersionModel.AppStoreApplicationVersion.AppStore.Name, + ChartVersion: installedAppVersionModel.AppStoreApplicationVersion.Version, + Description: installedAppVersionModel.AppStoreApplicationVersion.Description, + Home: installedAppVersionModel.AppStoreApplicationVersion.Home, + Sources: sources, + }, + DeployedBy: emailId, + DockerImages: []string{installedAppVersionModel.AppStoreApplicationVersion.AppVersion}, + DeployedAt: ×tamp.Timestamp{ + Seconds: updateHistory.CreatedOn.Unix(), + Nanos: int32(updateHistory.CreatedOn.Nanosecond()), + }, + Version: int32(updateHistory.Id), + Status: updateHistory.Status, + Message: updateHistory.Message, + } +} diff --git a/pkg/appStore/installedApp/repository/InstalledAppRepository.go b/pkg/appStore/installedApp/repository/InstalledAppRepository.go index f04fdb93e5..1eff9b1022 100644 --- a/pkg/appStore/installedApp/repository/InstalledAppRepository.go +++ b/pkg/appStore/installedApp/repository/InstalledAppRepository.go @@ -20,7 +20,7 @@ import ( "fmt" "github.com/devtron-labs/common-lib/utils/k8s/health" "github.com/devtron-labs/devtron/internal/sql/repository/app" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" util2 "github.com/devtron-labs/devtron/internal/util" appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean" @@ -116,6 +116,7 @@ type InstalledAppRepository interface { CreateInstalledAppVersion(model *InstalledAppVersions, tx *pg.Tx) (*InstalledAppVersions, error) UpdateInstalledApp(model *InstalledApps, tx *pg.Tx) (*InstalledApps, error) UpdateInstalledAppVersion(model *InstalledAppVersions, tx *pg.Tx) (*InstalledAppVersions, error) + DeleteInstalledAppVersions(tx *pg.Tx, installedAppId int, userId int32) (rowsUpdated int, err error) GetInstalledApp(id int) (*InstalledApps, error) GetInstalledAppsByAppId(appId int) (InstalledApps, error) GetInstalledAppVersion(id int) (*InstalledAppVersions, error) @@ -171,7 +172,7 @@ func NewInstalledAppRepositoryImpl(Logger *zap.SugaredLogger, dbConnection *pg.D return &InstalledAppRepositoryImpl{dbConnection: dbConnection, Logger: Logger} } -func (impl InstalledAppRepositoryImpl) CreateInstalledApp(model *InstalledApps, tx *pg.Tx) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) CreateInstalledApp(model *InstalledApps, tx *pg.Tx) (*InstalledApps, error) { err := tx.Insert(model) if err != nil { impl.Logger.Error(err) @@ -180,7 +181,7 @@ func (impl InstalledAppRepositoryImpl) CreateInstalledApp(model *InstalledApps, return model, nil } -func (impl InstalledAppRepositoryImpl) CreateInstalledAppVersion(model *InstalledAppVersions, tx *pg.Tx) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) CreateInstalledAppVersion(model *InstalledAppVersions, tx *pg.Tx) (*InstalledAppVersions, error) { err := tx.Insert(model) if err != nil { impl.Logger.Error(err) @@ -189,7 +190,7 @@ func (impl InstalledAppRepositoryImpl) CreateInstalledAppVersion(model *Installe return model, nil } -func (impl InstalledAppRepositoryImpl) UpdateInstalledApp(model *InstalledApps, tx *pg.Tx) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) UpdateInstalledApp(model *InstalledApps, tx *pg.Tx) (*InstalledApps, error) { err := tx.Update(model) if err != nil { impl.Logger.Error(err) @@ -198,7 +199,7 @@ func (impl InstalledAppRepositoryImpl) UpdateInstalledApp(model *InstalledApps, return model, nil } -func (impl InstalledAppRepositoryImpl) UpdateInstalledAppVersion(model *InstalledAppVersions, tx *pg.Tx) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) UpdateInstalledAppVersion(model *InstalledAppVersions, tx *pg.Tx) (*InstalledAppVersions, error) { var err error if tx == nil { err = impl.dbConnection.Update(model) @@ -211,7 +212,28 @@ func (impl InstalledAppRepositoryImpl) UpdateInstalledAppVersion(model *Installe } return model, nil } -func (impl InstalledAppRepositoryImpl) FetchNotes(installedAppId int) (*InstalledApps, error) { + +func (impl *InstalledAppRepositoryImpl) DeleteInstalledAppVersions(tx *pg.Tx, installedAppId int, userId int32) (rowsUpdated int, err error) { + var query *orm.Query + if tx == nil { + query = impl.dbConnection.Model((*InstalledAppVersions)(nil)) + } else { + query = tx.Model((*InstalledAppVersions)(nil)) + } + res, err := query. + Set("active = ?", false). + Set("updated_by = ?", userId). + Set("updated_on = ?", time.Now()). + Where("installed_app_id = ?", installedAppId). + Where("active = ?", true). + Update() + if err != nil { + return rowsUpdated, err + } + return res.RowsAffected(), nil +} + +func (impl *InstalledAppRepositoryImpl) FetchNotes(installedAppId int) (*InstalledApps, error) { model := &InstalledApps{} err := impl.dbConnection.Model(model). Column("installed_apps.*", "App"). @@ -219,7 +241,7 @@ func (impl InstalledAppRepositoryImpl) FetchNotes(installedAppId int) (*Installe return model, err } -func (impl InstalledAppRepositoryImpl) GetInstalledApp(id int) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledApp(id int) (*InstalledApps, error) { model := &InstalledApps{} err := impl.dbConnection.Model(model). Column("installed_apps.*", "App", "Environment", "App.Team", "Environment.Cluster"). @@ -227,7 +249,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledApp(id int) (*InstalledApps, return model, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppsByAppId(appId int) (InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppsByAppId(appId int) (InstalledApps, error) { var model InstalledApps err := impl.dbConnection.Model(&model). Column("installed_apps.*", "App", "Environment", "App.Team", "Environment.Cluster"). @@ -235,7 +257,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppsByAppId(appId int) (Insta return model, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByAppStoreId(appStoreId int) ([]*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionByAppStoreId(appStoreId int) ([]*InstalledAppVersions, error) { var model []*InstalledAppVersions err := impl.dbConnection.Model(&model). Column("installed_app_versions.*", "InstalledApp", "InstalledApp.App", "InstalledApp.Environment", "AppStoreApplicationVersion"). @@ -264,7 +286,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByAppStoreId(appSto return model, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByInstalledAppIdMeta(installedAppId int) ([]*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionByInstalledAppIdMeta(installedAppId int) ([]*InstalledAppVersions, error) { var model []*InstalledAppVersions err := impl.dbConnection.Model(&model). Column("installed_app_versions.*", "InstalledApp", "InstalledApp.App", "InstalledApp.Environment", "AppStoreApplicationVersion"). @@ -294,7 +316,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByInstalledAppIdMet return model, err } -func (impl InstalledAppRepositoryImpl) GetActiveInstalledAppVersionByInstalledAppId(installedAppId int) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetActiveInstalledAppVersionByInstalledAppId(installedAppId int) (*InstalledAppVersions, error) { model := &InstalledAppVersions{} err := impl.dbConnection.Model(model). Column("installed_app_versions.*", "InstalledApp", "InstalledApp.App", "InstalledApp.Environment", "AppStoreApplicationVersion"). @@ -321,7 +343,7 @@ func (impl InstalledAppRepositoryImpl) GetActiveInstalledAppVersionByInstalledAp return model, err } -func (impl InstalledAppRepositoryImpl) GetLatestInstalledAppVersionByGitHash(gitHash string) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetLatestInstalledAppVersionByGitHash(gitHash string) (*InstalledAppVersions, error) { model := &InstalledAppVersions{} err := impl.dbConnection.Model(model). Column("installed_app_versions.*", "InstalledApp"). @@ -331,7 +353,7 @@ func (impl InstalledAppRepositoryImpl) GetLatestInstalledAppVersionByGitHash(git return model, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersion(id int) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersion(id int) (*InstalledAppVersions, error) { model := &InstalledAppVersions{} err := impl.dbConnection.Model(model). Column("installed_app_versions.*", "InstalledApp", "InstalledApp.App", "InstalledApp.Environment", "InstalledApp.Environment.Cluster", "AppStoreApplicationVersion", "InstalledApp.App.Team"). @@ -357,8 +379,8 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppVersion(id int) (*Installe return model, err } -// it returns enable and disabled both version -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionAny(id int) (*InstalledAppVersions, error) { +// GetInstalledAppVersionAny - returns enable and disabled both version +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionAny(id int) (*InstalledAppVersions, error) { model := &InstalledAppVersions{} err := impl.dbConnection.Model(model). Column("installed_app_versions.*", "InstalledApp", "InstalledApp.App", "AppStoreApplicationVersion"). @@ -384,7 +406,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionAny(id int) (*Insta return model, err } -func (impl InstalledAppRepositoryImpl) GetAllInstalledApps(filter *appStoreBean.AppStoreFilter) ([]InstalledAppsWithChartDetails, error) { +func (impl *InstalledAppRepositoryImpl) GetAllInstalledApps(filter *appStoreBean.AppStoreFilter) ([]InstalledAppsWithChartDetails, error) { var installedAppsWithChartDetails []InstalledAppsWithChartDetails var query string query = "select iav.updated_on, iav.id as installed_app_version_id, ch.name as chart_repo_name, das.id as docker_artifact_store_id," @@ -437,7 +459,7 @@ func (impl InstalledAppRepositoryImpl) GetAllInstalledApps(filter *appStoreBean. return installedAppsWithChartDetails, err } -func (impl InstalledAppRepositoryImpl) GetAllInstalledAppsByAppStoreId(appStoreId int) ([]InstalledAppAndEnvDetails, error) { +func (impl *InstalledAppRepositoryImpl) GetAllInstalledAppsByAppStoreId(appStoreId int) ([]InstalledAppAndEnvDetails, error) { var installedAppAndEnvDetails []InstalledAppAndEnvDetails var queryTemp = "select env.environment_name, env.id as environment_id, a.app_name, a.display_name, a.app_offering_mode, ia.updated_on, u.email_id," + " asav.id as app_store_application_version_id, iav.id as installed_app_version_id, ia.id as installed_app_id, ia.app_id, ia.deployment_app_type, app_status.status as app_status" + @@ -456,7 +478,7 @@ func (impl InstalledAppRepositoryImpl) GetAllInstalledAppsByAppStoreId(appStoreI return installedAppAndEnvDetails, err } -func (impl InstalledAppRepositoryImpl) GetAllInstalledAppsByChartRepoId(chartRepoId int) ([]InstalledAppAndEnvDetails, error) { +func (impl *InstalledAppRepositoryImpl) GetAllInstalledAppsByChartRepoId(chartRepoId int) ([]InstalledAppAndEnvDetails, error) { var installedAppAndEnvDetails []InstalledAppAndEnvDetails var queryTemp = "select env.environment_name, env.id as environment_id, a.app_name, ia.updated_on, u.email_id, asav.id as app_store_application_version_id, iav.id as installed_app_version_id, ia.id as installed_app_id " + " from installed_app_versions iav inner join installed_apps ia on iav.installed_app_id = ia.id" + @@ -473,7 +495,7 @@ func (impl InstalledAppRepositoryImpl) GetAllInstalledAppsByChartRepoId(chartRep return installedAppAndEnvDetails, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByInstalledAppIdAndEnvId(installedAppId int, envId int) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionByInstalledAppIdAndEnvId(installedAppId int, envId int) (*InstalledAppVersions, error) { installedAppVersion := &InstalledAppVersions{} err := impl.dbConnection. Model(installedAppVersion). @@ -519,7 +541,7 @@ func sqlIntSeq(ns []int) string { return string(b) } -func (impl InstalledAppRepositoryImpl) DeleteInstalledApp(model *InstalledApps) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) DeleteInstalledApp(model *InstalledApps) (*InstalledApps, error) { err := impl.dbConnection.Insert(model) if err != nil { impl.Logger.Error(err) @@ -528,7 +550,7 @@ func (impl InstalledAppRepositoryImpl) DeleteInstalledApp(model *InstalledApps) return model, nil } -func (impl InstalledAppRepositoryImpl) DeleteInstalledAppVersion(model *InstalledAppVersions) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) DeleteInstalledAppVersion(model *InstalledAppVersions) (*InstalledAppVersions, error) { err := impl.dbConnection.Insert(model) if err != nil { impl.Logger.Error(err) @@ -537,7 +559,7 @@ func (impl InstalledAppRepositoryImpl) DeleteInstalledAppVersion(model *Installe return model, nil } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByInstalledAppId(installedAppId int) ([]*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionByInstalledAppId(installedAppId int) ([]*InstalledAppVersions, error) { model := make([]*InstalledAppVersions, 0) err := impl.dbConnection.Model(&model). Column("installed_app_versions.*"). @@ -551,7 +573,7 @@ func (impl *InstalledAppRepositoryImpl) GetConnection() (dbConnection *pg.DB) { return impl.dbConnection } -func (impl InstalledAppRepositoryImpl) GetClusterComponentByClusterId(clusterId int) ([]*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetClusterComponentByClusterId(clusterId int) ([]*InstalledApps, error) { var models []*InstalledApps err := impl.dbConnection.Model(&models). Column("installed_apps.*", "App", "Environment"). @@ -562,7 +584,7 @@ func (impl InstalledAppRepositoryImpl) GetClusterComponentByClusterId(clusterId return models, err } -func (impl InstalledAppRepositoryImpl) GetClusterComponentByClusterIds(clusterIds []int) ([]*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetClusterComponentByClusterIds(clusterIds []int) ([]*InstalledApps, error) { var models []*InstalledApps err := impl.dbConnection.Model(&models). Column("installed_apps.*", "App", "Environment"). @@ -573,7 +595,7 @@ func (impl InstalledAppRepositoryImpl) GetClusterComponentByClusterIds(clusterId return models, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByAppIdAndEnvId(appId int, envId int) (*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionByAppIdAndEnvId(appId int, envId int) (*InstalledAppVersions, error) { installedAppVersion := &InstalledAppVersions{} err := impl.dbConnection. Model(installedAppVersion). @@ -606,7 +628,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByAppIdAndEnvId(app return installedAppVersion, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByClusterIds(clusterIds []int) ([]*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionByClusterIds(clusterIds []int) ([]*InstalledAppVersions, error) { var installedAppVersions []*InstalledAppVersions err := impl.dbConnection. Model(&installedAppVersions). @@ -640,7 +662,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByClusterIds(cluste return installedAppVersions, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByClusterIdsV2(clusterIds []int) ([]*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppVersionByClusterIdsV2(clusterIds []int) ([]*InstalledAppVersions, error) { var installedAppVersions []*InstalledAppVersions err := impl.dbConnection. Model(&installedAppVersions). @@ -673,7 +695,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppVersionByClusterIdsV2(clus return installedAppVersions, err } -func (impl InstalledAppRepositoryImpl) GetInstalledApplicationByClusterIdAndNamespaceAndAppIdentifier(clusterId int, namespace string, appIdentifier string, appName string) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledApplicationByClusterIdAndNamespaceAndAppIdentifier(clusterId int, namespace string, appIdentifier string, appName string) (*InstalledApps, error) { var installedApps []*InstalledApps err := impl.dbConnection.Model(&installedApps). Column("installed_apps.*", "App", "Environment", "App.Team"). @@ -705,7 +727,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledApplicationByClusterIdAndName return &InstalledApps{}, err } -func (impl InstalledAppRepositoryImpl) GetInstalledApplicationByClusterIdAndNamespaceAndAppName(clusterId int, namespace string, appName string) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledApplicationByClusterIdAndNamespaceAndAppName(clusterId int, namespace string, appName string) (*InstalledApps, error) { model := &InstalledApps{} err := impl.dbConnection.Model(model). Column("installed_apps.*", "App", "Environment", "App.Team"). @@ -719,7 +741,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledApplicationByClusterIdAndName return model, err } -func (impl InstalledAppRepositoryImpl) GetAppAndEnvDetailsForDeploymentAppTypeInstalledApps(deploymentAppType string, clusterIds []int) ([]*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetAppAndEnvDetailsForDeploymentAppTypeInstalledApps(deploymentAppType string, clusterIds []int) ([]*InstalledApps, error) { var installedApps []*InstalledApps err := impl.dbConnection. Model(&installedApps). @@ -733,7 +755,7 @@ func (impl InstalledAppRepositoryImpl) GetAppAndEnvDetailsForDeploymentAppTypeIn return installedApps, err } -func (impl InstalledAppRepositoryImpl) GetDeploymentSuccessfulStatusCountForTelemetry() (int, error) { +func (impl *InstalledAppRepositoryImpl) GetDeploymentSuccessfulStatusCountForTelemetry() (int, error) { countQuery := "select count(Id) from installed_apps where status=?;" var count int @@ -744,7 +766,7 @@ func (impl InstalledAppRepositoryImpl) GetDeploymentSuccessfulStatusCountForTele return count, err } -func (impl InstalledAppRepositoryImpl) GetGitOpsInstalledAppsWhereArgoAppDeletedIsTrue(installedAppId int, envId int) (InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetGitOpsInstalledAppsWhereArgoAppDeletedIsTrue(installedAppId int, envId int) (InstalledApps, error) { var installedApps InstalledApps err := impl.dbConnection.Model(&installedApps). Column("installed_apps.*", "App.id", "App.app_name", "Environment.namespace", "Environment.cluster_id", "Environment.environment_name"). @@ -759,7 +781,8 @@ func (impl InstalledAppRepositoryImpl) GetGitOpsInstalledAppsWhereArgoAppDeleted } return installedApps, nil } -func (impl InstalledAppRepositoryImpl) GetInstalledAppByGitHash(gitHash string) (InstallAppDeleteRequest, error) { + +func (impl *InstalledAppRepositoryImpl) GetInstalledAppByGitHash(gitHash string) (InstallAppDeleteRequest, error) { model := InstallAppDeleteRequest{} query := "select iv.installed_app_id, a.app_name, i.app_id, i.environment_id, a.app_offering_mode, e.cluster_id, e.namespace " + " from app a inner join installed_apps i on a.id=i.app_id " + @@ -774,7 +797,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppByGitHash(gitHash string) return model, nil } -func (impl InstalledAppRepositoryImpl) GetInstalledAppByAppIdAndDeploymentType(appId int, deploymentAppType string) (InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppByAppIdAndDeploymentType(appId int, deploymentAppType string) (InstalledApps, error) { var installedApps InstalledApps queryString := `select * from installed_apps left join deployment_config dc on dc.active=true and dc.app_id = installed_apps.app_id and dc.environment_id=installed_apps.environment_id @@ -788,7 +811,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppByAppIdAndDeploymentType(a return installedApps, nil } -func (impl InstalledAppRepositoryImpl) GetInstalledAppByAppName(appName string) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppByAppName(appName string) (*InstalledApps, error) { model := &InstalledApps{} err := impl.dbConnection.Model(model). Column("installed_apps.*", "App", "Environment"). @@ -799,7 +822,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppByAppName(appName string) return model, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppByInstalledAppVersionId(installedAppVersionId int) (InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppByInstalledAppVersionId(installedAppVersionId int) (InstalledApps, error) { var installedApps InstalledApps queryString := `select ia.* from installed_apps ia inner join installed_app_versions iav on ia.id=iav.installed_app_id left join deployment_config dc on dc.active=true and dc.app_id = ia.app_id and dc.environment_id=ia.environment_id @@ -813,7 +836,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppByInstalledAppVersionId(in return installedApps, nil } -func (impl InstalledAppRepositoryImpl) GetInstalledAppByGitOpsAppName(acdAppName string) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppByGitOpsAppName(acdAppName string) (*InstalledApps, error) { model := &InstalledApps{} err := impl.dbConnection.Model(model). Column("installed_apps.*", "App", "Environment"). @@ -826,7 +849,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppByGitOpsAppName(acdAppName return model, err } -func (impl InstalledAppRepositoryImpl) GetInstalledAppByGitRepoUrl(repoName, repoUrl string) (*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) GetInstalledAppByGitRepoUrl(repoName, repoUrl string) (*InstalledApps, error) { model := &InstalledApps{} err := impl.dbConnection.Model(model). Column("installed_apps.*", "App"). @@ -839,7 +862,7 @@ func (impl InstalledAppRepositoryImpl) GetInstalledAppByGitRepoUrl(repoName, rep return model, err } -func (impl InstalledAppRepositoryImpl) GetArgoPipelinesHavingLatestTriggerStuckInNonTerminalStatusesForAppStore(getPipelineDeployedBeforeMinutes int, getPipelineDeployedWithinHours int) ([]*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetArgoPipelinesHavingLatestTriggerStuckInNonTerminalStatusesForAppStore(getPipelineDeployedBeforeMinutes int, getPipelineDeployedWithinHours int) ([]*InstalledAppVersions, error) { var installedAppVersions []*InstalledAppVersions queryString := `select iav.* from installed_app_versions iav inner join installed_apps ia on iav.installed_app_id=ia.id @@ -850,7 +873,7 @@ func (impl InstalledAppRepositoryImpl) GetArgoPipelinesHavingLatestTriggerStuckI group by installed_app_version_id, id order by installed_app_version_id, id desc ) and (ia.deployment_app_type=? or dc.deployment_app_type=?) and iav.active=?;` _, err := impl.dbConnection.Query(&installedAppVersions, queryString, getPipelineDeployedBeforeMinutes, getPipelineDeployedWithinHours, - pg.In([]string{pipelineConfig.WorkflowAborted, pipelineConfig.WorkflowFailed, pipelineConfig.WorkflowSucceeded, string(health.HealthStatusHealthy), string(health.HealthStatusDegraded)}), + pg.In([]string{cdWorkflow.WorkflowAborted, cdWorkflow.WorkflowFailed, cdWorkflow.WorkflowSucceeded, string(health.HealthStatusHealthy), string(health.HealthStatusDegraded)}), util2.PIPELINE_DEPLOYMENT_TYPE_ACD, util2.PIPELINE_DEPLOYMENT_TYPE_ACD, true) if err != nil { impl.Logger.Errorw("error in GetArgoPipelinesHavingLatestTriggerStuckInNonTerminalStatusesForAppStore", "err", err) @@ -859,7 +882,7 @@ func (impl InstalledAppRepositoryImpl) GetArgoPipelinesHavingLatestTriggerStuckI return installedAppVersions, nil } -func (impl InstalledAppRepositoryImpl) GetArgoPipelinesHavingTriggersStuckInLastPossibleNonTerminalTimelinesForAppStore(pendingSinceSeconds int, timeForDegradation int) ([]*InstalledAppVersions, error) { +func (impl *InstalledAppRepositoryImpl) GetArgoPipelinesHavingTriggersStuckInLastPossibleNonTerminalTimelinesForAppStore(pendingSinceSeconds int, timeForDegradation int) ([]*InstalledAppVersions, error) { var installedAppVersions []*InstalledAppVersions queryString := `select iav.* from installed_app_versions iav inner join installed_apps ia on iav.installed_app_id=ia.id inner join installed_app_version_history iavh on iavh.installed_app_version_id=iav.id @@ -880,7 +903,7 @@ func (impl InstalledAppRepositoryImpl) GetArgoPipelinesHavingTriggersStuckInLast return installedAppVersions, nil } -func (impl InstalledAppRepositoryImpl) GetHelmReleaseStatusConfigByInstalledAppId(installedAppVersionHistoryId int) (string, string, error) { +func (impl *InstalledAppRepositoryImpl) GetHelmReleaseStatusConfigByInstalledAppId(installedAppVersionHistoryId int) (string, string, error) { installStatus := struct { HelmReleaseStatusConfig string Status string @@ -894,7 +917,7 @@ func (impl InstalledAppRepositoryImpl) GetHelmReleaseStatusConfigByInstalledAppI return installStatus.HelmReleaseStatusConfig, installStatus.Status, nil } -func (impl InstalledAppRepositoryImpl) GetActiveInstalledAppByEnvIdAndDeploymentType(envId int, deploymentType string, +func (impl *InstalledAppRepositoryImpl) GetActiveInstalledAppByEnvIdAndDeploymentType(envId int, deploymentType string, excludeAppIds []string, includeAppIds []string) ([]*InstalledApps, error) { var installedApps []*InstalledApps @@ -924,7 +947,7 @@ func (impl InstalledAppRepositoryImpl) GetActiveInstalledAppByEnvIdAndDeployment // UpdateDeploymentAppTypeInInstalledApp takes in deploymentAppType and list of installedAppIds and // updates the deploymentAppType in the table for given ids. -func (impl InstalledAppRepositoryImpl) UpdateDeploymentAppTypeInInstalledApp(deploymentAppType string, installedAppIdIncludes []int, userId int32, deployStatus int) error { +func (impl *InstalledAppRepositoryImpl) UpdateDeploymentAppTypeInInstalledApp(deploymentAppType string, installedAppIdIncludes []int, userId int32, deployStatus int) error { query := "update installed_apps set deployment_app_type = ?,updated_by = ?, updated_on = ?, status = ? where id in (?);" var installedApp *InstalledApps _, err := impl.dbConnection.Query(installedApp, query, deploymentAppType, userId, time.Now(), deployStatus, pg.In(installedAppIdIncludes)) @@ -932,7 +955,7 @@ func (impl InstalledAppRepositoryImpl) UpdateDeploymentAppTypeInInstalledApp(dep return err } -func (impl InstalledAppRepositoryImpl) FindInstalledAppByIds(ids []int) ([]*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) FindInstalledAppByIds(ids []int) ([]*InstalledApps, error) { var installedApps []*InstalledApps err := impl.dbConnection.Model(&installedApps). Column("installed_apps.*", "App", "Environment", "Environment.Cluster"). @@ -948,7 +971,7 @@ func (impl InstalledAppRepositoryImpl) FindInstalledAppByIds(ids []int) ([]*Inst return installedApps, err } -func (impl InstalledAppRepositoryImpl) FindInstalledAppsByAppId(appId int) ([]*InstalledApps, error) { +func (impl *InstalledAppRepositoryImpl) FindInstalledAppsByAppId(appId int) ([]*InstalledApps, error) { var installedApps []*InstalledApps err := impl.dbConnection.Model(&installedApps). Column("installed_apps.*", "App", "Environment"). diff --git a/pkg/appStore/installedApp/repository/InstalledAppVersionHistory.go b/pkg/appStore/installedApp/repository/InstalledAppVersionHistory.go index 968693d5e6..978ae60c8e 100644 --- a/pkg/appStore/installedApp/repository/InstalledAppVersionHistory.go +++ b/pkg/appStore/installedApp/repository/InstalledAppVersionHistory.go @@ -18,6 +18,7 @@ package repository import ( "fmt" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/sql" "github.com/go-pg/pg" "go.uber.org/zap" @@ -37,6 +38,7 @@ type InstalledAppVersionHistoryRepository interface { UpdateInstalledAppVersionHistoryWithTxn(models []*InstalledAppVersionHistory, tx *pg.Tx) error GetAppStoreApplicationVersionIdByInstalledAppVersionHistoryId(installedAppVersionHistoryId int) (int, error) UpdateGitHash(installedAppVersionHistoryId int, gitHash string, tx *pg.Tx) error + UpdateDeploymentHistoryMessage(installedAppVersionHistoryId int, message string) error GetConnection() *pg.DB } @@ -55,6 +57,7 @@ type InstalledAppVersionHistory struct { InstalledAppVersionId int `sql:"installed_app_version_id,notnull"` ValuesYamlRaw string `sql:"values_yaml_raw"` Status string `sql:"status"` + Message string `sql:"message"` GitHash string `sql:"git_hash"` StartedOn time.Time `sql:"started_on,type:timestamptz"` FinishedOn time.Time `sql:"finished_on,type:timestamptz"` @@ -70,11 +73,19 @@ func (model *InstalledAppVersionHistory) SetFinishedOn() { model.FinishedOn = time.Now() } +// SetStatus sets the status of the in InstalledAppVersionHistory +// To update failed status, use MarkDeploymentFailed instead as it sets the message as well func (model *InstalledAppVersionHistory) SetStatus(status string) { model.Status = status } -func (impl InstalledAppVersionHistoryRepositoryImpl) CreateInstalledAppVersionHistory(model *InstalledAppVersionHistory, tx *pg.Tx) (*InstalledAppVersionHistory, error) { +// MarkDeploymentFailed marks the deployment as failed and sets the message in InstalledAppVersionHistory +func (model *InstalledAppVersionHistory) MarkDeploymentFailed(err error) { + model.SetStatus(cdWorkflow.WorkflowFailed) + model.Message = fmt.Sprintf("Deployment failed: %v", err) +} + +func (impl *InstalledAppVersionHistoryRepositoryImpl) CreateInstalledAppVersionHistory(model *InstalledAppVersionHistory, tx *pg.Tx) (*InstalledAppVersionHistory, error) { err := tx.Insert(model) if err != nil { impl.Logger.Error(err) @@ -82,7 +93,8 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) CreateInstalledAppVersionHi } return model, nil } -func (impl InstalledAppVersionHistoryRepositoryImpl) UpdateInstalledAppVersionHistory(model *InstalledAppVersionHistory, tx *pg.Tx) (*InstalledAppVersionHistory, error) { + +func (impl *InstalledAppVersionHistoryRepositoryImpl) UpdateInstalledAppVersionHistory(model *InstalledAppVersionHistory, tx *pg.Tx) (*InstalledAppVersionHistory, error) { if tx == nil { err := impl.dbConnection.Update(model) if err != nil { @@ -98,9 +110,9 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) UpdateInstalledAppVersionHi } return model, nil } - } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetInstalledAppVersionHistory(id int) (*InstalledAppVersionHistory, error) { + +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetInstalledAppVersionHistory(id int) (*InstalledAppVersionHistory, error) { model := &InstalledAppVersionHistory{} err := impl.dbConnection.Model(model). Column("installed_app_version_history.*"). @@ -108,7 +120,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) GetInstalledAppVersionHisto return model, err } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetAppStoreApplicationVersionIdByInstalledAppVersionHistoryId(installedAppVersionHistoryId int) (int, error) { +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetAppStoreApplicationVersionIdByInstalledAppVersionHistoryId(installedAppVersionHistoryId int) (int, error) { appStoreApplicationVersionId := 0 query := "SELECT iav.app_store_application_version_id " + " FROM installed_app_version_history iavh " + @@ -121,7 +133,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) GetAppStoreApplicationVersi return appStoreApplicationVersionId, err } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetInstalledAppVersionHistoryByVersionId(installAppVersionId int) ([]*InstalledAppVersionHistory, error) { +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetInstalledAppVersionHistoryByVersionId(installAppVersionId int) ([]*InstalledAppVersionHistory, error) { var model []*InstalledAppVersionHistory err := impl.dbConnection.Model(&model). Column("installed_app_version_history.*"). @@ -131,7 +143,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) GetInstalledAppVersionHisto return model, err } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersionHistory(installAppVersionId int) (*InstalledAppVersionHistory, error) { +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersionHistory(installAppVersionId int) (*InstalledAppVersionHistory, error) { model := &InstalledAppVersionHistory{} err := impl.dbConnection.Model(model). Column("installed_app_version_history.*"). @@ -141,7 +153,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersio return model, err } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersionHistoryByGitHash(gitHash string) (*InstalledAppVersionHistory, error) { +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersionHistoryByGitHash(gitHash string) (*InstalledAppVersionHistory, error) { model := &InstalledAppVersionHistory{} err := impl.dbConnection.Model(model). Column("installed_app_version_history.*"). @@ -151,7 +163,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersio return model, err } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetAppIdAndEnvIdWithInstalledAppVersionId(id int) (int, int, error) { +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetAppIdAndEnvIdWithInstalledAppVersionId(id int) (int, int, error) { type appEnvId struct { AppId int `json:"app_id"` EnvId int `json:"env_id"` @@ -166,7 +178,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) GetAppIdAndEnvIdWithInstall return model.AppId, model.EnvId, err } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersionHistoryByInstalledAppId(installedAppId int) (*InstalledAppVersionHistory, error) { +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersionHistoryByInstalledAppId(installedAppId int) (*InstalledAppVersionHistory, error) { model := &InstalledAppVersionHistory{} query := `select iavh.* from installed_app_version_history iavh inner join installed_app_versions iav on iavh.installed_app_version_id=iav.id inner join installed_apps ia on iav.installed_app_id=ia.id where ia.id=? and iav.active=? order by iavh.id desc limit ?;` @@ -178,7 +190,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) GetLatestInstalledAppVersio return model, nil } -func (impl InstalledAppVersionHistoryRepositoryImpl) FindPreviousInstalledAppVersionHistoryByStatus(installedAppVersionId int, installedAppVersionHistoryId int, status []string) ([]*InstalledAppVersionHistory, error) { +func (impl *InstalledAppVersionHistoryRepositoryImpl) FindPreviousInstalledAppVersionHistoryByStatus(installedAppVersionId int, installedAppVersionHistoryId int, status []string) ([]*InstalledAppVersionHistory, error) { var iavr []*InstalledAppVersionHistory err := impl.dbConnection. Model(&iavr). @@ -191,7 +203,7 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) FindPreviousInstalledAppVer return iavr, err } -func (impl InstalledAppVersionHistoryRepositoryImpl) UpdateGitHash(installedAppVersionHistoryId int, gitHash string, tx *pg.Tx) error { +func (impl *InstalledAppVersionHistoryRepositoryImpl) UpdateGitHash(installedAppVersionHistoryId int, gitHash string, tx *pg.Tx) error { query := "update installed_app_version_history set git_hash=? where id=?" _, err := tx.Exec(query, gitHash, installedAppVersionHistoryId) if err != nil { @@ -200,11 +212,20 @@ func (impl InstalledAppVersionHistoryRepositoryImpl) UpdateGitHash(installedAppV return nil } -func (impl InstalledAppVersionHistoryRepositoryImpl) GetConnection() *pg.DB { +func (impl *InstalledAppVersionHistoryRepositoryImpl) UpdateDeploymentHistoryMessage(installedAppVersionHistoryId int, message string) error { + _, err := impl.dbConnection.Model((*InstalledAppVersionHistory)(nil)). + Set("message = ?", message). + Where("id = ?", installedAppVersionHistoryId). + Where("active = ?", true). + Update() + return err +} + +func (impl *InstalledAppVersionHistoryRepositoryImpl) GetConnection() *pg.DB { return impl.dbConnection } -func (impl InstalledAppVersionHistoryRepositoryImpl) UpdateInstalledAppVersionHistoryWithTxn(models []*InstalledAppVersionHistory, tx *pg.Tx) error { +func (impl *InstalledAppVersionHistoryRepositoryImpl) UpdateInstalledAppVersionHistoryWithTxn(models []*InstalledAppVersionHistory, tx *pg.Tx) error { _, err := tx.Model(&models).Update() return err } diff --git a/pkg/appStore/installedApp/service/AppStoreDeploymentDBService.go b/pkg/appStore/installedApp/service/AppStoreDeploymentDBService.go index 80ac241272..30313678ce 100644 --- a/pkg/appStore/installedApp/service/AppStoreDeploymentDBService.go +++ b/pkg/appStore/installedApp/service/AppStoreDeploymentDBService.go @@ -17,17 +17,17 @@ package service import ( - "encoding/json" "fmt" apiGitOpsBean "github.com/devtron-labs/devtron/api/bean/gitOps" "github.com/devtron-labs/devtron/internal/constants" "github.com/devtron-labs/devtron/internal/sql/repository/app" "github.com/devtron-labs/devtron/internal/sql/repository/helper" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/util" - "github.com/devtron-labs/devtron/pkg/appStore/adapter" + appStoreAdapter "github.com/devtron-labs/devtron/pkg/appStore/adapter" appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean" discoverRepository "github.com/devtron-labs/devtron/pkg/appStore/discover/repository" + installedAppAdapter "github.com/devtron-labs/devtron/pkg/appStore/installedApp/adapter" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deployment" @@ -45,7 +45,6 @@ import ( "github.com/go-pg/pg" "go.uber.org/zap" "net/http" - "time" ) type AppStoreDeploymentDBService interface { @@ -65,14 +64,8 @@ type AppStoreDeploymentDBService interface { UpdateProjectForHelmApp(appName, displayName string, teamId int, userId int32) error // InstallAppPostDbOperation is used to perform Post-Install DB operations in App Store deployments InstallAppPostDbOperation(installAppVersionRequest *appStoreBean.InstallAppVersionDTO) error - // MarkInstalledAppVersionsInactiveByInstalledAppId will mark the repository.InstalledAppVersions inactive for the given InstalledAppId - MarkInstalledAppVersionsInactiveByInstalledAppId(installedAppId int, UserId int32, tx *pg.Tx) error - // MarkInstalledAppVersionModelInActive will mark the given repository.InstalledAppVersions inactive - MarkInstalledAppVersionModelInActive(installedAppVersionModel *repository.InstalledAppVersions, UserId int32, tx *pg.Tx) error - // MarkHelmInstalledAppDeploymentSucceeded will mark the helm installed repository.InstalledAppVersionHistory Status - Succeeded - MarkHelmInstalledAppDeploymentSucceeded(versionHistoryId int) error - // UpdateInstalledAppVersionHistoryStatus will update the Status in the repository.InstalledAppVersionHistory - UpdateInstalledAppVersionHistoryStatus(versionHistoryId int, status string) error + // UpdateInstalledAppVersionHistoryStatus will update the repository.InstalledAppVersionHistory with the given adapter.UpdateVersionHistoryOperation + UpdateInstalledAppVersionHistoryStatus(versionHistoryId int, opt ...installedAppAdapter.UpdateVersionHistoryOperation) error // GetActiveAppForAppIdentifierOrReleaseName returns app db model for an app unique identifier or from display_name if either exists else it throws pg.ErrNoRows GetActiveAppForAppIdentifierOrReleaseName(appNameUniqueIdentifier, releaseName string) (*app.App, error) } @@ -132,7 +125,7 @@ func (impl *AppStoreDeploymentDBServiceImpl) AppStoreDeployOperationDB(installRe return nil, err } // setting additional env data required in appStoreBean.InstallAppVersionDTO - adapter.UpdateAdditionalEnvDetails(installRequest, environment) + appStoreAdapter.UpdateAdditionalEnvDetails(installRequest, environment) impl.appStoreValidator.Validate(installRequest, environment) @@ -206,7 +199,7 @@ func (impl *AppStoreDeploymentDBServiceImpl) AppStoreDeployOperationDB(installRe // overriding gitOps repository url -> empty (for Helm installation) installRequest.GitOpsRepoURL = "" } - installedAppModel := adapter.NewInstallAppModel(installRequest, appStoreBean.DEPLOY_INIT) + installedAppModel := appStoreAdapter.NewInstallAppModel(installRequest, appStoreBean.DEPLOY_INIT) installedApp, err := impl.installedAppRepository.CreateInstalledApp(installedAppModel, tx) if err != nil { impl.logger.Errorw("error while creating install app", "error", err) @@ -224,7 +217,7 @@ func (impl *AppStoreDeploymentDBServiceImpl) AppStoreDeployOperationDB(installRe } // Stage 4: save installed_app_versions model - installedAppVersions := adapter.NewInstallAppVersionsModel(installRequest) + installedAppVersions := appStoreAdapter.NewInstallAppVersionsModel(installRequest) _, err = impl.installedAppRepository.CreateInstalledAppVersion(installedAppVersions, tx) if err != nil { impl.logger.Errorw("error while fetching from db", "error", err) @@ -235,7 +228,7 @@ func (impl *AppStoreDeploymentDBServiceImpl) AppStoreDeployOperationDB(installRe // Stage 4: ends // populate HelmPackageName; It's used in case of virtual deployments - installRequest.HelmPackageName = adapter.GetGeneratedHelmPackageName( + installRequest.HelmPackageName = appStoreAdapter.GetGeneratedHelmPackageName( installRequest.AppName, installRequest.EnvironmentName, installedApp.UpdatedOn) @@ -247,7 +240,7 @@ func (impl *AppStoreDeploymentDBServiceImpl) AppStoreDeployOperationDB(installRe IsReleaseInstalled: false, ErrorInInstallation: false, } - installedAppVersionHistory, err := adapter.NewInstallAppVersionHistoryModel(installRequest, pipelineConfig.WorkflowInProgress, helmInstallConfigDTO) + installedAppVersionHistory, err := appStoreAdapter.NewInstallAppVersionHistoryModel(installRequest, cdWorkflow.WorkflowInProgress, helmInstallConfigDTO) if err != nil { impl.logger.Errorw("error in helm install config marshal", "err", err) } @@ -313,7 +306,7 @@ func (impl *AppStoreDeploymentDBServiceImpl) GetInstalledApp(id int) (*appStoreB impl.logger.Errorw("error in getiting deployment config db object by appId and envId", "appId", app.AppId, "envId", app.EnvironmentId, "err", err) return nil, err } - chartTemplate := adapter.GenerateInstallAppVersionMinDTO(app, deploymentConfig) + chartTemplate := appStoreAdapter.GenerateInstallAppVersionMinDTO(app, deploymentConfig) return chartTemplate, nil } @@ -484,7 +477,10 @@ func (impl *AppStoreDeploymentDBServiceImpl) InstallAppPostDbOperation(installAp // step 2 mark deployment succeeded for manifest download type helm charts if util.IsManifestDownload(installAppVersionRequest.DeploymentAppType) { - err := impl.UpdateInstalledAppVersionHistoryStatus(installAppVersionRequest.InstalledAppVersionHistoryId, pipelineConfig.WorkflowSucceeded) + err := impl.UpdateInstalledAppVersionHistoryStatus( + installAppVersionRequest.InstalledAppVersionHistoryId, + installedAppAdapter.SuccessStatusUpdateOption(installAppVersionRequest.DeploymentAppType, installAppVersionRequest.UserId), + ) if err != nil { impl.logger.Errorw("error on updating deployment status to history for chart store deployment", "versionHistoryId", installAppVersionRequest.InstalledAppVersionHistoryId, "error", err) return err @@ -493,7 +489,10 @@ func (impl *AppStoreDeploymentDBServiceImpl) InstallAppPostDbOperation(installAp // step 3 mark deployment succeeded for helm installed helm charts if util.IsHelmApp(installAppVersionRequest.DeploymentAppType) && !impl.deploymentTypeConfig.HelmInstallASyncMode { - err = impl.MarkHelmInstalledAppDeploymentSucceeded(installAppVersionRequest.InstalledAppVersionHistoryId) + err = impl.UpdateInstalledAppVersionHistoryStatus( + installAppVersionRequest.InstalledAppVersionHistoryId, + installedAppAdapter.SuccessStatusUpdateOption(installAppVersionRequest.DeploymentAppType, installAppVersionRequest.UserId), + ) if err != nil { impl.logger.Errorw("error in updating installedApp History with sync ", "err", err) return err @@ -502,38 +501,11 @@ func (impl *AppStoreDeploymentDBServiceImpl) InstallAppPostDbOperation(installAp return nil } -func (impl *AppStoreDeploymentDBServiceImpl) MarkInstalledAppVersionsInactiveByInstalledAppId(installedAppId int, UserId int32, tx *pg.Tx) error { - installedAppVersions, err := impl.installedAppRepository.GetInstalledAppVersionByInstalledAppId(installedAppId) - if err != nil { - impl.logger.Errorw("error while fetching installed version", "error", err) - return err - } - for _, installedAppVersionModel := range installedAppVersions { - installedAppVersionModel.Active = false - installedAppVersionModel.UpdatedOn = time.Now() - installedAppVersionModel.UpdatedBy = UserId - _, err = impl.installedAppRepository.UpdateInstalledAppVersion(installedAppVersionModel, tx) - if err != nil { - impl.logger.Errorw("error while update installed chart", "error", err) - return err - } - } - return nil -} - -func (impl *AppStoreDeploymentDBServiceImpl) MarkInstalledAppVersionModelInActive(installedAppVersionModel *repository.InstalledAppVersions, UserId int32, tx *pg.Tx) error { - installedAppVersionModel.Active = false - installedAppVersionModel.UpdatedOn = time.Now() - installedAppVersionModel.UpdatedBy = UserId - _, err := impl.installedAppRepository.UpdateInstalledAppVersion(installedAppVersionModel, tx) - if err != nil { - impl.logger.Errorw("error while fetching from db", "error", err) - return err +func (impl *AppStoreDeploymentDBServiceImpl) UpdateInstalledAppVersionHistoryStatus(versionHistoryId int, opt ...installedAppAdapter.UpdateVersionHistoryOperation) error { + if len(opt) == 0 { + impl.logger.Warnw("no operation provided for updating installed app version history", versionHistoryId, "versionHistoryId") + return nil } - return nil -} - -func (impl *AppStoreDeploymentDBServiceImpl) UpdateInstalledAppVersionHistoryStatus(versionHistoryId int, status string) error { dbConnection := impl.installedAppRepository.GetConnection() tx, err := dbConnection.Begin() if err != nil { @@ -542,43 +514,29 @@ func (impl *AppStoreDeploymentDBServiceImpl) UpdateInstalledAppVersionHistorySta // Rollback tx on error. defer tx.Rollback() savedInstalledAppVersionHistory, err := impl.installedAppRepositoryHistory.GetInstalledAppVersionHistory(versionHistoryId) - savedInstalledAppVersionHistory.Status = status - - _, err = impl.installedAppRepositoryHistory.UpdateInstalledAppVersionHistory(savedInstalledAppVersionHistory, tx) if err != nil { - impl.logger.Errorw("error while fetching from db", "error", err) + impl.logger.Errorw("error while fetching installed app version history from db", "versionHistoryId", versionHistoryId, "error", err) return err } - err = tx.Commit() - if err != nil { - impl.logger.Errorw("error while committing transaction to db", "error", err) - return err - } - return nil -} - -func (impl *AppStoreDeploymentDBServiceImpl) MarkHelmInstalledAppDeploymentSucceeded(versionHistoryId int) error { - installedAppVersionHistory, err := impl.installedAppRepositoryHistory.GetInstalledAppVersionHistory(versionHistoryId) - if err != nil { - impl.logger.Errorw("error in fetching installed app by installed app id in subscribe helm status callback", "err", err) - return err - } - installedAppVersionHistory.Status = pipelineConfig.WorkflowSucceeded - helmInstallStatus := &appStoreBean.HelmReleaseStatusConfig{ - InstallAppVersionHistoryId: installedAppVersionHistory.Id, - Message: "Release Installed", - IsReleaseInstalled: true, - ErrorInInstallation: false, + for _, operation := range opt { + if operation == nil { + continue + } + // update the savedInstalledAppVersionHistory with the operation + err = operation(savedInstalledAppVersionHistory) + if err != nil { + impl.logger.Errorw("error in updating installed app version history", "versionHistoryId", versionHistoryId, "error", err) + return err + } } - data, err := json.Marshal(helmInstallStatus) + _, err = impl.installedAppRepositoryHistory.UpdateInstalledAppVersionHistory(savedInstalledAppVersionHistory, tx) if err != nil { - impl.logger.Errorw("error in marshalling helmInstallStatus message") + impl.logger.Errorw("error while fetching from db", "error", err) return err } - installedAppVersionHistory.HelmReleaseStatusConfig = string(data) - _, err = impl.installedAppRepositoryHistory.UpdateInstalledAppVersionHistory(installedAppVersionHistory, nil) + err = tx.Commit() if err != nil { - impl.logger.Errorw("error in updating helm release status data in installedAppVersionHistoryRepository", "err", err) + impl.logger.Errorw("error while committing transaction to db", "error", err) return err } return nil @@ -607,7 +565,7 @@ func (impl *AppStoreDeploymentDBServiceImpl) createAppForAppStore(createRequest TeamId: createRequest.TeamId, AppType: helper.ChartStoreApp, AppOfferingMode: appInstallationMode, - DisplayName: createRequest.DisplayName, + DisplayName: createRequest.DisplayName, } if createRequest.AppType == helper.ExternalChartStoreApp { //when linking ext helm app to chart store, there can be a case that two (or more) external apps can have same name, in diff namespaces or diff diff --git a/pkg/appStore/installedApp/service/AppStoreDeploymentService.go b/pkg/appStore/installedApp/service/AppStoreDeploymentService.go index 72bf9555db..66b3910370 100644 --- a/pkg/appStore/installedApp/service/AppStoreDeploymentService.go +++ b/pkg/appStore/installedApp/service/AppStoreDeploymentService.go @@ -29,13 +29,14 @@ import ( openapi2 "github.com/devtron-labs/devtron/api/openapi/openapiClient" "github.com/devtron-labs/devtron/client/argocdServer" "github.com/devtron-labs/devtron/internal/sql/repository/app" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/appStore/adapter" appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean" repository3 "github.com/devtron-labs/devtron/pkg/appStore/chartGroup/repository" appStoreDiscoverRepository "github.com/devtron-labs/devtron/pkg/appStore/discover/repository" + installedAppAdapter "github.com/devtron-labs/devtron/pkg/appStore/installedApp/adapter" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/FullMode/deployment" @@ -541,17 +542,19 @@ func (impl *AppStoreDeploymentServiceImpl) RollbackApplication(ctx context.Conte } func (impl *AppStoreDeploymentServiceImpl) GetDeploymentHistory(ctx context.Context, installedApp *appStoreBean.InstallAppVersionDTO) (*bean3.DeploymentHistoryAndInstalledAppInfo, error) { + newCtx, span := otel.Tracer("orchestrator").Start(ctx, "AppStoreDeploymentServiceImpl.GetDeploymentHistory") + defer span.End() result := &bean3.DeploymentHistoryAndInstalledAppInfo{} var err error if util2.IsHelmApp(installedApp.AppOfferingMode) { - deploymentHistory, err := impl.eaModeDeploymentService.GetDeploymentHistory(ctx, installedApp) + deploymentHistory, err := impl.eaModeDeploymentService.GetDeploymentHistory(newCtx, installedApp) if err != nil { impl.logger.Errorw("error while getting deployment history", "error", err) return nil, err } result.DeploymentHistory = deploymentHistory.GetDeploymentHistory() } else { - deploymentHistory, err := impl.fullModeDeploymentService.GetDeploymentHistory(ctx, installedApp) + deploymentHistory, err := impl.fullModeDeploymentService.GetDeploymentHistory(newCtx, installedApp) if err != nil { impl.logger.Errorw("error while getting deployment history", "error", err) return nil, err @@ -616,6 +619,7 @@ func (impl *AppStoreDeploymentServiceImpl) UpdateInstalledApp(ctx context.Contex installedApp, err := impl.installedAppService.GetInstalledAppById(upgradeAppRequest.InstalledAppId) if err != nil { + impl.logger.Errorw("error in fetching installed app by id", "installedAppId", upgradeAppRequest.InstalledAppId, "err", err) return nil, err } //checking if ns exists or not @@ -631,6 +635,8 @@ func (impl *AppStoreDeploymentServiceImpl) UpdateInstalledApp(ctx context.Contex err = impl.helmAppService.CheckIfNsExistsForClusterIds(clusterIdToNsMap) if err != nil { + impl.logger.Errorw("error in checking if namespace exists or not", "clusterId", + installedApp.Environment.ClusterId, "namespace", installedApp.Environment.Namespace, "err", err) return nil, err } upgradeAppRequest.UpdateDeploymentAppType(deploymentConfig.DeploymentAppType) @@ -659,7 +665,7 @@ func (impl *AppStoreDeploymentServiceImpl) UpdateInstalledApp(ctx context.Contex //if chart is changed, then installedAppVersion id is sent as 0 from front-end if upgradeAppRequest.Id == 0 { isChartChanged = true - err = impl.appStoreDeploymentDBService.MarkInstalledAppVersionsInactiveByInstalledAppId(upgradeAppRequest.InstalledAppId, upgradeAppRequest.UserId, tx) + err = impl.installedAppService.MarkInstalledAppVersionsInactiveByInstalledAppId(upgradeAppRequest.InstalledAppId, upgradeAppRequest.UserId, tx) if err != nil { return nil, err } @@ -672,7 +678,7 @@ func (impl *AppStoreDeploymentServiceImpl) UpdateInstalledApp(ctx context.Contex // version is upgraded if appStoreApplication version from request payload is not equal to installed app version saved in DB if installedAppVersion.AppStoreApplicationVersionId != upgradeAppRequest.AppStoreVersion { isVersionChanged = true - err = impl.appStoreDeploymentDBService.MarkInstalledAppVersionModelInActive(installedAppVersion, upgradeAppRequest.UserId, tx) + err = impl.installedAppService.MarkInstalledAppVersionModelInActive(installedAppVersion, upgradeAppRequest.UserId, tx) } } @@ -719,7 +725,7 @@ func (impl *AppStoreDeploymentServiceImpl) UpdateInstalledApp(ctx context.Contex IsReleaseInstalled: false, ErrorInInstallation: false, } - installedAppVersionHistory, err := adapter.NewInstallAppVersionHistoryModel(upgradeAppRequest, pipelineConfig.WorkflowInProgress, helmInstallConfigDTO) + installedAppVersionHistory, err := adapter.NewInstallAppVersionHistoryModel(upgradeAppRequest, cdWorkflow.WorkflowInProgress, helmInstallConfigDTO) _, err = impl.installedAppRepositoryHistory.CreateInstalledAppVersionHistory(installedAppVersionHistory, tx) if err != nil { impl.logger.Errorw("error while creating installed app version history for updating installed app", "error", err) @@ -741,8 +747,11 @@ func (impl *AppStoreDeploymentServiceImpl) UpdateInstalledApp(ctx context.Contex // orchestrator cm prefix and appName. manifest, err := impl.fullModeDeploymentService.GenerateManifest(upgradeAppRequest, appStoreAppVersion) if err != nil { - impl.logger.Errorw("error in generating manifest for helm apps", "err", err) - _ = impl.appStoreDeploymentDBService.UpdateInstalledAppVersionHistoryStatus(upgradeAppRequest.InstalledAppVersionHistoryId, pipelineConfig.WorkflowFailed) + impl.logger.Errorw("error in generating manifest for helm apps", "installedAppVersionHistoryId", upgradeAppRequest.InstalledAppVersionHistoryId, "err", err) + _ = impl.appStoreDeploymentDBService.UpdateInstalledAppVersionHistoryStatus( + upgradeAppRequest.InstalledAppVersionHistoryId, + installedAppAdapter.FailedStatusUpdateOption(upgradeAppRequest.UserId, err), + ) return nil, err } err = impl.fullModeDeploymentService.CreateArgoRepoSecretIfNeeded(appStoreAppVersion) @@ -823,13 +832,19 @@ func (impl *AppStoreDeploymentServiceImpl) UpdateInstalledApp(ctx context.Contex upgradeAppRequest.AppName, upgradeAppRequest.EnvironmentName, installedApp.UpdatedOn) - err = impl.appStoreDeploymentDBService.UpdateInstalledAppVersionHistoryStatus(upgradeAppRequest.InstalledAppVersionHistoryId, pipelineConfig.WorkflowSucceeded) + err = impl.appStoreDeploymentDBService.UpdateInstalledAppVersionHistoryStatus( + upgradeAppRequest.InstalledAppVersionHistoryId, + installedAppAdapter.SuccessStatusUpdateOption(upgradeAppRequest.DeploymentAppType, upgradeAppRequest.UserId), + ) if err != nil { impl.logger.Errorw("error on creating history for chart deployment", "error", err) return nil, err } } else if util.IsHelmApp(upgradeAppRequest.DeploymentAppType) && !impl.deploymentTypeConfig.HelmInstallASyncMode { - err = impl.appStoreDeploymentDBService.MarkHelmInstalledAppDeploymentSucceeded(upgradeAppRequest.InstalledAppVersionHistoryId) + err = impl.appStoreDeploymentDBService.UpdateInstalledAppVersionHistoryStatus( + upgradeAppRequest.InstalledAppVersionHistoryId, + installedAppAdapter.SuccessStatusUpdateOption(upgradeAppRequest.DeploymentAppType, upgradeAppRequest.UserId), + ) if err != nil { impl.logger.Errorw("error in updating install app version history on sync", "err", err) return nil, err @@ -846,7 +861,10 @@ func (impl *AppStoreDeploymentServiceImpl) InstallAppByHelm(installAppVersionReq return installAppVersionRequest, err } if util.IsHelmApp(installAppVersionRequest.DeploymentAppType) && !impl.deploymentTypeConfig.HelmInstallASyncMode { - err = impl.appStoreDeploymentDBService.MarkHelmInstalledAppDeploymentSucceeded(installAppVersionRequest.InstalledAppVersionHistoryId) + err = impl.appStoreDeploymentDBService.UpdateInstalledAppVersionHistoryStatus( + installAppVersionRequest.InstalledAppVersionHistoryId, + installedAppAdapter.SuccessStatusUpdateOption(installAppVersionRequest.DeploymentAppType, installAppVersionRequest.UserId), + ) if err != nil { impl.logger.Errorw("error in updating installed app version history with sync", "err", err) return installAppVersionRequest, err diff --git a/pkg/appStore/installedApp/service/EAMode/EAModeDeploymentService.go b/pkg/appStore/installedApp/service/EAMode/EAModeDeploymentService.go index 88f6dfcaee..4431d1d28e 100644 --- a/pkg/appStore/installedApp/service/EAMode/EAModeDeploymentService.go +++ b/pkg/appStore/installedApp/service/EAMode/EAModeDeploymentService.go @@ -237,12 +237,14 @@ func (impl *EAModeDeploymentServiceImpl) RollbackRelease(ctx context.Context, in } func (impl *EAModeDeploymentServiceImpl) GetDeploymentHistory(ctx context.Context, installedApp *appStoreBean.InstallAppVersionDTO) (*gRPC.HelmAppDeploymentHistory, error) { + newCtx, span := otel.Tracer("orchestrator").Start(ctx, "EAModeDeploymentServiceImpl.GetDeploymentHistory") + defer span.End() helmAppIdentifier := &helmBean.AppIdentifier{ ClusterId: installedApp.ClusterId, Namespace: installedApp.Namespace, ReleaseName: installedApp.AppName, } - history, err := impl.helmAppService.GetDeploymentHistory(ctx, helmAppIdentifier) + history, err := impl.helmAppService.GetDeploymentHistory(newCtx, helmAppIdentifier) if err != nil { apiError := clientErrors.ConvertToApiError(err) if apiError != nil { diff --git a/pkg/appStore/installedApp/service/EAMode/InstalledAppDBService.go b/pkg/appStore/installedApp/service/EAMode/InstalledAppDBService.go index 6eb4156e24..0c27c5975b 100644 --- a/pkg/appStore/installedApp/service/EAMode/InstalledAppDBService.go +++ b/pkg/appStore/installedApp/service/EAMode/InstalledAppDBService.go @@ -58,6 +58,11 @@ type InstalledAppDBService interface { GetReleaseInfo(appIdentifier *helmBean.AppIdentifier) (*appStoreBean.InstallAppVersionDTO, error) IsExternalAppLinkedToChartStore(appId int) (bool, []*appStoreRepo.InstalledApps, error) CreateNewAppEntryForAllInstalledApps(installedApps []*appStoreRepo.InstalledApps) error + + // MarkInstalledAppVersionsInactiveByInstalledAppId will mark the repository.InstalledAppVersions inactive for the given InstalledAppId + MarkInstalledAppVersionsInactiveByInstalledAppId(installedAppId int, UserId int32, tx *pg.Tx) error + // MarkInstalledAppVersionModelInActive will mark the given repository.InstalledAppVersions inactive + MarkInstalledAppVersionModelInActive(installedAppVersionModel *appStoreRepo.InstalledAppVersions, UserId int32, tx *pg.Tx) error } type InstalledAppDBServiceImpl struct { @@ -437,3 +442,24 @@ func (impl *InstalledAppDBServiceImpl) CreateNewAppEntryForAllInstalledApps(inst tx.Commit() return nil } + +func (impl *InstalledAppDBServiceImpl) MarkInstalledAppVersionsInactiveByInstalledAppId(installedAppId int, userId int32, tx *pg.Tx) error { + rowsUpdated, err := impl.InstalledAppRepository.DeleteInstalledAppVersions(tx, installedAppId, userId) + if err != nil { + impl.Logger.Errorw("error while update installed chart", "installedAppId", installedAppId, "error", err) + return err + } + impl.Logger.Debugw("successfully deleted installed app versions", "rowsUpdated", rowsUpdated, "installedAppId", installedAppId) + return nil +} + +func (impl *InstalledAppDBServiceImpl) MarkInstalledAppVersionModelInActive(installedAppVersionModel *appStoreRepo.InstalledAppVersions, UserId int32, tx *pg.Tx) error { + installedAppVersionModel.MarkInActive() + installedAppVersionModel.UpdateAuditLog(UserId) + _, err := impl.InstalledAppRepository.UpdateInstalledAppVersion(installedAppVersionModel, tx) + if err != nil { + impl.Logger.Errorw("error while fetching from db", "error", err) + return err + } + return nil +} diff --git a/pkg/appStore/installedApp/service/FullMode/InstalledAppDBExtendedService.go b/pkg/appStore/installedApp/service/FullMode/InstalledAppDBExtendedService.go index 4b4642e909..79d8e11684 100644 --- a/pkg/appStore/installedApp/service/FullMode/InstalledAppDBExtendedService.go +++ b/pkg/appStore/installedApp/service/FullMode/InstalledAppDBExtendedService.go @@ -17,14 +17,12 @@ package FullMode import ( + "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" argoApplication "github.com/devtron-labs/devtron/client/argocdServer/bean" "github.com/devtron-labs/devtron/internal/util" + "github.com/devtron-labs/devtron/pkg/appStatus" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/EAMode" "github.com/devtron-labs/devtron/pkg/deployment/gitOps/config" - "time" - - "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" - "github.com/devtron-labs/devtron/pkg/appStatus" ) type InstalledAppDBExtendedService interface { @@ -50,8 +48,7 @@ func NewInstalledAppDBExtendedServiceImpl( } } -func (impl *InstalledAppDBExtendedServiceImpl) UpdateInstalledAppVersionStatus(application *v1alpha1.Application) (bool, error) { - isHealthy := false +func (impl *InstalledAppDBExtendedServiceImpl) UpdateInstalledAppVersionStatus(application *v1alpha1.Application) (isHealthy bool, err error) { dbConnection := impl.InstalledAppRepository.GetConnection() tx, err := dbConnection.Begin() if err != nil { @@ -67,14 +64,16 @@ func (impl *InstalledAppDBExtendedServiceImpl) UpdateInstalledAppVersionStatus(a } versionHistory, err := impl.InstalledAppRepositoryHistory.GetLatestInstalledAppVersionHistoryByGitHash(gitHash) if err != nil { - impl.Logger.Errorw("error while fetching installed version history", "error", err) + impl.Logger.Errorw("error while fetching installed version history", "gitHash", gitHash, "error", err) return isHealthy, err } if versionHistory.Status != (argoApplication.Healthy) { - versionHistory.Status = string(application.Status.Health.Status) - versionHistory.UpdatedOn = time.Now() - versionHistory.UpdatedBy = 1 - impl.InstalledAppRepositoryHistory.UpdateInstalledAppVersionHistory(versionHistory, tx) + versionHistory.SetStatus(string(application.Status.Health.Status)) + versionHistory.UpdateAuditLog(1) + _, dbErr := impl.InstalledAppRepositoryHistory.UpdateInstalledAppVersionHistory(versionHistory, tx) + if dbErr != nil { + impl.Logger.Errorw("error while updating installed version history", "versionHistoryId", versionHistory.Id, "error", dbErr) + } } err = tx.Commit() if err != nil { diff --git a/pkg/appStore/installedApp/service/FullMode/deployment/DeploymentStatusService.go b/pkg/appStore/installedApp/service/FullMode/deployment/DeploymentStatusService.go index c4d88ecd11..e1c6fb7fe9 100644 --- a/pkg/appStore/installedApp/service/FullMode/deployment/DeploymentStatusService.go +++ b/pkg/appStore/installedApp/service/FullMode/deployment/DeploymentStatusService.go @@ -20,6 +20,7 @@ import ( "fmt" "github.com/devtron-labs/common-lib/utils/k8s/health" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/appStore/bean" @@ -60,19 +61,19 @@ func (impl *FullModeDeploymentServiceImpl) SaveTimelineForHelmApps(installAppVer return timelineErr } -func (impl *FullModeDeploymentServiceImpl) UpdateInstalledAppAndPipelineStatusForFailedDeploymentStatus(installAppVersionRequest *appStoreBean.InstallAppVersionDTO, triggeredAt time.Time, err error) error { - if err != nil { +func (impl *FullModeDeploymentServiceImpl) UpdateInstalledAppAndPipelineStatusForFailedDeploymentStatus(installAppVersionRequest *appStoreBean.InstallAppVersionDTO, triggeredAt time.Time, deploymentErr error) error { + if deploymentErr != nil { terminalStatusExists, timelineErr := impl.pipelineStatusTimelineRepository.CheckIfTerminalStatusTimelinePresentByInstalledAppVersionHistoryId(installAppVersionRequest.InstalledAppVersionHistoryId) if timelineErr != nil { impl.Logger.Errorw("error in checking if terminal status timeline exists by installedAppVersionHistoryId", "err", timelineErr, "installedAppVersionHistoryId", installAppVersionRequest.InstalledAppVersionHistoryId) return timelineErr } if !terminalStatusExists { - impl.Logger.Infow("marking pipeline deployment failed", "err", err) + impl.Logger.Infow("marking pipeline deployment failed", "err", deploymentErr) timeline := &pipelineConfig.PipelineStatusTimeline{ InstalledAppVersionHistoryId: installAppVersionRequest.InstalledAppVersionHistoryId, Status: timelineStatus.TIMELINE_STATUS_DEPLOYMENT_FAILED, - StatusDetail: fmt.Sprintf("Deployment failed: %v", err), + StatusDetail: fmt.Sprintf("Deployment failed: %v", deploymentErr), StatusTime: time.Now(), } timeline.CreateAuditLog(1) @@ -81,26 +82,29 @@ func (impl *FullModeDeploymentServiceImpl) UpdateInstalledAppAndPipelineStatusFo impl.Logger.Errorw("error in creating timeline status for deployment fail", "err", timelineErr, "timeline", timeline) } } - impl.Logger.Errorw("error in triggering installed application deployment, setting status as fail ", "versionHistoryId", installAppVersionRequest.InstalledAppVersionHistoryId, "err", err) + impl.Logger.Errorw("error in triggering installed application deployment, setting status as fail ", "versionHistoryId", installAppVersionRequest.InstalledAppVersionHistoryId, "err", deploymentErr) - installedAppVersionHistory, err := impl.installedAppRepositoryHistory.GetInstalledAppVersionHistory(installAppVersionRequest.InstalledAppVersionHistoryId) - if err != nil { - impl.Logger.Errorw("error in getting installedAppVersionHistory by installedAppVersionHistoryId", "installedAppVersionHistoryId", installAppVersionRequest.InstalledAppVersionHistoryId, "err", err) - return err + installedAppVersionHistory, dbErr := impl.installedAppRepositoryHistory.GetInstalledAppVersionHistory(installAppVersionRequest.InstalledAppVersionHistoryId) + if dbErr != nil { + impl.Logger.Errorw("error in getting installedAppVersionHistory by installedAppVersionHistoryId", "installedAppVersionHistoryId", installAppVersionRequest.InstalledAppVersionHistoryId, "err", dbErr) + return dbErr } - installedAppVersionHistory.SetStatus(pipelineConfig.WorkflowFailed) + installedAppVersionHistory.MarkDeploymentFailed(deploymentErr) installedAppVersionHistory.FinishedOn = triggeredAt installedAppVersionHistory.UpdateAuditLog(installAppVersionRequest.UserId) - _, err = impl.installedAppRepositoryHistory.UpdateInstalledAppVersionHistory(installedAppVersionHistory, nil) - if err != nil { - impl.Logger.Errorw("error updating installed app version history status", "err", err, "installedAppVersionHistory", installedAppVersionHistory) - return err + _, dbErr = impl.installedAppRepositoryHistory.UpdateInstalledAppVersionHistory(installedAppVersionHistory, nil) + if dbErr != nil { + impl.Logger.Errorw("error updating installed app version history status", "err", dbErr, "installedAppVersionHistory", installedAppVersionHistory) + return dbErr } } else { //update [n,n-1] statuses as failed if not terminal - terminalStatus := []string{string(health.HealthStatusHealthy), pipelineConfig.WorkflowAborted, pipelineConfig.WorkflowFailed, pipelineConfig.WorkflowSucceeded} - previousNonTerminalHistory, err := impl.installedAppRepositoryHistory.FindPreviousInstalledAppVersionHistoryByStatus(installAppVersionRequest.Id, installAppVersionRequest.InstalledAppVersionHistoryId, terminalStatus) + previousNonTerminalHistory, err := impl.installedAppRepositoryHistory.FindPreviousInstalledAppVersionHistoryByStatus( + installAppVersionRequest.Id, + installAppVersionRequest.InstalledAppVersionHistoryId, + appStoreBean.InstalledAppTerminalStatusList, + ) if err != nil { impl.Logger.Errorw("error fetching previous installed app version history, updating installed app version history status,", "err", err, "installAppVersionRequest", installAppVersionRequest) return err @@ -119,30 +123,24 @@ func (impl *FullModeDeploymentServiceImpl) UpdateInstalledAppAndPipelineStatusFo var timelines []*pipelineConfig.PipelineStatusTimeline for _, previousHistory := range previousNonTerminalHistory { if previousHistory.Status == string(health.HealthStatusHealthy) || - previousHistory.Status == pipelineConfig.WorkflowSucceeded || - previousHistory.Status == pipelineConfig.WorkflowAborted || - previousHistory.Status == pipelineConfig.WorkflowFailed { + previousHistory.Status == cdWorkflow.WorkflowSucceeded || + previousHistory.Status == cdWorkflow.WorkflowAborted || + previousHistory.Status == cdWorkflow.WorkflowFailed { //terminal status return impl.Logger.Infow("skip updating installedAppVersionHistory status as previous history status is", "status", previousHistory.Status) continue } impl.Logger.Infow("updating installedAppVersionHistory status as previous runner status is", "status", previousHistory.Status) previousHistory.FinishedOn = triggeredAt - previousHistory.Status = pipelineConfig.WorkflowFailed - previousHistory.UpdatedOn = time.Now() - previousHistory.UpdatedBy = installAppVersionRequest.UserId + previousHistory.MarkDeploymentFailed(cdWorkflow.ErrorDeploymentSuperseded) + previousHistory.UpdateAuditLog(installAppVersionRequest.UserId) timeline := &pipelineConfig.PipelineStatusTimeline{ InstalledAppVersionHistoryId: previousHistory.Id, Status: timelineStatus.TIMELINE_STATUS_DEPLOYMENT_SUPERSEDED, StatusDetail: "This deployment is superseded.", StatusTime: time.Now(), - AuditLog: sql.AuditLog{ - CreatedBy: 1, - CreatedOn: time.Now(), - UpdatedBy: 1, - UpdatedOn: time.Now(), - }, } + timeline.CreateAuditLog(1) timelines = append(timelines, timeline) } diff --git a/pkg/appStore/installedApp/service/FullMode/deployment/FullModeDeploymentService.go b/pkg/appStore/installedApp/service/FullMode/deployment/FullModeDeploymentService.go index 5e598b5a91..f09e95d7da 100644 --- a/pkg/appStore/installedApp/service/FullMode/deployment/FullModeDeploymentService.go +++ b/pkg/appStore/installedApp/service/FullMode/deployment/FullModeDeploymentService.go @@ -23,7 +23,9 @@ import ( "fmt" "github.com/devtron-labs/devtron/api/helm-app/gRPC" client "github.com/devtron-labs/devtron/api/helm-app/service" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" + "github.com/devtron-labs/devtron/pkg/appStore/installedApp/adapter" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/service/common" "github.com/devtron-labs/devtron/pkg/argoRepositoryCreds" repository5 "github.com/devtron-labs/devtron/pkg/cluster/repository" @@ -52,7 +54,6 @@ import ( "github.com/devtron-labs/devtron/pkg/sql" "github.com/devtron-labs/devtron/util/argo" "github.com/go-pg/pg" - "github.com/golang/protobuf/ptypes/timestamp" "go.opentelemetry.io/otel" "go.uber.org/zap" "k8s.io/utils/pointer" @@ -279,12 +280,9 @@ func (impl *FullModeDeploymentServiceImpl) RollbackRelease(ctx context.Context, installedAppVersionHistory := &repository.InstalledAppVersionHistory{} installedAppVersionHistory.InstalledAppVersionId = installedApp.InstalledAppVersionId installedAppVersionHistory.ValuesYamlRaw = installedApp.ValuesOverrideYaml - installedAppVersionHistory.CreatedBy = installedApp.UserId - installedAppVersionHistory.CreatedOn = time.Now() - installedAppVersionHistory.UpdatedBy = installedApp.UserId - installedAppVersionHistory.UpdatedOn = time.Now() installedAppVersionHistory.StartedOn = time.Now() - installedAppVersionHistory.Status = pipelineConfig.WorkflowInProgress + installedAppVersionHistory.SetStatus(cdWorkflow.WorkflowInProgress) + installedAppVersionHistory.CreateAuditLog(installedApp.UserId) installedAppVersionHistory, err = impl.installedAppRepositoryHistory.CreateInstalledAppVersionHistory(installedAppVersionHistory, tx) if err != nil { impl.Logger.Errorw("error while fetching from db", "error", err) @@ -372,6 +370,8 @@ func (impl *FullModeDeploymentServiceImpl) RollbackRelease(ctx context.Context, } func (impl *FullModeDeploymentServiceImpl) GetDeploymentHistory(ctx context.Context, installedAppDto *appStoreBean.InstallAppVersionDTO) (*gRPC.HelmAppDeploymentHistory, error) { + newCtx, span := otel.Tracer("orchestrator").Start(ctx, "FullModeDeploymentServiceImp.GetDeploymentHistory") + defer span.End() result := &gRPC.HelmAppDeploymentHistory{} var history []*gRPC.HelmAppDeploymentDetail //TODO - response setup @@ -385,10 +385,9 @@ func (impl *FullModeDeploymentServiceImpl) GetDeploymentHistory(ctx context.Cont return result, err } for _, installedAppVersionModel := range installedAppVersions { - - sources, err := impl.getSourcesFromManifest(installedAppVersionModel.AppStoreApplicationVersion.ChartYaml) - if err != nil { - impl.Logger.Errorw("error while fetching sources", "error", err) + sources, jsonErr := impl.getSourcesFromManifest(installedAppVersionModel.AppStoreApplicationVersion.ChartYaml) + if jsonErr != nil { + impl.Logger.Errorw("error while fetching sources", "error", jsonErr) //continues here, skip error in case found issue on fetching source } versionHistory, err := impl.installedAppRepositoryHistory.GetInstalledAppVersionHistoryByVersionId(installedAppVersionModel.Id) @@ -397,32 +396,17 @@ func (impl *FullModeDeploymentServiceImpl) GetDeploymentHistory(ctx context.Cont return result, err } for _, updateHistory := range versionHistory { - emailId := "anonymous" - user, err := impl.userService.GetByIdIncludeDeleted(updateHistory.CreatedBy) - if err != nil && !util.IsErrNoRows(err) { + if len(updateHistory.Message) == 0 && updateHistory.Status == cdWorkflow.WorkflowFailed { + // if message is empty and status is failed, then update message from helm release status config. for migration purpose + // updateHistory.HelmReleaseStatusConfig stores the failed description, if async operation failed + updateHistory.Message = impl.migrateDeploymentHistoryMessage(newCtx, updateHistory) + } + emailId, err := impl.userService.GetEmailById(updateHistory.CreatedBy) + if err != nil { impl.Logger.Errorw("error while fetching user Details", "error", err) return result, err } - if user != nil { - emailId = user.EmailId - } - history = append(history, &gRPC.HelmAppDeploymentDetail{ - ChartMetadata: &gRPC.ChartMetadata{ - ChartName: installedAppVersionModel.AppStoreApplicationVersion.AppStore.Name, - ChartVersion: installedAppVersionModel.AppStoreApplicationVersion.Version, - Description: installedAppVersionModel.AppStoreApplicationVersion.Description, - Home: installedAppVersionModel.AppStoreApplicationVersion.Home, - Sources: sources, - }, - DeployedBy: emailId, - DockerImages: []string{installedAppVersionModel.AppStoreApplicationVersion.AppVersion}, - DeployedAt: ×tamp.Timestamp{ - Seconds: updateHistory.CreatedOn.Unix(), - Nanos: int32(updateHistory.CreatedOn.Nanosecond()), - }, - Version: int32(updateHistory.Id), - Status: updateHistory.Status, - }) + history = append(history, adapter.BuildDeploymentHistory(installedAppVersionModel, sources, updateHistory, emailId)) } } @@ -433,7 +417,27 @@ func (impl *FullModeDeploymentServiceImpl) GetDeploymentHistory(ctx context.Cont return result, err } -// TODO refactoring: use InstalledAppVersionHistoryId from appStoreBean.InstallAppVersionDTO instead of version int32 +func (impl *FullModeDeploymentServiceImpl) migrateDeploymentHistoryMessage(ctx context.Context, updateHistory *repository.InstalledAppVersionHistory) (helmInstallStatusMsg string) { + _, span := otel.Tracer("orchestrator").Start(ctx, "FullModeDeploymentServiceImp.migrateDeploymentHistoryMessage") + defer span.End() + helmInstallStatusMsg = updateHistory.Message + helmInstallStatus := &appStoreBean.HelmReleaseStatusConfig{} + jsonErr := json.Unmarshal([]byte(updateHistory.HelmReleaseStatusConfig), helmInstallStatus) + if jsonErr != nil { + impl.Logger.Errorw("error while unmarshal helm release status config", "helmReleaseStatusConfig", updateHistory.HelmReleaseStatusConfig, "error", jsonErr) + return helmInstallStatusMsg + } else if helmInstallStatus.ErrorInInstallation { + helmInstallStatusMsg = fmt.Sprintf("Deployment failed: %v", helmInstallStatus.Message) + dbErr := impl.installedAppRepositoryHistory.UpdateDeploymentHistoryMessage(updateHistory.Id, helmInstallStatusMsg) + if dbErr != nil { + impl.Logger.Errorw("error while updating deployment history helmInstallStatusMsg", "error", dbErr) + } + return helmInstallStatusMsg + } + return helmInstallStatusMsg +} + +// GetDeploymentHistoryInfo TODO refactoring: use InstalledAppVersionHistoryId from appStoreBean.InstallAppVersionDTO instead of version int32 func (impl *FullModeDeploymentServiceImpl) GetDeploymentHistoryInfo(ctx context.Context, installedApp *appStoreBean.InstallAppVersionDTO, version int32) (*openapi.HelmAppDeploymentManifestDetail, error) { values := &openapi.HelmAppDeploymentManifestDetail{} _, span := otel.Tracer("orchestrator").Start(ctx, "installedAppRepositoryHistory.GetInstalledAppVersionHistory") diff --git a/pkg/auth/user/UserService.go b/pkg/auth/user/UserService.go index ee33b9c64c..6b8a741808 100644 --- a/pkg/auth/user/UserService.go +++ b/pkg/auth/user/UserService.go @@ -35,7 +35,7 @@ import ( "github.com/devtron-labs/devtron/internal/constants" "github.com/devtron-labs/devtron/internal/util" casbin2 "github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin" - bean2 "github.com/devtron-labs/devtron/pkg/auth/user/bean" + userBean "github.com/devtron-labs/devtron/pkg/auth/user/bean" "github.com/devtron-labs/devtron/pkg/auth/user/repository" "github.com/devtron-labs/devtron/pkg/sql" util2 "github.com/devtron-labs/devtron/util" @@ -61,7 +61,16 @@ type UserService interface { GetAllDetailedUsers() ([]bean.UserInfo, error) GetEmailFromToken(token string) (string, error) GetEmailAndVersionFromToken(token string) (string, string, error) + // GetEmailById returns emailId by userId + // - if user is not found then it returns bean.AnonymousUserEmail user email + // - if user is found but inactive then it returns `emailId (inactive)` + // - if user is found and active then it returns `emailId` GetEmailById(userId int32) (string, error) + // GetActiveEmailById returns emailId by userId + // - it only returns emailId if user is active + // - if user is not found then it returns empty string + // for audit emails use GetEmailById instead + GetActiveEmailById(userId int32) (string, error) GetLoggedInUser(r *http.Request) (int32, error) GetByIds(ids []int32) ([]bean.UserInfo, error) DeleteUser(userInfo *bean.UserInfo) (bool, error) @@ -420,7 +429,7 @@ func (impl *UserServiceImpl) createUserIfNotExists(userInfo *bean.UserInfo, emai if err != nil || flag == false { return nil, err } - roleModel, err := impl.userAuthRepository.GetRoleByFilterForAllTypes("", "", "", "", bean2.SUPER_ADMIN, "", "", "", "", "", "", "", false, "") + roleModel, err := impl.userAuthRepository.GetRoleByFilterForAllTypes("", "", "", "", userBean.SUPER_ADMIN, "", "", "", "", "", "", "", false, "") if err != nil { return nil, err } @@ -459,12 +468,12 @@ func (impl *UserServiceImpl) CreateOrUpdateUserRolesForAllTypes(roleFilter bean. var policiesToBeAdded = make([]casbin2.Policy, 0, capacity) var err error rolesChanged := false - if entity == bean2.CLUSTER_ENTITIY { + if entity == userBean.CLUSTER_ENTITIY { policiesToBeAdded, rolesChanged, err = impl.createOrUpdateUserRolesForClusterEntity(roleFilter, userId, model, existingRoles, tx, entity, capacity) if err != nil { return nil, false, err } - } else if entity == bean2.EntityJobs { + } else if entity == userBean.EntityJobs { policiesToBeAdded, rolesChanged, err = impl.createOrUpdateUserRolesForJobsEntity(roleFilter, userId, model, existingRoles, tx, entity, capacity) if err != nil { return nil, false, err @@ -608,7 +617,7 @@ func (impl *UserServiceImpl) mergeGroups(oldGroups []string, newGroups []string) } // mergeUserRoleGroup : patches the existing userRoleGroups and new userRoleGroups with unique key name-status-expression, -func (impl UserServiceImpl) mergeUserRoleGroup(oldUserRoleGroups []bean.UserRoleGroup, newUserRoleGroups []bean.UserRoleGroup) []bean.UserRoleGroup { +func (impl *UserServiceImpl) mergeUserRoleGroup(oldUserRoleGroups []bean.UserRoleGroup, newUserRoleGroups []bean.UserRoleGroup) []bean.UserRoleGroup { finalUserRoleGroups := make([]bean.UserRoleGroup, 0) keyMap := make(map[string]bool) for _, userRoleGroup := range oldUserRoleGroups { @@ -778,7 +787,7 @@ func (impl *UserServiceImpl) UpdateUser(userInfo *bean.UserInfo, token string, c if err != nil || flag == false { return nil, err } - roleModel, err := impl.userAuthRepository.GetRoleByFilterForAllTypes("", "", "", "", bean2.SUPER_ADMIN, "", "", "", "", "", "", "", false, "") + roleModel, err := impl.userAuthRepository.GetRoleByFilterForAllTypes("", "", "", "", userBean.SUPER_ADMIN, "", "", "", "", "", "", "", false, "") if err != nil { return nil, err } @@ -846,9 +855,9 @@ func (impl *UserServiceImpl) GetById(id int32) (*bean.UserInfo, error) { isSuperAdmin, roleFilters, filterGroups, userRoleGroups := impl.getUserMetadata(model) for index, roleFilter := range roleFilters { if roleFilter.Entity == "" { - roleFilters[index].Entity = bean2.ENTITY_APPS + roleFilters[index].Entity = userBean.ENTITY_APPS if roleFilter.AccessType == "" { - roleFilters[index].AccessType = bean2.DEVTRON_APP + roleFilters[index].AccessType = userBean.DEVTRON_APP } } } @@ -967,7 +976,7 @@ func (impl *UserServiceImpl) GetAll() ([]bean.UserInfo, error) { } // GetAllWithFilters takes filter request gives UserListingResponse as output with some operations like filter, sorting, searching,pagination support inbuilt -func (impl UserServiceImpl) GetAllWithFilters(request *bean.ListingRequest) (*bean.UserListingResponse, error) { +func (impl *UserServiceImpl) GetAllWithFilters(request *bean.ListingRequest) (*bean.UserListingResponse, error) { // default values will be used if not provided impl.userCommonService.SetDefaultValuesIfNotPresent(request, false) if request.ShowAll { @@ -1008,7 +1017,7 @@ func (impl UserServiceImpl) GetAllWithFilters(request *bean.ListingRequest) (*be } -func (impl UserServiceImpl) getAllDetailedUsersAdapter(detailedUsers []bean.UserInfo) *bean.UserListingResponse { +func (impl *UserServiceImpl) getAllDetailedUsersAdapter(detailedUsers []bean.UserInfo) *bean.UserListingResponse { listingResponse := &bean.UserListingResponse{ Users: detailedUsers, TotalCount: len(detailedUsers), @@ -1016,7 +1025,7 @@ func (impl UserServiceImpl) getAllDetailedUsersAdapter(detailedUsers []bean.User return listingResponse } -func (impl UserServiceImpl) getUserResponse(model []repository.UserModel, totalCount int) (*bean.UserListingResponse, error) { +func (impl *UserServiceImpl) getUserResponse(model []repository.UserModel, totalCount int) (*bean.UserListingResponse, error) { var response []bean.UserInfo for _, m := range model { lastLoginTime := adapter.GetLastLoginTime(m) @@ -1053,10 +1062,10 @@ func (impl *UserServiceImpl) getAllDetailedUsers(req *bean.ListingRequest) ([]be lastLoginTime := adapter.GetLastLoginTime(model) for index, roleFilter := range roleFilters { if roleFilter.Entity == "" { - roleFilters[index].Entity = bean2.ENTITY_APPS + roleFilters[index].Entity = userBean.ENTITY_APPS } - if roleFilter.Entity == bean2.ENTITY_APPS && roleFilter.AccessType == "" { - roleFilters[index].AccessType = bean2.DEVTRON_APP + if roleFilter.Entity == userBean.ENTITY_APPS && roleFilter.AccessType == "" { + roleFilters[index].AccessType = userBean.DEVTRON_APP } } response = append(response, bean.UserInfo{ @@ -1086,10 +1095,10 @@ func (impl *UserServiceImpl) GetAllDetailedUsers() ([]bean.UserInfo, error) { isSuperAdmin, roleFilters, filterGroups, _ := impl.getUserMetadata(&model) for index, roleFilter := range roleFilters { if roleFilter.Entity == "" { - roleFilters[index].Entity = bean2.ENTITY_APPS + roleFilters[index].Entity = userBean.ENTITY_APPS } - if roleFilter.Entity == bean2.ENTITY_APPS && roleFilter.AccessType == "" { - roleFilters[index].AccessType = bean2.DEVTRON_APP + if roleFilter.Entity == userBean.ENTITY_APPS && roleFilter.AccessType == "" { + roleFilters[index].AccessType = userBean.DEVTRON_APP } } response = append(response, bean.UserInfo{ @@ -1119,10 +1128,11 @@ func (impl *UserServiceImpl) UserExists(emailId string) bool { return true } } + func (impl *UserServiceImpl) SaveLoginAudit(emailId, clientIp string, id int32) { if emailId != "" && id <= 0 { - user, err := impl.GetUserByEmail(emailId) + user, err := impl.getUserByEmail(emailId) if err != nil { impl.logger.Errorw("error in getting userInfo by emailId", "err", err, "emailId", emailId) return @@ -1143,7 +1153,7 @@ func (impl *UserServiceImpl) SaveLoginAudit(emailId, clientIp string, id int32) } } -func (impl *UserServiceImpl) GetUserByEmail(emailId string) (*bean.UserInfo, error) { +func (impl *UserServiceImpl) getUserByEmail(emailId string) (*bean.UserInfo, error) { model, err := impl.userRepository.FetchActiveUserByEmail(emailId) if err != nil { impl.logger.Errorw("error while fetching user from db", "error", err) @@ -1182,7 +1192,7 @@ func (impl *UserServiceImpl) GetUserByEmail(emailId string) (*bean.UserInfo, err return response, nil } -func (impl *UserServiceImpl) GetEmailById(userId int32) (string, error) { +func (impl *UserServiceImpl) GetActiveEmailById(userId int32) (string, error) { var emailId string model, err := impl.userRepository.GetById(userId) if err != nil { @@ -1195,6 +1205,23 @@ func (impl *UserServiceImpl) GetEmailById(userId int32) (string, error) { return emailId, nil } +func (impl *UserServiceImpl) GetEmailById(userId int32) (string, error) { + emailId := userBean.AnonymousUserEmail + userModel, err := impl.userRepository.GetByIdIncludeDeleted(userId) + if err != nil && !util.IsErrNoRows(err) { + impl.logger.Errorw("error while fetching user Details", "error", err) + return emailId, err + } + if userModel != nil { + if !userModel.Active { + emailId = fmt.Sprintf("%s (inactive)", userModel.EmailId) + } else { + emailId = userModel.EmailId + } + } + return emailId, nil +} + func (impl *UserServiceImpl) GetLoggedInUser(r *http.Request) (int32, error) { _, span := otel.Tracer("userService").Start(r.Context(), "GetLoggedInUser") defer span.End() @@ -1219,7 +1246,7 @@ func (impl *UserServiceImpl) GetUserByToken(context context.Context, token strin if err != nil { return http.StatusUnauthorized, "", err } - userInfo, err := impl.GetUserByEmail(email) + userInfo, err := impl.getUserByEmail(email) if err != nil { impl.logger.Errorw("unable to fetch user from db", "error", err) err := &util.ApiError{ @@ -1560,7 +1587,7 @@ func (impl *UserServiceImpl) CheckUserRoles(id int32) ([]string, error) { return groups, nil } -func (impl UserServiceImpl) getUniquesRolesByGroupCasbinNames(groupCasbinNames []string) ([]string, error) { +func (impl *UserServiceImpl) getUniquesRolesByGroupCasbinNames(groupCasbinNames []string) ([]string, error) { rolesModels, err := impl.roleGroupRepository.GetRolesByGroupCasbinNames(groupCasbinNames) if err != nil && err != pg.ErrNoRows { impl.logger.Errorw("error in getting roles by group names", "err", err) @@ -1671,7 +1698,7 @@ func (impl *UserServiceImpl) checkGroupAuth(groupName string, token string, mana hasAccessToGroup = false hasSuperAdminPermission = true } - if role.AccessType == bean2.APP_ACCESS_TYPE_HELM && !isActionUserSuperAdmin { + if role.AccessType == userBean.APP_ACCESS_TYPE_HELM && !isActionUserSuperAdmin { hasAccessToGroup = false } if len(role.Team) > 0 { @@ -1681,7 +1708,7 @@ func (impl *UserServiceImpl) checkGroupAuth(groupName string, token string, mana hasAccessToGroup = false } } - if role.Entity == bean2.CLUSTER_ENTITIY && !isActionUserSuperAdmin { + if role.Entity == userBean.CLUSTER_ENTITIY && !isActionUserSuperAdmin { isValidAuth := impl.userCommonService.CheckRbacForClusterEntity(role.Cluster, role.Namespace, role.Group, role.Kind, role.Resource, token, managerAuth) if !isValidAuth { hasAccessToGroup = false @@ -1737,10 +1764,10 @@ func (impl *UserServiceImpl) GetRoleFiltersByUserRoleGroups(userRoleGroups []bea } for index, roleFilter := range roleFilters { if roleFilter.Entity == "" { - roleFilters[index].Entity = bean2.ENTITY_APPS + roleFilters[index].Entity = userBean.ENTITY_APPS } - if roleFilter.Entity == bean2.ENTITY_APPS && roleFilter.AccessType == "" { - roleFilters[index].AccessType = bean2.DEVTRON_APP + if roleFilter.Entity == userBean.ENTITY_APPS && roleFilter.AccessType == "" { + roleFilters[index].AccessType = userBean.DEVTRON_APP } } return roleFilters, nil diff --git a/pkg/auth/user/bean/bean.go b/pkg/auth/user/bean/bean.go index 6e80e04307..08471a6b59 100644 --- a/pkg/auth/user/bean/bean.go +++ b/pkg/auth/user/bean/bean.go @@ -113,3 +113,5 @@ const ( API_TOKEN_USER_EMAIL_PREFIX = "API-TOKEN:" ApiTokenTableName = "api_token" ) + +const AnonymousUserEmail string = "anonymous" diff --git a/pkg/bean/app.go b/pkg/bean/app.go index 625bf8eef9..4ac7f16d26 100644 --- a/pkg/bean/app.go +++ b/pkg/bean/app.go @@ -653,6 +653,11 @@ func (cdpipelineConfig *CDPipelineConfigObject) IsSwitchCiPipelineRequest() bool return cdpipelineConfig.SwitchFromCiPipelineId > 0 && cdpipelineConfig.AppWorkflowId > 0 } +func (cdpipelineConfig *CDPipelineConfigObject) PatchSourceInfo() (int, string) { + //as the source will be always CI_PIPELINE in case of external-ci change request + return cdpipelineConfig.SwitchFromCiPipelineId, appWorkflow.CIPIPELINE +} + type PreStageConfigMapSecretNames struct { ConfigMaps []string `json:"configMaps"` Secrets []string `json:"secrets"` diff --git a/pkg/deployment/gitOps/config/GitOpsConfigReadService.go b/pkg/deployment/gitOps/config/GitOpsConfigReadService.go index d91f014fc9..b4828fec12 100644 --- a/pkg/deployment/gitOps/config/GitOpsConfigReadService.go +++ b/pkg/deployment/gitOps/config/GitOpsConfigReadService.go @@ -83,7 +83,7 @@ func (impl *GitOpsConfigReadServiceImpl) GetUserEmailIdAndNameForGitOpsCommit(us emailId := bean.GitOpsCommitDefaultEmailId name := bean.GitOpsCommitDefaultName //getting emailId associated with user - userEmail, err := impl.userService.GetEmailById(userId) + userEmail, err := impl.userService.GetActiveEmailById(userId) if err != nil { impl.logger.Errorw("error in getting user info by id", "err", err, "id", userId) } diff --git a/pkg/deployment/trigger/devtronApps/PostStageTriggerService.go b/pkg/deployment/trigger/devtronApps/PostStageTriggerService.go index 26a20f2843..bacaa1a098 100644 --- a/pkg/deployment/trigger/devtronApps/PostStageTriggerService.go +++ b/pkg/deployment/trigger/devtronApps/PostStageTriggerService.go @@ -19,7 +19,7 @@ package devtronApps import ( "context" bean2 "github.com/devtron-labs/devtron/api/bean" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/deployment/trigger/devtronApps/bean" bean3 "github.com/devtron-labs/devtron/pkg/pipeline/bean" repository3 "github.com/devtron-labs/devtron/pkg/pipeline/history/repository" @@ -94,7 +94,7 @@ func (impl *TriggerServiceImpl) TriggerPostStage(request bean.TriggerRequest) er pluginImagePathReservationIds, err := impl.setCopyContainerImagePluginDataAndReserveImages(cdStageWorkflowRequest, pipeline.Id, types.POST, cdWf.CiArtifact) if err != nil { - runner.Status = pipelineConfig.WorkflowFailed + runner.Status = cdWorkflow.WorkflowFailed runner.Message = err.Error() _ = impl.cdWorkflowRepository.UpdateWorkFlowRunner(runner) return err diff --git a/pkg/deployment/trigger/devtronApps/PreStageTriggerService.go b/pkg/deployment/trigger/devtronApps/PreStageTriggerService.go index 244c5b0c47..312671127c 100644 --- a/pkg/deployment/trigger/devtronApps/PreStageTriggerService.go +++ b/pkg/deployment/trigger/devtronApps/PreStageTriggerService.go @@ -25,6 +25,7 @@ import ( gitSensorClient "github.com/devtron-labs/devtron/client/gitSensor" "github.com/devtron-labs/devtron/internal/sql/repository" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/util" bean4 "github.com/devtron-labs/devtron/pkg/bean" repository2 "github.com/devtron-labs/devtron/pkg/cluster/repository" @@ -113,7 +114,7 @@ func (impl *TriggerServiceImpl) TriggerPreStage(request bean.TriggerRequest) err // handling copyContainerImage plugin specific logic imagePathReservationIds, err := impl.setCopyContainerImagePluginDataAndReserveImages(cdStageWorkflowRequest, pipeline.Id, types.PRE, artifact) if err != nil { - runner.Status = pipelineConfig.WorkflowFailed + runner.Status = cdWorkflow.WorkflowFailed runner.Message = err.Error() _ = impl.cdWorkflowRepository.UpdateWorkFlowRunner(runner) return err @@ -166,7 +167,7 @@ func (impl *TriggerServiceImpl) createStartingWfAndRunner(request bean.TriggerRe Name: pipeline.Name, WorkflowType: request.WorkflowType, ExecutorType: impl.config.GetWorkflowExecutorType(), - Status: pipelineConfig.WorkflowStarting, // starting PreStage + Status: cdWorkflow.WorkflowStarting, // starting PreStage TriggeredBy: triggeredBy, StartedOn: triggeredAt, Namespace: request.RunStageInEnvNamespace, @@ -222,8 +223,8 @@ func (impl *TriggerServiceImpl) checkVulnerabilityStatusAndFailWfIfNeeded(ctx co } if isVulnerable { // if image vulnerable, update timeline status and return - runner.Status = pipelineConfig.WorkflowFailed - runner.Message = pipelineConfig.FOUND_VULNERABILITY + runner.Status = cdWorkflow.WorkflowFailed + runner.Message = cdWorkflow.FOUND_VULNERABILITY runner.FinishedOn = time.Now() runner.UpdatedOn = time.Now() runner.UpdatedBy = triggeredBy @@ -912,7 +913,7 @@ func (impl *TriggerServiceImpl) getDeployStageDetails(pipelineId int) (pipelineC impl.logger.Errorw("error in getting latest status of deploy type wfr by pipelineId", "err", err, "pipelineId", pipelineId) return deployStageWfr, "", 0, err } - deployStageTriggeredByUserEmail, err := impl.userService.GetEmailById(deployStageWfr.TriggeredBy) + deployStageTriggeredByUserEmail, err := impl.userService.GetActiveEmailById(deployStageWfr.TriggeredBy) if err != nil { impl.logger.Errorw("error in getting user email by id", "err", err, "userId", deployStageWfr.TriggeredBy) return deployStageWfr, "", 0, err diff --git a/pkg/deployment/trigger/devtronApps/TriggerService.go b/pkg/deployment/trigger/devtronApps/TriggerService.go index dbcff74daf..7d1675f723 100644 --- a/pkg/deployment/trigger/devtronApps/TriggerService.go +++ b/pkg/deployment/trigger/devtronApps/TriggerService.go @@ -39,6 +39,7 @@ import ( "github.com/devtron-labs/devtron/internal/sql/repository/chartConfig" repository4 "github.com/devtron-labs/devtron/internal/sql/repository/dockerRegistry" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" "github.com/devtron-labs/devtron/internal/sql/repository/security" "github.com/devtron-labs/devtron/internal/util" @@ -355,7 +356,7 @@ func (impl *TriggerServiceImpl) validateDeploymentTriggerRequest(ctx context.Con if isVulnerable == true { // if image vulnerable, update timeline status and return - if err = impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(runner, errors.New(pipelineConfig.FOUND_VULNERABILITY), triggeredBy); err != nil { + if err = impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(runner, errors.New(cdWorkflow.FOUND_VULNERABILITY), triggeredBy); err != nil { impl.logger.Errorw("error while updating current runner status to failed, TriggerDeployment", "wfrId", runner.Id, "err", err) } return fmt.Errorf("found vulnerability for image digest %s", imageDigest) @@ -442,8 +443,8 @@ func (impl *TriggerServiceImpl) ManualCdTrigger(triggerContext bean.TriggerConte runner := &pipelineConfig.CdWorkflowRunner{ Name: cdPipeline.Name, WorkflowType: bean3.CD_WORKFLOW_TYPE_DEPLOY, - ExecutorType: pipelineConfig.WORKFLOW_EXECUTOR_TYPE_AWF, - Status: pipelineConfig.WorkflowInitiated, //deployment Initiated for manual trigger + ExecutorType: cdWorkflow.WORKFLOW_EXECUTOR_TYPE_AWF, + Status: cdWorkflow.WorkflowInitiated, //deployment Initiated for manual trigger TriggeredBy: overrideRequest.UserId, StartedOn: triggeredAt, Namespace: impl.config.GetDefaultNamespace(), @@ -585,8 +586,8 @@ func (impl *TriggerServiceImpl) TriggerAutomaticDeployment(request bean.TriggerR runner := &pipelineConfig.CdWorkflowRunner{ Name: pipeline.Name, WorkflowType: bean3.CD_WORKFLOW_TYPE_DEPLOY, - ExecutorType: pipelineConfig.WORKFLOW_EXECUTOR_TYPE_SYSTEM, - Status: pipelineConfig.WorkflowInitiated, // deployment Initiated for auto trigger + ExecutorType: cdWorkflow.WORKFLOW_EXECUTOR_TYPE_SYSTEM, + Status: cdWorkflow.WorkflowInitiated, // deployment Initiated for auto trigger TriggeredBy: 1, StartedOn: triggeredAt, Namespace: impl.config.GetDefaultNamespace(), @@ -826,7 +827,7 @@ func (impl *TriggerServiceImpl) performGitOps(ctx context.Context, newCtx, span := otel.Tracer("orchestrator").Start(ctx, "TriggerServiceImpl.performGitOps") defer span.End() // update workflow runner status, used in app workflow view - err := impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, pipelineConfig.WorkflowInProgress) + err := impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, cdWorkflow.WorkflowInProgress) if err != nil { impl.logger.Errorw("error in updating the workflow runner status", "err", err) return err @@ -1069,7 +1070,7 @@ func (impl *TriggerServiceImpl) createHelmAppForCdPipeline(ctx context.Context, if err != nil { impl.logger.Errorw("error in updating helm application for cd pipelineModel", "err", err) if util.IsErrorContextCancelled(err) { - return false, pipelineConfig.ErrorDeploymentSuperseded + return false, cdWorkflow.ErrorDeploymentSuperseded } else if util.IsErrorContextDeadlineExceeded(err) { return false, context.DeadlineExceeded } @@ -1104,7 +1105,7 @@ func (impl *TriggerServiceImpl) createHelmAppForCdPipeline(ctx context.Context, impl.logger.Errorw("failed to update deployment app created flag in pipelineModel table", "err", err) } if util.IsErrorContextCancelled(err) { - return false, pipelineConfig.ErrorDeploymentSuperseded + return false, cdWorkflow.ErrorDeploymentSuperseded } else if util.IsErrorContextDeadlineExceeded(err) { return false, context.DeadlineExceeded } @@ -1124,7 +1125,7 @@ func (impl *TriggerServiceImpl) createHelmAppForCdPipeline(ctx context.Context, } //update workflow runner status, used in app workflow view - err := impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, pipelineConfig.WorkflowInProgress) + err := impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, cdWorkflow.WorkflowInProgress) if err != nil { impl.logger.Errorw("error in updating the workflow runner status, createHelmAppForCdPipeline", "err", err) return false, err @@ -1467,13 +1468,13 @@ func (impl *TriggerServiceImpl) handleCustomGitOpsRepoValidation(runner *pipelin // return err //} if gitOps.IsGitOpsRepoNotConfigured(envDeploymentConfig.RepoURL) { - if err = impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(runner, errors.New(pipelineConfig.GITOPS_REPO_NOT_CONFIGURED), triggeredBy); err != nil { + if err = impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(runner, errors.New(cdWorkflow.GITOPS_REPO_NOT_CONFIGURED), triggeredBy); err != nil { impl.logger.Errorw("error while updating current runner status to failed, TriggerDeployment", "wfrId", runner.Id, "err", err) } apiErr := &util.ApiError{ HttpStatusCode: http.StatusConflict, - UserMessage: pipelineConfig.GITOPS_REPO_NOT_CONFIGURED, - InternalMessage: pipelineConfig.GITOPS_REPO_NOT_CONFIGURED, + UserMessage: cdWorkflow.GITOPS_REPO_NOT_CONFIGURED, + InternalMessage: cdWorkflow.GITOPS_REPO_NOT_CONFIGURED, } return apiErr } diff --git a/pkg/deployment/trigger/devtronApps/userDeploymentRequest/repository/UserDeploymentRequestRepository.go b/pkg/deployment/trigger/devtronApps/userDeploymentRequest/repository/UserDeploymentRequestRepository.go index f40295a28d..689421e25e 100644 --- a/pkg/deployment/trigger/devtronApps/userDeploymentRequest/repository/UserDeploymentRequestRepository.go +++ b/pkg/deployment/trigger/devtronApps/userDeploymentRequest/repository/UserDeploymentRequestRepository.go @@ -21,7 +21,7 @@ import ( "context" apiBean "github.com/devtron-labs/devtron/api/bean" "github.com/devtron-labs/devtron/internal/sql/models" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" "github.com/devtron-labs/devtron/pkg/sql" "github.com/go-pg/pg" @@ -146,7 +146,7 @@ func (impl *UserDeploymentRequestRepositoryImpl) GetAllInCompleteRequests(ctx co Join("LEFT JOIN pipeline_status_timeline pst"). JoinOn("cdwfr.id = pst.cd_workflow_runner_id"). Where("cdwfr.workflow_type = ?", apiBean.CD_WORKFLOW_TYPE_DEPLOY). - Where("cdwfr.status NOT IN (?)", pg.In(append(pipelineConfig.WfrTerminalStatusList, pipelineConfig.WorkflowInQueue))). + Where("cdwfr.status NOT IN (?)", pg.In(append(cdWorkflow.WfrTerminalStatusList, cdWorkflow.WorkflowInQueue))). Where("pst.status = ?", timelineStatus.TIMELINE_STATUS_DEPLOYMENT_REQUEST_VALIDATED). Where("NOT EXISTS (?)", subQuery). Group("pipeline_id") diff --git a/pkg/eventProcessor/in/AppStoreAppsEventProcessorService.go b/pkg/eventProcessor/in/AppStoreAppsEventProcessorService.go index 7242aea9c2..5c4774ae5a 100644 --- a/pkg/eventProcessor/in/AppStoreAppsEventProcessorService.go +++ b/pkg/eventProcessor/in/AppStoreAppsEventProcessorService.go @@ -18,9 +18,10 @@ package in import ( "encoding/json" + "errors" pubsub "github.com/devtron-labs/common-lib/pubsub-lib" "github.com/devtron-labs/common-lib/pubsub-lib/model" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" appStoreBean "github.com/devtron-labs/devtron/pkg/appStore/bean" "github.com/devtron-labs/devtron/pkg/appStore/chartGroup" "github.com/devtron-labs/devtron/pkg/appStore/installedApp/repository" @@ -99,9 +100,11 @@ func (impl *AppStoreAppsEventProcessorImpl) SubscribeHelmInstallStatusEvent() er return } if helmInstallNatsMessage.ErrorInInstallation { - installedAppVersionHistory.Status = pipelineConfig.WorkflowFailed + // if error in installation then mark deployment failed + // for helmInstallNatsMessage.ErrorInInstallation = true, helmInstallNatsMessage.Message will have the error message from kubelink + installedAppVersionHistory.MarkDeploymentFailed(errors.New(helmInstallNatsMessage.Message)) } else { - installedAppVersionHistory.Status = pipelineConfig.WorkflowSucceeded + installedAppVersionHistory.SetStatus(cdWorkflow.WorkflowSucceeded) } installedAppVersionHistory.HelmReleaseStatusConfig = msg.Data _, err = impl.iavHistoryRepository.UpdateInstalledAppVersionHistory(installedAppVersionHistory, nil) diff --git a/pkg/eventProcessor/in/WorkflowEventProcessorService.go b/pkg/eventProcessor/in/WorkflowEventProcessorService.go index afd0318248..1765448cbf 100644 --- a/pkg/eventProcessor/in/WorkflowEventProcessorService.go +++ b/pkg/eventProcessor/in/WorkflowEventProcessorService.go @@ -30,6 +30,7 @@ import ( "github.com/devtron-labs/devtron/internal/sql/models" "github.com/devtron-labs/devtron/internal/sql/repository" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + cdWorkflowModelBean "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" util3 "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/app" userBean "github.com/devtron-labs/devtron/pkg/auth/user/bean" @@ -238,7 +239,7 @@ func (impl *WorkflowEventProcessorImpl) SubscribeTriggerBulkAction() error { latest, err := impl.cdWorkflowService.CheckIfLatestWf(cdWorkflow.PipelineId, cdWorkflow.Id) if err != nil { impl.logger.Errorw("error in determining latest", "wf", cdWorkflow, "err", err) - wf.WorkflowStatus = pipelineConfig.DEQUE_ERROR + wf.WorkflowStatus = cdWorkflowModelBean.DEQUE_ERROR err = impl.cdWorkflowService.UpdateWorkFlow(wf) if err != nil { impl.logger.Errorw("error in updating wf", "err", err, "req", wf) @@ -246,7 +247,7 @@ func (impl *WorkflowEventProcessorImpl) SubscribeTriggerBulkAction() error { return } if !latest { - wf.WorkflowStatus = pipelineConfig.DROPPED_STALE + wf.WorkflowStatus = cdWorkflowModelBean.DROPPED_STALE err = impl.cdWorkflowService.UpdateWorkFlow(wf) if err != nil { impl.logger.Errorw("error in updating wf", "err", err, "req", wf) @@ -256,7 +257,7 @@ func (impl *WorkflowEventProcessorImpl) SubscribeTriggerBulkAction() error { pipelineObj, err := impl.pipelineRepository.FindById(cdWorkflow.PipelineId) if err != nil { impl.logger.Errorw("error in fetching pipeline", "err", err) - wf.WorkflowStatus = pipelineConfig.TRIGGER_ERROR + wf.WorkflowStatus = cdWorkflowModelBean.TRIGGER_ERROR err = impl.cdWorkflowService.UpdateWorkFlow(wf) if err != nil { impl.logger.Errorw("error in updating wf", "err", err, "req", wf) @@ -266,7 +267,7 @@ func (impl *WorkflowEventProcessorImpl) SubscribeTriggerBulkAction() error { artifact, err := impl.ciArtifactRepository.Get(cdWorkflow.CiArtifactId) if err != nil { impl.logger.Errorw("error in fetching artefact", "err", err) - wf.WorkflowStatus = pipelineConfig.TRIGGER_ERROR + wf.WorkflowStatus = cdWorkflowModelBean.TRIGGER_ERROR err = impl.cdWorkflowService.UpdateWorkFlow(wf) if err != nil { impl.logger.Errorw("error in updating wf", "err", err, "req", wf) @@ -295,9 +296,9 @@ func (impl *WorkflowEventProcessorImpl) SubscribeTriggerBulkAction() error { err = impl.cdTriggerService.TriggerStageForBulk(triggerRequest) if err != nil { impl.logger.Errorw("error in cd trigger ", "err", err) - wf.WorkflowStatus = pipelineConfig.TRIGGER_ERROR + wf.WorkflowStatus = cdWorkflowModelBean.TRIGGER_ERROR } else { - wf.WorkflowStatus = pipelineConfig.WF_STARTED + wf.WorkflowStatus = cdWorkflowModelBean.WF_STARTED } err = impl.cdWorkflowService.UpdateWorkFlow(wf) if err != nil { @@ -955,7 +956,7 @@ func (impl *WorkflowEventProcessorImpl) validateConcurrentOrInvalidRequest(ctx c } // request in process but for other wfrId // skip if the cdWfr.Status is already in a terminal state - skipCDWfrStatusList := append(pipelineConfig.WfrTerminalStatusList, pipelineConfig.WorkflowInProgress) + skipCDWfrStatusList := append(cdWorkflowModelBean.WfrTerminalStatusList, cdWorkflowModelBean.WorkflowInProgress) if slices.Contains(skipCDWfrStatusList, cdWfr.Status) { impl.logger.Warnw("skipped deployment as the workflow runner status is already in terminal state, validateConcurrentOrInvalidRequest", "cdWfrId", cdWfr.Id, "status", cdWfr.Status) return isValidRequest, nil @@ -976,7 +977,7 @@ func (impl *WorkflowEventProcessorImpl) validateConcurrentOrInvalidRequest(ctx c } if !isLatestRequest { impl.logger.Warnw("skipped deployment as the workflow runner is not the latest one", "cdWfrId", cdWfr.Id) - err := impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(cdWfr, pipelineConfig.ErrorDeploymentSuperseded, userId) + err := impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(cdWfr, cdWorkflowModelBean.ErrorDeploymentSuperseded, userId) if err != nil { impl.logger.Errorw("error while updating current runner status to failed, validateConcurrentOrInvalidRequest", "cdWfr", cdWfr.Id, "err", err) return isValidRequest, err @@ -992,7 +993,7 @@ func (impl *WorkflowEventProcessorImpl) UpdateReleaseContextForPipeline(ctx cont if releaseContext, ok := impl.devtronAppReleaseContextMap[pipelineId]; ok { impl.logger.Infow("new deployment has been triggered with a running deployment in progress!", "aborting deployment for pipelineId", pipelineId) // abort previous running release - releaseContext.CancelContext(pipelineConfig.ErrorDeploymentSuperseded) + releaseContext.CancelContext(cdWorkflowModelBean.ErrorDeploymentSuperseded) // cancelling parent context releaseContext.CancelParentContext() } @@ -1053,7 +1054,7 @@ func (impl *WorkflowEventProcessorImpl) RemoveReleaseContextForPipeline(pipeline impl.logger.Errorw("error while updating current runner status to failed, RemoveReleaseContextForPipeline", "cdWfr", cdWfr.Id, "err", err) } // cancelling child context. setting cancel cause -> pipeline deleted - releaseContext.CancelContext(errors.New(pipelineConfig.PIPELINE_DELETED)) + releaseContext.CancelContext(errors.New(cdWorkflowModelBean.PIPELINE_DELETED)) // cancelling parent context releaseContext.CancelParentContext() delete(impl.devtronAppReleaseContextMap, pipelineId) diff --git a/pkg/eventProcessor/out/WorkflowEventPublishService.go b/pkg/eventProcessor/out/WorkflowEventPublishService.go index 7312a7e61c..d68fab3a5c 100644 --- a/pkg/eventProcessor/out/WorkflowEventPublishService.go +++ b/pkg/eventProcessor/out/WorkflowEventPublishService.go @@ -23,6 +23,7 @@ import ( apiBean "github.com/devtron-labs/devtron/api/bean" "github.com/devtron-labs/devtron/internal/sql/repository" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" internalUtil "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/app" "github.com/devtron-labs/devtron/pkg/app/status" @@ -138,7 +139,7 @@ func (impl *WorkflowEventPublishServiceImpl) TriggerAsyncRelease(userDeploymentR } //update workflow runner status, used in app workflow view - err = impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, pipelineConfig.WorkflowInQueue) + err = impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, cdWorkflow.WorkflowInQueue) if err != nil { impl.logger.Errorw("error in updating the workflow runner status, TriggerAsyncRelease", "err", err) return 0, err @@ -158,7 +159,7 @@ func (impl *WorkflowEventPublishServiceImpl) TriggerBulkDeploymentAsync(requests CiArtifactId: request.CiArtifactId, PipelineId: request.PipelineId, AuditLog: sql.AuditLog{CreatedOn: time.Now(), CreatedBy: UserId, UpdatedOn: time.Now(), UpdatedBy: UserId}, - WorkflowStatus: pipelineConfig.REQUEST_ACCEPTED, + WorkflowStatus: cdWorkflow.REQUEST_ACCEPTED, } cdWorkflows = append(cdWorkflows, cdWf) } @@ -175,13 +176,13 @@ func (impl *WorkflowEventPublishServiceImpl) triggerNatsEventForBulkAction(cdWor for _, wf := range cdWorkflows { data, err := json.Marshal(wf) if err != nil { - wf.WorkflowStatus = pipelineConfig.QUE_ERROR + wf.WorkflowStatus = cdWorkflow.QUE_ERROR } else { err = impl.pubSubClient.Publish(pubsub.BULK_DEPLOY_TOPIC, string(data)) if err != nil { - wf.WorkflowStatus = pipelineConfig.QUE_ERROR + wf.WorkflowStatus = cdWorkflow.QUE_ERROR } else { - wf.WorkflowStatus = pipelineConfig.ENQUEUED + wf.WorkflowStatus = cdWorkflow.ENQUEUED } } err = impl.cdWorkflowRepository.UpdateWorkFlow(wf) diff --git a/pkg/pipeline/AppDeploymentTypeChangeManager.go b/pkg/pipeline/AppDeploymentTypeChangeManager.go index 714bc8720f..02e4bb24b9 100644 --- a/pkg/pipeline/AppDeploymentTypeChangeManager.go +++ b/pkg/pipeline/AppDeploymentTypeChangeManager.go @@ -27,6 +27,7 @@ import ( "github.com/devtron-labs/devtron/internal/sql/repository/app" "github.com/devtron-labs/devtron/internal/sql/repository/appStatus" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/util" app2 "github.com/devtron-labs/devtron/pkg/app" "github.com/devtron-labs/devtron/pkg/bean" @@ -500,7 +501,7 @@ func (impl *AppDeploymentTypeChangeManagerImpl) DeleteDeploymentApps(ctx context if chartServiceErr == nil { if gitOps.IsGitOpsRepoNotConfigured(chart.GitRepoUrl) { if gitOpsConfigurationStatus.AllowCustomRepository || chart.IsCustomGitRepository { - gitOpsRepoNotFound = fmt.Errorf(pipelineConfig.GITOPS_REPO_NOT_CONFIGURED) + gitOpsRepoNotFound = fmt.Errorf(cdWorkflow.GITOPS_REPO_NOT_CONFIGURED) } else { _, chartGitAttr, createGitRepoErr = impl.appService.CreateGitOpsRepo(&app.App{Id: pipeline.AppId, AppName: pipeline.App.AppName}, userId) if createGitRepoErr == nil { diff --git a/pkg/pipeline/CdHandler.go b/pkg/pipeline/CdHandler.go index 72da885a3d..d0efef7adc 100644 --- a/pkg/pipeline/CdHandler.go +++ b/pkg/pipeline/CdHandler.go @@ -568,7 +568,7 @@ func (impl *CdHandlerImpl) FetchCdWorkflowDetails(appId int, environmentId int, } workflow := impl.converterWFR(*workflowR) - triggeredByUserEmailId, err := impl.userService.GetEmailById(workflow.TriggeredBy) + triggeredByUserEmailId, err := impl.userService.GetActiveEmailById(workflow.TriggeredBy) if err != nil && !util.IsErrNoRows(err) { impl.Logger.Errorw("err", "err", err) return types.WorkflowResponse{}, err diff --git a/pkg/pipeline/CiHandler.go b/pkg/pipeline/CiHandler.go index 722de6abb1..30ea55aa13 100644 --- a/pkg/pipeline/CiHandler.go +++ b/pkg/pipeline/CiHandler.go @@ -21,6 +21,7 @@ import ( "context" "errors" "fmt" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "io/ioutil" "net/http" "os" @@ -616,7 +617,7 @@ func (impl *CiHandlerImpl) CancelBuild(workflowId int, forceAbort bool) (int, er } workflow.Status = executors.WorkflowCancel - if workflow.ExecutorType == pipelineConfig.WORKFLOW_EXECUTOR_TYPE_SYSTEM { + if workflow.ExecutorType == cdWorkflow.WORKFLOW_EXECUTOR_TYPE_SYSTEM { workflow.PodStatus = "Failed" workflow.Message = TERMINATE_MESSAGE } @@ -678,7 +679,7 @@ func (impl *CiHandlerImpl) FetchWorkflowDetails(appId int, pipelineId int, build impl.Logger.Errorw("err", "err", err) return types.WorkflowResponse{}, err } - triggeredByUserEmailId, err := impl.userService.GetEmailById(workflow.TriggeredBy) + triggeredByUserEmailId, err := impl.userService.GetActiveEmailById(workflow.TriggeredBy) if err != nil && !util.IsErrNoRows(err) { impl.Logger.Errorw("err", "err", err) return types.WorkflowResponse{}, err @@ -1162,7 +1163,7 @@ func (impl *CiHandlerImpl) UpdateWorkflow(workflowStatus v1alpha1.WorkflowStatus if len(message) > 250 { savedWorkflow.Message = message[:250] } - if savedWorkflow.ExecutorType == pipelineConfig.WORKFLOW_EXECUTOR_TYPE_SYSTEM && savedWorkflow.Status == executors.WorkflowCancel { + if savedWorkflow.ExecutorType == cdWorkflow.WORKFLOW_EXECUTOR_TYPE_SYSTEM && savedWorkflow.Status == executors.WorkflowCancel { savedWorkflow.PodStatus = "Failed" savedWorkflow.Message = TERMINATE_MESSAGE } @@ -1504,7 +1505,7 @@ func (impl *CiHandlerImpl) FetchMaterialInfoByArtifactId(ciArtifactId int, envId } } - triggeredByUserEmailId, err = impl.userService.GetEmailById(workflow.TriggeredBy) + triggeredByUserEmailId, err = impl.userService.GetActiveEmailById(workflow.TriggeredBy) if err != nil && !util.IsErrNoRows(err) { impl.Logger.Errorw("err", "err", err) return &types.GitTriggerInfoResponse{}, err @@ -1643,7 +1644,7 @@ func (impl *CiHandlerImpl) UpdateCiWorkflowStatusFailure(timeoutForFailureCiBuil // skip this and process for next ci workflow } } - if ciWorkflow.ExecutorType == pipelineConfig.WORKFLOW_EXECUTOR_TYPE_SYSTEM { + if ciWorkflow.ExecutorType == cdWorkflow.WORKFLOW_EXECUTOR_TYPE_SYSTEM { if wf.Status == string(v1alpha1.WorkflowFailed) { isPodDeleted = true } diff --git a/pkg/pipeline/CiService.go b/pkg/pipeline/CiService.go index 174e3cbb89..b92993a915 100644 --- a/pkg/pipeline/CiService.go +++ b/pkg/pipeline/CiService.go @@ -23,6 +23,7 @@ import ( "github.com/caarlos0/env" "github.com/devtron-labs/common-lib/utils" bean3 "github.com/devtron-labs/common-lib/utils/bean" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/infraConfig" "github.com/devtron-labs/devtron/pkg/pipeline/adapter" "github.com/devtron-labs/devtron/pkg/pipeline/bean/CiPipeline" @@ -319,7 +320,7 @@ func (impl *CiServiceImpl) TriggerCiPipeline(trigger types.Trigger) (int, error) } err = impl.handleRuntimeParamsValidations(trigger, ciMaterials, workflowRequest) if err != nil { - savedCiWf.Status = pipelineConfig.WorkflowAborted + savedCiWf.Status = cdWorkflow.WorkflowAborted savedCiWf.Message = err.Error() err1 := impl.ciWorkflowRepository.UpdateWorkFlow(savedCiWf) if err1 != nil { @@ -448,7 +449,7 @@ func (impl *CiServiceImpl) saveNewWorkflow(pipeline *pipelineConfig.CiPipeline, ciWorkflow := &pipelineConfig.CiWorkflow{ Name: pipeline.Name + "-" + strconv.Itoa(pipeline.Id), - Status: pipelineConfig.WorkflowStarting, // starting CIStage + Status: cdWorkflow.WorkflowStarting, // starting CIStage Message: "", StartedOn: time.Now(), CiPipelineId: pipeline.Id, @@ -622,7 +623,7 @@ func (impl *CiServiceImpl) buildWfRequestForCiPipeline(pipeline *pipelineConfig. if pipeline.CiTemplate.DockerBuildOptions == "" { pipeline.CiTemplate.DockerBuildOptions = "{}" } - userEmailId, err := impl.userService.GetEmailById(trigger.TriggeredBy) + userEmailId, err := impl.userService.GetActiveEmailById(trigger.TriggeredBy) if err != nil { impl.Logger.Errorw("unable to find user email by id", "err", err, "id", trigger.TriggeredBy) return nil, err @@ -676,7 +677,7 @@ func (impl *CiServiceImpl) buildWfRequestForCiPipeline(pipeline *pipelineConfig. imagePathReservation, err := impl.customTagService.GenerateImagePath(pipelineConfigBean.EntityTypeCiPipelineId, strconv.Itoa(pipeline.Id), dockerRegistry.RegistryURL, dockerRepository) if err != nil { if errors.Is(err, pipelineConfigBean.ErrImagePathInUse) { - savedWf.Status = pipelineConfig.WorkflowFailed + savedWf.Status = cdWorkflow.WorkflowFailed savedWf.Message = pipelineConfigBean.ImageTagUnavailableMessage err1 := impl.ciWorkflowRepository.UpdateWorkFlow(savedWf) if err1 != nil { @@ -710,7 +711,7 @@ func (impl *CiServiceImpl) buildWfRequestForCiPipeline(pipeline *pipelineConfig. dockerRegistry.Id) if err != nil { impl.Logger.Errorw("error in getting env variables for copyContainerImage plugin") - savedWf.Status = pipelineConfig.WorkflowFailed + savedWf.Status = cdWorkflow.WorkflowFailed savedWf.Message = err.Error() err1 := impl.ciWorkflowRepository.UpdateWorkFlow(savedWf) if err1 != nil { diff --git a/pkg/pipeline/DeploymentPipelineConfigService.go b/pkg/pipeline/DeploymentPipelineConfigService.go index c6aebef5cb..9c004660e3 100644 --- a/pkg/pipeline/DeploymentPipelineConfigService.go +++ b/pkg/pipeline/DeploymentPipelineConfigService.go @@ -36,6 +36,7 @@ import ( "github.com/devtron-labs/devtron/internal/sql/repository/appWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/chartConfig" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/app" "github.com/devtron-labs/devtron/pkg/bean" @@ -430,8 +431,8 @@ func (impl *CdPipelineConfigServiceImpl) CreateCdPipelines(pipelineCreateRequest if gitOpsConfigurationStatus.AllowCustomRepository || AppDeploymentConfig.ConfigType == bean4.CUSTOM.String() { apiErr := &util.ApiError{ HttpStatusCode: http.StatusConflict, - UserMessage: pipelineConfig.GITOPS_REPO_NOT_CONFIGURED, - InternalMessage: pipelineConfig.GITOPS_REPO_NOT_CONFIGURED, + UserMessage: cdWorkflow.GITOPS_REPO_NOT_CONFIGURED, + InternalMessage: cdWorkflow.GITOPS_REPO_NOT_CONFIGURED, } return nil, apiErr } diff --git a/pkg/pipeline/WorkflowService.go b/pkg/pipeline/WorkflowService.go index 26b2935720..5c7b42a5e5 100644 --- a/pkg/pipeline/WorkflowService.go +++ b/pkg/pipeline/WorkflowService.go @@ -24,7 +24,7 @@ import ( "github.com/argoproj/argo-workflows/v3/workflow/util" "github.com/devtron-labs/common-lib/utils/k8s" "github.com/devtron-labs/devtron/api/bean" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/app" "github.com/devtron-labs/devtron/pkg/cluster/repository" "github.com/devtron-labs/devtron/pkg/infraConfig" @@ -46,11 +46,11 @@ import ( type WorkflowService interface { SubmitWorkflow(workflowRequest *types.WorkflowRequest) (*unstructured.UnstructuredList, error) // DeleteWorkflow(wfName string, namespace string) error - GetWorkflow(executorType pipelineConfig.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*unstructured.UnstructuredList, error) - GetWorkflowStatus(executorType pipelineConfig.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*types.WorkflowStatus, error) + GetWorkflow(executorType cdWorkflow.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*unstructured.UnstructuredList, error) + GetWorkflowStatus(executorType cdWorkflow.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*types.WorkflowStatus, error) // ListAllWorkflows(namespace string) (*v1alpha1.WorkflowList, error) // UpdateWorkflow(wf *v1alpha1.Workflow) (*v1alpha1.Workflow, error) - TerminateWorkflow(executorType pipelineConfig.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config, isExt bool, environment *repository.Environment) error + TerminateWorkflow(executorType cdWorkflow.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config, isExt bool, environment *repository.Environment) error } type WorkflowServiceImpl struct { @@ -317,16 +317,16 @@ func (impl *WorkflowServiceImpl) getAppLabelNodeSelector(workflowRequest *types. return nil } -func (impl *WorkflowServiceImpl) getWorkflowExecutor(executorType pipelineConfig.WorkflowExecutorType) executors.WorkflowExecutor { - if executorType == "" || executorType == pipelineConfig.WORKFLOW_EXECUTOR_TYPE_AWF { +func (impl *WorkflowServiceImpl) getWorkflowExecutor(executorType cdWorkflow.WorkflowExecutorType) executors.WorkflowExecutor { + if executorType == "" || executorType == cdWorkflow.WORKFLOW_EXECUTOR_TYPE_AWF { return impl.argoWorkflowExecutor - } else if executorType == pipelineConfig.WORKFLOW_EXECUTOR_TYPE_SYSTEM { + } else if executorType == cdWorkflow.WORKFLOW_EXECUTOR_TYPE_SYSTEM { return impl.systemWorkflowExecutor } impl.Logger.Warnw("workflow executor not found", "type", executorType) return nil } -func (impl *WorkflowServiceImpl) GetWorkflow(executorType pipelineConfig.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*unstructured.UnstructuredList, error) { +func (impl *WorkflowServiceImpl) GetWorkflow(executorType cdWorkflow.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*unstructured.UnstructuredList, error) { impl.Logger.Debug("getting wf", name) workflowExecutor := impl.getWorkflowExecutor(executorType) if workflowExecutor == nil { @@ -338,7 +338,7 @@ func (impl *WorkflowServiceImpl) GetWorkflow(executorType pipelineConfig.Workflo return workflowExecutor.GetWorkflow(name, namespace, restConfig) } -func (impl *WorkflowServiceImpl) GetWorkflowStatus(executorType pipelineConfig.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*types.WorkflowStatus, error) { +func (impl *WorkflowServiceImpl) GetWorkflowStatus(executorType cdWorkflow.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config) (*types.WorkflowStatus, error) { impl.Logger.Debug("getting wf", name) workflowExecutor := impl.getWorkflowExecutor(executorType) if workflowExecutor == nil { @@ -351,7 +351,7 @@ func (impl *WorkflowServiceImpl) GetWorkflowStatus(executorType pipelineConfig.W return wfStatus, err } -func (impl *WorkflowServiceImpl) TerminateWorkflow(executorType pipelineConfig.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config, isExt bool, environment *repository.Environment) error { +func (impl *WorkflowServiceImpl) TerminateWorkflow(executorType cdWorkflow.WorkflowExecutorType, name string, namespace string, restConfig *rest.Config, isExt bool, environment *repository.Environment) error { impl.Logger.Debugw("terminating wf", "name", name) var err error if executorType != "" { diff --git a/pkg/pipeline/WorkflowServiceIT_test.go b/pkg/pipeline/WorkflowServiceIT_test.go index e191ba0c3e..34523ceb55 100644 --- a/pkg/pipeline/WorkflowServiceIT_test.go +++ b/pkg/pipeline/WorkflowServiceIT_test.go @@ -24,6 +24,7 @@ import ( "github.com/devtron-labs/devtron/internal/sql/repository/appStatus" "github.com/devtron-labs/devtron/internal/sql/repository/chartConfig" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/app" chartRepoRepository "github.com/devtron-labs/devtron/pkg/chartRepo/repository" @@ -204,7 +205,7 @@ func TestWorkflowServiceImpl_SubmitWorkflow(t *testing.T) { ImageRetryCount: 0, ImageRetryInterval: 5, Type: bean2.CI_WORKFLOW_PIPELINE_TYPE, - WorkflowExecutor: pipelineConfig.WORKFLOW_EXECUTOR_TYPE_AWF, + WorkflowExecutor: cdWorkflow.WORKFLOW_EXECUTOR_TYPE_AWF, } data, _ := workflowServiceImpl.SubmitWorkflow(&workflowRequest) @@ -340,7 +341,7 @@ func TestWorkflowServiceImpl_SubmitWorkflow(t *testing.T) { ImageRetryCount: 0, ImageRetryInterval: 5, Type: bean2.CI_WORKFLOW_PIPELINE_TYPE, - WorkflowExecutor: pipelineConfig.WORKFLOW_EXECUTOR_TYPE_AWF, + WorkflowExecutor: cdWorkflow.WORKFLOW_EXECUTOR_TYPE_AWF, } data, _ := workflowServiceImpl.SubmitWorkflow(&workflowRequest) @@ -508,7 +509,7 @@ func TestWorkflowServiceImpl_SubmitWorkflow(t *testing.T) { ImageRetryCount: 0, ImageRetryInterval: 5, Type: bean2.JOB_WORKFLOW_PIPELINE_TYPE, - WorkflowExecutor: pipelineConfig.WORKFLOW_EXECUTOR_TYPE_AWF, + WorkflowExecutor: cdWorkflow.WORKFLOW_EXECUTOR_TYPE_AWF, } data, _ := workflowServiceImpl.SubmitWorkflow(&workflowRequest) @@ -737,7 +738,7 @@ func TestWorkflowServiceImpl_SubmitWorkflow(t *testing.T) { IsVirtualEnvironment: false, }, Type: bean2.JOB_WORKFLOW_PIPELINE_TYPE, - WorkflowExecutor: pipelineConfig.WORKFLOW_EXECUTOR_TYPE_AWF, + WorkflowExecutor: cdWorkflow.WORKFLOW_EXECUTOR_TYPE_AWF, } data, _ := workflowServiceImpl.SubmitWorkflow(&workflowRequest) diff --git a/pkg/pipeline/history/ConfigMapHistoryService.go b/pkg/pipeline/history/ConfigMapHistoryService.go index d624fbe5be..ad7a20ec9d 100644 --- a/pkg/pipeline/history/ConfigMapHistoryService.go +++ b/pkg/pipeline/history/ConfigMapHistoryService.go @@ -357,7 +357,7 @@ func (impl ConfigMapHistoryServiceImpl) GetDeploymentDetailsForDeployedCMCSHisto } var historiesDto []*ConfigMapAndSecretHistoryDto for _, history := range histories { - userEmailId, err := impl.userService.GetEmailById(history.DeployedBy) + userEmailId, err := impl.userService.GetActiveEmailById(history.DeployedBy) if err != nil { impl.logger.Errorw("unable to find user email by id", "err", err, "id", history.DeployedBy) return nil, err diff --git a/pkg/pipeline/history/DeploymentTemplateHistoryService.go b/pkg/pipeline/history/DeploymentTemplateHistoryService.go index 24f184581b..276a090500 100644 --- a/pkg/pipeline/history/DeploymentTemplateHistoryService.go +++ b/pkg/pipeline/history/DeploymentTemplateHistoryService.go @@ -267,7 +267,7 @@ func (impl DeploymentTemplateHistoryServiceImpl) GetDeploymentDetailsForDeployed var historiesDto []*DeploymentTemplateHistoryDto for _, history := range histories { if wfrIndex, ok := deploymentTimeStatusMap[history.DeployedOn]; ok { - userEmailId, err := impl.userService.GetEmailById(history.DeployedBy) + userEmailId, err := impl.userService.GetActiveEmailById(history.DeployedBy) if err != nil { impl.logger.Errorw("unable to find user email by id", "err", err, "id", history.DeployedBy) return nil, err diff --git a/pkg/pipeline/history/PipelineStrategyHistoryService.go b/pkg/pipeline/history/PipelineStrategyHistoryService.go index 9095e2610e..91378aca5f 100644 --- a/pkg/pipeline/history/PipelineStrategyHistoryService.go +++ b/pkg/pipeline/history/PipelineStrategyHistoryService.go @@ -121,7 +121,7 @@ func (impl PipelineStrategyHistoryServiceImpl) GetDeploymentDetailsForDeployedSt } var historiesDto []*PipelineStrategyHistoryDto for _, history := range histories { - emailId, err := impl.userService.GetEmailById(history.DeployedBy) + emailId, err := impl.userService.GetActiveEmailById(history.DeployedBy) if err != nil { impl.logger.Errorw("unable to find user email by id", "err", err, "userId", history.DeployedBy) return nil, err diff --git a/pkg/pipeline/types/CiCdConfig.go b/pkg/pipeline/types/CiCdConfig.go index df0f6ebaa5..1257ccd1d3 100644 --- a/pkg/pipeline/types/CiCdConfig.go +++ b/pkg/pipeline/types/CiCdConfig.go @@ -24,6 +24,7 @@ import ( "github.com/caarlos0/env" blob_storage "github.com/devtron-labs/common-lib/blob-storage" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/pipeline/bean" v12 "k8s.io/api/core/v1" "k8s.io/client-go/rest" @@ -39,79 +40,79 @@ import ( type CiCdConfig struct { // from ciConfig - DefaultCacheBucket string `env:"DEFAULT_CACHE_BUCKET" envDefault:"ci-caching"` - DefaultCacheBucketRegion string `env:"DEFAULT_CACHE_BUCKET_REGION" envDefault:"us-east-2"` - CiLogsKeyPrefix string `env:"CI_LOGS_KEY_PREFIX" envDxefault:"my-artifacts"` - CiDefaultImage string `env:"DEFAULT_CI_IMAGE" envDefault:"686244538589.dkr.ecr.us-east-2.amazonaws.com/cirunner:47"` - CiDefaultNamespace string `env:"DEFAULT_NAMESPACE" envDefault:"devtron-ci"` - CiDefaultBuildLogsBucket string `env:"DEFAULT_BUILD_LOGS_BUCKET" envDefault:"devtron-pro-ci-logs"` - CiDefaultCdLogsBucketRegion string `env:"DEFAULT_CD_LOGS_BUCKET_REGION" envDefault:"us-east-2"` - CiTaintKey string `env:"CI_NODE_TAINTS_KEY" envDefault:""` - CiTaintValue string `env:"CI_NODE_TAINTS_VALUE" envDefault:""` - CiNodeLabelSelector []string `env:"CI_NODE_LABEL_SELECTOR"` - CacheLimit int64 `env:"CACHE_LIMIT" envDefault:"5000000000"` // TODO: Add to default db config also - CiDefaultBuildLogsKeyPrefix string `env:"DEFAULT_BUILD_LOGS_KEY_PREFIX" envDefault:"arsenal-v1"` - CiDefaultArtifactKeyPrefix string `env:"DEFAULT_ARTIFACT_KEY_LOCATION" envDefault:"arsenal-v1/ci-artifacts"` - CiWorkflowServiceAccount string `env:"WORKFLOW_SERVICE_ACCOUNT" envDefault:"ci-runner"` - ExternalCiApiSecret string `env:"EXTERNAL_CI_API_SECRET" envDefault:"devtroncd-secret"` - ExternalCiWebhookUrl string `env:"EXTERNAL_CI_WEB_HOOK_URL" envDefault:""` - ExternalCiPayload string `env:"EXTERNAL_CI_PAYLOAD" envDefault:"{\"ciProjectDetails\":[{\"gitRepository\":\"https://github.com/vikram1601/getting-started-nodejs.git\",\"checkoutPath\":\"./abc\",\"commitHash\":\"239077135f8cdeeccb7857e2851348f558cb53d3\",\"commitTime\":\"2022-10-30T20:00:00\",\"branch\":\"master\",\"message\":\"Update README.md\",\"author\":\"User Name \"}],\"dockerImage\":\"445808685819.dkr.ecr.us-east-2.amazonaws.com/orch:23907713-2\"}"` - CiArtifactLocationFormat string `env:"CI_ARTIFACT_LOCATION_FORMAT" envDefault:"%d/%d.zip"` - ImageScannerEndpoint string `env:"IMAGE_SCANNER_ENDPOINT" envDefault:"http://image-scanner-new-demo-devtroncd-service.devtroncd:80"` - CiDefaultAddressPoolBaseCidr string `env:"CI_DEFAULT_ADDRESS_POOL_BASE_CIDR"` - CiDefaultAddressPoolSize int `env:"CI_DEFAULT_ADDRESS_POOL_SIZE"` - CiRunnerDockerMTUValue int `env:"CI_RUNNER_DOCKER_MTU_VALUE" envDefault:"-1"` - IgnoreDockerCacheForCI bool `env:"CI_IGNORE_DOCKER_CACHE"` - VolumeMountsForCiJson string `env:"CI_VOLUME_MOUNTS_JSON"` - BuildPvcCachePath string `env:"PRE_CI_CACHE_PATH" envDefault:"/devtroncd-cache"` - DefaultPvcCachePath string `env:"DOCKER_BUILD_CACHE_PATH" envDefault:"/var/lib/docker"` - BuildxPvcCachePath string `env:"BUILDX_CACHE_PATH" envDefault:"/var/lib/devtron/buildx"` - UseBlobStorageConfigInCiWorkflow bool `env:"USE_BLOB_STORAGE_CONFIG_IN_CI_WORKFLOW" envDefault:"true"` - DefaultTargetPlatform string `env:"DEFAULT_TARGET_PLATFORM" envDefault:""` - UseBuildx bool `env:"USE_BUILDX" envDefault:"false"` - EnableBuildContext bool `env:"ENABLE_BUILD_CONTEXT" envDefault:"false"` - ImageRetryCount int `env:"IMAGE_RETRY_COUNT" envDefault:"0"` - ImageRetryInterval int `env:"IMAGE_RETRY_INTERVAL" envDefault:"5"` // image retry interval takes value in seconds - CiWorkflowExecutorType pipelineConfig.WorkflowExecutorType `env:"CI_WORKFLOW_EXECUTOR_TYPE" envDefault:"AWF"` - BuildxK8sDriverOptions string `env:"BUILDX_K8S_DRIVER_OPTIONS" envDefault:""` - CIAutoTriggerBatchSize int `env:"CI_SUCCESS_AUTO_TRIGGER_BATCH_SIZE" envDefault:"1"` - SkipCreatingEcrRepo bool `env:"SKIP_CREATING_ECR_REPO" envDefault:"false"` - MaxCiWorkflowRetries int `env:"MAX_CI_WORKFLOW_RETRIES" envDefault:"0"` - NatsServerHost string `env:"NATS_SERVER_HOST" envDefault:"nats://devtron-nats.devtroncd:4222"` - ImageScanMaxRetries int `env:"IMAGE_SCAN_MAX_RETRIES" envDefault:"3"` - ImageScanRetryDelay int `env:"IMAGE_SCAN_RETRY_DELAY" envDefault:"5"` - ShowDockerBuildCmdInLogs bool `env:"SHOW_DOCKER_BUILD_ARGS" envDefault:"true"` - IgnoreCmCsInCiJob bool `env:"IGNORE_CM_CS_IN_CI_JOB" envDefault:"false"` - SkipCiJobBuildCachePushPull bool `env:"SKIP_CI_JOB_BUILD_CACHE_PUSH_PULL" envDefault:"false"` + DefaultCacheBucket string `env:"DEFAULT_CACHE_BUCKET" envDefault:"ci-caching"` + DefaultCacheBucketRegion string `env:"DEFAULT_CACHE_BUCKET_REGION" envDefault:"us-east-2"` + CiLogsKeyPrefix string `env:"CI_LOGS_KEY_PREFIX" envDxefault:"my-artifacts"` + CiDefaultImage string `env:"DEFAULT_CI_IMAGE" envDefault:"686244538589.dkr.ecr.us-east-2.amazonaws.com/cirunner:47"` + CiDefaultNamespace string `env:"DEFAULT_NAMESPACE" envDefault:"devtron-ci"` + CiDefaultBuildLogsBucket string `env:"DEFAULT_BUILD_LOGS_BUCKET" envDefault:"devtron-pro-ci-logs"` + CiDefaultCdLogsBucketRegion string `env:"DEFAULT_CD_LOGS_BUCKET_REGION" envDefault:"us-east-2"` + CiTaintKey string `env:"CI_NODE_TAINTS_KEY" envDefault:""` + CiTaintValue string `env:"CI_NODE_TAINTS_VALUE" envDefault:""` + CiNodeLabelSelector []string `env:"CI_NODE_LABEL_SELECTOR"` + CacheLimit int64 `env:"CACHE_LIMIT" envDefault:"5000000000"` // TODO: Add to default db config also + CiDefaultBuildLogsKeyPrefix string `env:"DEFAULT_BUILD_LOGS_KEY_PREFIX" envDefault:"arsenal-v1"` + CiDefaultArtifactKeyPrefix string `env:"DEFAULT_ARTIFACT_KEY_LOCATION" envDefault:"arsenal-v1/ci-artifacts"` + CiWorkflowServiceAccount string `env:"WORKFLOW_SERVICE_ACCOUNT" envDefault:"ci-runner"` + ExternalCiApiSecret string `env:"EXTERNAL_CI_API_SECRET" envDefault:"devtroncd-secret"` + ExternalCiWebhookUrl string `env:"EXTERNAL_CI_WEB_HOOK_URL" envDefault:""` + ExternalCiPayload string `env:"EXTERNAL_CI_PAYLOAD" envDefault:"{\"ciProjectDetails\":[{\"gitRepository\":\"https://github.com/vikram1601/getting-started-nodejs.git\",\"checkoutPath\":\"./abc\",\"commitHash\":\"239077135f8cdeeccb7857e2851348f558cb53d3\",\"commitTime\":\"2022-10-30T20:00:00\",\"branch\":\"master\",\"message\":\"Update README.md\",\"author\":\"User Name \"}],\"dockerImage\":\"445808685819.dkr.ecr.us-east-2.amazonaws.com/orch:23907713-2\"}"` + CiArtifactLocationFormat string `env:"CI_ARTIFACT_LOCATION_FORMAT" envDefault:"%d/%d.zip"` + ImageScannerEndpoint string `env:"IMAGE_SCANNER_ENDPOINT" envDefault:"http://image-scanner-new-demo-devtroncd-service.devtroncd:80"` + CiDefaultAddressPoolBaseCidr string `env:"CI_DEFAULT_ADDRESS_POOL_BASE_CIDR"` + CiDefaultAddressPoolSize int `env:"CI_DEFAULT_ADDRESS_POOL_SIZE"` + CiRunnerDockerMTUValue int `env:"CI_RUNNER_DOCKER_MTU_VALUE" envDefault:"-1"` + IgnoreDockerCacheForCI bool `env:"CI_IGNORE_DOCKER_CACHE"` + VolumeMountsForCiJson string `env:"CI_VOLUME_MOUNTS_JSON"` + BuildPvcCachePath string `env:"PRE_CI_CACHE_PATH" envDefault:"/devtroncd-cache"` + DefaultPvcCachePath string `env:"DOCKER_BUILD_CACHE_PATH" envDefault:"/var/lib/docker"` + BuildxPvcCachePath string `env:"BUILDX_CACHE_PATH" envDefault:"/var/lib/devtron/buildx"` + UseBlobStorageConfigInCiWorkflow bool `env:"USE_BLOB_STORAGE_CONFIG_IN_CI_WORKFLOW" envDefault:"true"` + DefaultTargetPlatform string `env:"DEFAULT_TARGET_PLATFORM" envDefault:""` + UseBuildx bool `env:"USE_BUILDX" envDefault:"false"` + EnableBuildContext bool `env:"ENABLE_BUILD_CONTEXT" envDefault:"false"` + ImageRetryCount int `env:"IMAGE_RETRY_COUNT" envDefault:"0"` + ImageRetryInterval int `env:"IMAGE_RETRY_INTERVAL" envDefault:"5"` // image retry interval takes value in seconds + CiWorkflowExecutorType cdWorkflow.WorkflowExecutorType `env:"CI_WORKFLOW_EXECUTOR_TYPE" envDefault:"AWF"` + BuildxK8sDriverOptions string `env:"BUILDX_K8S_DRIVER_OPTIONS" envDefault:""` + CIAutoTriggerBatchSize int `env:"CI_SUCCESS_AUTO_TRIGGER_BATCH_SIZE" envDefault:"1"` + SkipCreatingEcrRepo bool `env:"SKIP_CREATING_ECR_REPO" envDefault:"false"` + MaxCiWorkflowRetries int `env:"MAX_CI_WORKFLOW_RETRIES" envDefault:"0"` + NatsServerHost string `env:"NATS_SERVER_HOST" envDefault:"nats://devtron-nats.devtroncd:4222"` + ImageScanMaxRetries int `env:"IMAGE_SCAN_MAX_RETRIES" envDefault:"3"` + ImageScanRetryDelay int `env:"IMAGE_SCAN_RETRY_DELAY" envDefault:"5"` + ShowDockerBuildCmdInLogs bool `env:"SHOW_DOCKER_BUILD_ARGS" envDefault:"true"` + IgnoreCmCsInCiJob bool `env:"IGNORE_CM_CS_IN_CI_JOB" envDefault:"false"` + SkipCiJobBuildCachePushPull bool `env:"SKIP_CI_JOB_BUILD_CACHE_PUSH_PULL" envDefault:"false"` // from CdConfig - CdLimitCpu string `env:"CD_LIMIT_CI_CPU" envDefault:"0.5"` - CdLimitMem string `env:"CD_LIMIT_CI_MEM" envDefault:"3G"` - CdReqCpu string `env:"CD_REQ_CI_CPU" envDefault:"0.5"` - CdReqMem string `env:"CD_REQ_CI_MEM" envDefault:"3G"` - CdTaintKey string `env:"CD_NODE_TAINTS_KEY" envDefault:"dedicated"` - ExternalCdTaintKey string `env:"EXTERNAL_CD_NODE_TAINTS_KEY" envDefault:"dedicated"` - UseExternalNode bool `env:"USE_EXTERNAL_NODE" envDefault:"false"` - CdWorkflowServiceAccount string `env:"CD_WORKFLOW_SERVICE_ACCOUNT" envDefault:"cd-runner"` - CdDefaultBuildLogsKeyPrefix string `env:"DEFAULT_BUILD_LOGS_KEY_PREFIX" ` - CdDefaultArtifactKeyPrefix string `env:"DEFAULT_CD_ARTIFACT_KEY_LOCATION" ` - CdTaintValue string `env:"CD_NODE_TAINTS_VALUE" envDefault:"ci"` - ExternalCdTaintValue string `env:"EXTERNAL_CD_NODE_TAINTS_VALUE" envDefault:"ci"` - CdDefaultBuildLogsBucket string `env:"DEFAULT_BUILD_LOGS_BUCKET" ` - CdNodeLabelSelector []string `env:"CD_NODE_LABEL_SELECTOR"` - ExternalCdNodeLabelSelector []string `env:"EXTERNAL_CD_NODE_LABEL_SELECTOR"` - CdArtifactLocationFormat string `env:"CD_ARTIFACT_LOCATION_FORMAT" envDefault:"%d/%d.zip"` - CdDefaultNamespace string `env:"DEFAULT_CD_NAMESPACE"` - CdDefaultImage string `env:"DEFAULT_CI_IMAGE"` - CdDefaultTimeout int64 `env:"DEFAULT_CD_TIMEOUT" envDefault:"3600"` - CdDefaultCdLogsBucketRegion string `env:"DEFAULT_CD_LOGS_BUCKET_REGION" ` - WfControllerInstanceID string `env:"WF_CONTROLLER_INSTANCE_ID" envDefault:"devtron-runner"` - CdDefaultAddressPoolBaseCidr string `env:"CD_DEFAULT_ADDRESS_POOL_BASE_CIDR"` - CdDefaultAddressPoolSize int `env:"CD_DEFAULT_ADDRESS_POOL_SIZE"` - ExposeCDMetrics bool `env:"EXPOSE_CD_METRICS" envDefault:"false"` - UseBlobStorageConfigInCdWorkflow bool `env:"USE_BLOB_STORAGE_CONFIG_IN_CD_WORKFLOW" envDefault:"true"` - CdWorkflowExecutorType pipelineConfig.WorkflowExecutorType `env:"CD_WORKFLOW_EXECUTOR_TYPE" envDefault:"AWF"` - TerminationGracePeriod int `env:"TERMINATION_GRACE_PERIOD_SECS" envDefault:"180"` - MaxCdWorkflowRunnerRetries int `env:"MAX_CD_WORKFLOW_RUNNER_RETRIES" envDefault:"0"` + CdLimitCpu string `env:"CD_LIMIT_CI_CPU" envDefault:"0.5"` + CdLimitMem string `env:"CD_LIMIT_CI_MEM" envDefault:"3G"` + CdReqCpu string `env:"CD_REQ_CI_CPU" envDefault:"0.5"` + CdReqMem string `env:"CD_REQ_CI_MEM" envDefault:"3G"` + CdTaintKey string `env:"CD_NODE_TAINTS_KEY" envDefault:"dedicated"` + ExternalCdTaintKey string `env:"EXTERNAL_CD_NODE_TAINTS_KEY" envDefault:"dedicated"` + UseExternalNode bool `env:"USE_EXTERNAL_NODE" envDefault:"false"` + CdWorkflowServiceAccount string `env:"CD_WORKFLOW_SERVICE_ACCOUNT" envDefault:"cd-runner"` + CdDefaultBuildLogsKeyPrefix string `env:"DEFAULT_BUILD_LOGS_KEY_PREFIX" ` + CdDefaultArtifactKeyPrefix string `env:"DEFAULT_CD_ARTIFACT_KEY_LOCATION" ` + CdTaintValue string `env:"CD_NODE_TAINTS_VALUE" envDefault:"ci"` + ExternalCdTaintValue string `env:"EXTERNAL_CD_NODE_TAINTS_VALUE" envDefault:"ci"` + CdDefaultBuildLogsBucket string `env:"DEFAULT_BUILD_LOGS_BUCKET" ` + CdNodeLabelSelector []string `env:"CD_NODE_LABEL_SELECTOR"` + ExternalCdNodeLabelSelector []string `env:"EXTERNAL_CD_NODE_LABEL_SELECTOR"` + CdArtifactLocationFormat string `env:"CD_ARTIFACT_LOCATION_FORMAT" envDefault:"%d/%d.zip"` + CdDefaultNamespace string `env:"DEFAULT_CD_NAMESPACE"` + CdDefaultImage string `env:"DEFAULT_CI_IMAGE"` + CdDefaultTimeout int64 `env:"DEFAULT_CD_TIMEOUT" envDefault:"3600"` + CdDefaultCdLogsBucketRegion string `env:"DEFAULT_CD_LOGS_BUCKET_REGION" ` + WfControllerInstanceID string `env:"WF_CONTROLLER_INSTANCE_ID" envDefault:"devtron-runner"` + CdDefaultAddressPoolBaseCidr string `env:"CD_DEFAULT_ADDRESS_POOL_BASE_CIDR"` + CdDefaultAddressPoolSize int `env:"CD_DEFAULT_ADDRESS_POOL_SIZE"` + ExposeCDMetrics bool `env:"EXPOSE_CD_METRICS" envDefault:"false"` + UseBlobStorageConfigInCdWorkflow bool `env:"USE_BLOB_STORAGE_CONFIG_IN_CD_WORKFLOW" envDefault:"true"` + CdWorkflowExecutorType cdWorkflow.WorkflowExecutorType `env:"CD_WORKFLOW_EXECUTOR_TYPE" envDefault:"AWF"` + TerminationGracePeriod int `env:"TERMINATION_GRACE_PERIOD_SECS" envDefault:"180"` + MaxCdWorkflowRunnerRetries int `env:"MAX_CD_WORKFLOW_RUNNER_RETRIES" envDefault:"0"` // common in both ciconfig and cd config Type string @@ -417,7 +418,7 @@ func (impl *CiCdConfig) GetDefaultAddressPoolSize() int { } } -func (impl *CiCdConfig) GetWorkflowExecutorType() pipelineConfig.WorkflowExecutorType { +func (impl *CiCdConfig) GetWorkflowExecutorType() cdWorkflow.WorkflowExecutorType { switch impl.Type { case CiConfigType: return impl.CiWorkflowExecutorType diff --git a/pkg/pipeline/types/Workflow.go b/pkg/pipeline/types/Workflow.go index 8eed943ac0..ac8ca58d2e 100644 --- a/pkg/pipeline/types/Workflow.go +++ b/pkg/pipeline/types/Workflow.go @@ -26,6 +26,7 @@ import ( repository2 "github.com/devtron-labs/devtron/internal/sql/repository" repository3 "github.com/devtron-labs/devtron/internal/sql/repository/imageTagging" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" bean2 "github.com/devtron-labs/devtron/pkg/bean" "github.com/devtron-labs/devtron/pkg/cluster/repository" "github.com/devtron-labs/devtron/pkg/infraConfig" @@ -127,7 +128,7 @@ type WorkflowRequest struct { DeploymentTriggeredBy string `json:"deploymentTriggeredBy,omitempty"` DeploymentTriggerTime time.Time `json:"deploymentTriggerTime,omitempty"` DeploymentReleaseCounter int `json:"deploymentReleaseCounter,omitempty"` - WorkflowExecutor pipelineConfig.WorkflowExecutorType `json:"workflowExecutor"` + WorkflowExecutor cdWorkflow.WorkflowExecutorType `json:"workflowExecutor"` PrePostDeploySteps []*bean.StepObject `json:"prePostDeploySteps"` CiArtifactLastFetch time.Time `json:"ciArtifactLastFetch"` CiPipelineType string `json:"ciPipelineType"` @@ -313,7 +314,7 @@ func (workflowRequest *WorkflowRequest) getBlobStorageLogsPrefix() string { func (workflowRequest *WorkflowRequest) updateBlobStorageLogsKey(config *CiCdConfig) { workflowRequest.BlobStorageLogsKey = fmt.Sprintf("%s/%s", workflowRequest.getDefaultBuildLogsKeyPrefix(config), workflowRequest.getBlobStorageLogsPrefix()) - workflowRequest.InAppLoggingEnabled = config.InAppLoggingEnabled || (workflowRequest.WorkflowExecutor == pipelineConfig.WORKFLOW_EXECUTOR_TYPE_SYSTEM) + workflowRequest.InAppLoggingEnabled = config.InAppLoggingEnabled || (workflowRequest.WorkflowExecutor == cdWorkflow.WORKFLOW_EXECUTOR_TYPE_SYSTEM) } func (workflowRequest *WorkflowRequest) getWorkflowJson() ([]byte, error) { diff --git a/pkg/workflow/cd/CdWorkflowCommonService.go b/pkg/workflow/cd/CdWorkflowCommonService.go index 03c116348c..8733e5db57 100644 --- a/pkg/workflow/cd/CdWorkflowCommonService.go +++ b/pkg/workflow/cd/CdWorkflowCommonService.go @@ -25,6 +25,7 @@ import ( "github.com/devtron-labs/common-lib/utils/k8s/health" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/adapter/cdWorkflow" + cdWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" "github.com/devtron-labs/devtron/internal/util" "github.com/devtron-labs/devtron/pkg/app/status" @@ -94,7 +95,7 @@ func (impl *CdWorkflowCommonServiceImpl) SupersedePreviousDeployments(ctx contex defer tx.Rollback() //update [n,n-1] statuses as failed if not terminal - terminalStatus := []string{string(health.HealthStatusHealthy), pipelineConfig.WorkflowAborted, pipelineConfig.WorkflowFailed, pipelineConfig.WorkflowSucceeded} + terminalStatus := []string{string(health.HealthStatusHealthy), cdWorkflow2.WorkflowAborted, cdWorkflow2.WorkflowFailed, cdWorkflow2.WorkflowSucceeded} previousNonTerminalRunners, err := impl.cdWorkflowRepository.FindPreviousCdWfRunnerByStatus(pipelineId, cdWfrId, terminalStatus) if err != nil { impl.logger.Errorw("error fetching previous wf runner, updating cd wf runner status,", "err", err, "currentRunnerId", cdWfrId) @@ -107,17 +108,17 @@ func (impl *CdWorkflowCommonServiceImpl) SupersedePreviousDeployments(ctx contex var timelines []*pipelineConfig.PipelineStatusTimeline for _, previousRunner := range previousNonTerminalRunners { if previousRunner.Status == string(health.HealthStatusHealthy) || - previousRunner.Status == pipelineConfig.WorkflowSucceeded || - previousRunner.Status == pipelineConfig.WorkflowAborted || - previousRunner.Status == pipelineConfig.WorkflowFailed { + previousRunner.Status == cdWorkflow2.WorkflowSucceeded || + previousRunner.Status == cdWorkflow2.WorkflowAborted || + previousRunner.Status == cdWorkflow2.WorkflowFailed { //terminal status return impl.logger.Infow("skip updating cd wf runner status as previous runner status is", "status", previousRunner.Status) continue } impl.logger.Infow("updating cd wf runner status as previous runner status is", "status", previousRunner.Status) previousRunner.FinishedOn = triggeredAt - previousRunner.Message = pipelineConfig.ErrorDeploymentSuperseded.Error() - previousRunner.Status = pipelineConfig.WorkflowFailed + previousRunner.Message = cdWorkflow2.ErrorDeploymentSuperseded.Error() + previousRunner.Status = cdWorkflow2.WorkflowFailed previousRunner.UpdatedOn = time.Now() previousRunner.UpdatedBy = triggeredBy timeline := &pipelineConfig.PipelineStatusTimeline{ @@ -160,13 +161,13 @@ func (impl *CdWorkflowCommonServiceImpl) MarkDeploymentFailedForRunnerId(cdWfrId } func (impl *CdWorkflowCommonServiceImpl) MarkCurrentDeploymentFailed(runner *pipelineConfig.CdWorkflowRunner, releaseErr error, triggeredBy int32) error { - if slices.Contains(pipelineConfig.WfrTerminalStatusList, runner.Status) { + if slices.Contains(cdWorkflow2.WfrTerminalStatusList, runner.Status) { impl.logger.Infow("cd wf runner status is already in terminal state", "err", releaseErr, "currentRunner", runner) return nil } //update current WF with error status impl.logger.Errorw("error in triggering cd WF, setting wf status as fail ", "wfId", runner.Id, "err", releaseErr) - runner.Status = pipelineConfig.WorkflowFailed + runner.Status = cdWorkflow2.WorkflowFailed runner.Message = util.GetClientErrorDetailedMessage(releaseErr) runner.FinishedOn = time.Now() runner.UpdateAuditLog(triggeredBy) @@ -176,7 +177,7 @@ func (impl *CdWorkflowCommonServiceImpl) MarkCurrentDeploymentFailed(runner *pip return err1 } if runner.WorkflowType.IsStageTypeDeploy() { - if errors.Is(releaseErr, pipelineConfig.ErrorDeploymentSuperseded) { + if errors.Is(releaseErr, cdWorkflow2.ErrorDeploymentSuperseded) { err := impl.pipelineStatusTimelineService.MarkPipelineStatusTimelineSuperseded(runner.Id) if err != nil { impl.logger.Errorw("error updating CdPipelineStatusTimeline", "err", err, "releaseErr", releaseErr) @@ -205,7 +206,7 @@ func (impl *CdWorkflowCommonServiceImpl) UpdateNonTerminalStatusInRunner(ctx con _, span := otel.Tracer("orchestrator").Start(ctx, "CdWorkflowCommonServiceImpl.UpdateNonTerminalStatusInRunner") defer span.End() // In case of terminal status update finished on time - isTerminalStatus := slices.Contains(pipelineConfig.WfrTerminalStatusList, status) + isTerminalStatus := slices.Contains(cdWorkflow2.WfrTerminalStatusList, status) if isTerminalStatus { return fmt.Errorf("unsupported status %s for update operation", status) } @@ -216,7 +217,7 @@ func (impl *CdWorkflowCommonServiceImpl) UpdateNonTerminalStatusInRunner(ctx con } // if the current cdWfr status is already a terminal status and then don't update the status // e.g: Status : Failed --> Progressing (not allowed) - if slices.Contains(pipelineConfig.WfrTerminalStatusList, cdWfr.Status) { + if slices.Contains(cdWorkflow2.WfrTerminalStatusList, cdWfr.Status) { impl.logger.Warnw("deployment has already been terminated for workflow runner, UpdateNonTerminalStatusInRunner", "workflowRunnerId", cdWfr.Id, "err", err) return nil } @@ -264,7 +265,7 @@ func (impl *CdWorkflowCommonServiceImpl) UpdatePreviousQueuedRunnerStatus(cdWfrI globalUtil.TriggerCDMetrics(cdWorkflow.GetTriggerMetricsFromRunnerObj(queuedRunner, envDeploymentConfig), impl.config.ExposeCDMetrics) queuedRunnerIds = append(queuedRunnerIds, queuedRunner.Id) } - err = impl.cdWorkflowRepository.UpdateRunnerStatusToFailedForIds(pipelineConfig.ErrorDeploymentSuperseded.Error(), triggeredBy, queuedRunnerIds...) + err = impl.cdWorkflowRepository.UpdateRunnerStatusToFailedForIds(cdWorkflow2.ErrorDeploymentSuperseded.Error(), triggeredBy, queuedRunnerIds...) if err != nil { impl.logger.Errorw("error on update previous queued cd workflow runner, UpdatePreviousQueuedRunnerStatus", "cdWfrId", cdWfrId, "err", err) return err @@ -275,7 +276,7 @@ func (impl *CdWorkflowCommonServiceImpl) UpdatePreviousQueuedRunnerStatus(cdWfrI func extractTimelineFailedStatusDetails(err error) string { errorString := util.GetClientErrorDetailedMessage(err) switch errorString { - case pipelineConfig.FOUND_VULNERABILITY: + case cdWorkflow2.FOUND_VULNERABILITY: return timelineStatus.TIMELINE_DESCRIPTION_VULNERABLE_IMAGE default: return util.GetTruncatedMessage(fmt.Sprintf("Deployment failed: %s", errorString), 255) diff --git a/pkg/workflow/cd/bean/bean.go b/pkg/workflow/cd/bean/bean.go index 1c94c369ae..cb18dc397c 100644 --- a/pkg/workflow/cd/bean/bean.go +++ b/pkg/workflow/cd/bean/bean.go @@ -18,16 +18,16 @@ package bean import ( "github.com/devtron-labs/devtron/api/bean" - "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" + "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "time" ) type CdWorkflowDto struct { - Id int `json:"id"` - CiArtifactId int `json:"ciArtifactId"` - PipelineId int `json:"pipelineId"` - WorkflowStatus pipelineConfig.WorkflowStatus `json:"workflowStatus"` - UserId int32 `json:"-"` + Id int `json:"id"` + CiArtifactId int `json:"ciArtifactId"` + PipelineId int `json:"pipelineId"` + WorkflowStatus cdWorkflow.WorkflowStatus `json:"workflowStatus"` + UserId int32 `json:"-"` } type CdWorkflowRunnerDto struct { @@ -35,19 +35,19 @@ type CdWorkflowRunnerDto struct { Name string `json:"name"` WorkflowType bean.WorkflowType `json:"workflowType"` // pre,post,deploy //TODO: extract from repo service layer - ExecutorType pipelineConfig.WorkflowExecutorType `json:"executorType"` // awf, system - Status string `json:"status"` - PodStatus string `json:"podStatus"` - Message string `json:"message"` - StartedOn time.Time `json:"startedOn"` - FinishedOn time.Time `json:"finishedOn"` - Namespace string `json:"namespace"` - LogLocation string `json:"logFilePath"` - TriggeredBy int32 `json:"triggeredBy"` - CdWorkflowId int `json:"cdWorkflowId"` - PodName string `json:"podName"` - BlobStorageEnabled bool `json:"blobStorageEnabled"` - RefCdWorkflowRunnerId int `json:"refCdWorkflowRunnerId"` - ImagePathReservationIds []int `json:"imagePathReservationIds"` - ReferenceId *string `json:"referenceId"` + ExecutorType cdWorkflow.WorkflowExecutorType `json:"executorType"` // awf, system + Status string `json:"status"` + PodStatus string `json:"podStatus"` + Message string `json:"message"` + StartedOn time.Time `json:"startedOn"` + FinishedOn time.Time `json:"finishedOn"` + Namespace string `json:"namespace"` + LogLocation string `json:"logFilePath"` + TriggeredBy int32 `json:"triggeredBy"` + CdWorkflowId int `json:"cdWorkflowId"` + PodName string `json:"podName"` + BlobStorageEnabled bool `json:"blobStorageEnabled"` + RefCdWorkflowRunnerId int `json:"refCdWorkflowRunnerId"` + ImagePathReservationIds []int `json:"imagePathReservationIds"` + ReferenceId *string `json:"referenceId"` } diff --git a/pkg/workflow/dag/WorkflowDagExecutor.go b/pkg/workflow/dag/WorkflowDagExecutor.go index 15a71c104b..096a3347c3 100644 --- a/pkg/workflow/dag/WorkflowDagExecutor.go +++ b/pkg/workflow/dag/WorkflowDagExecutor.go @@ -28,6 +28,7 @@ import ( argoApplication "github.com/devtron-labs/devtron/client/argocdServer/bean" client "github.com/devtron-labs/devtron/client/events" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/adapter/cdWorkflow" + cdWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/pkg/app/status" "github.com/devtron-labs/devtron/pkg/build/artifacts" common2 "github.com/devtron-labs/devtron/pkg/deployment/common" @@ -251,7 +252,7 @@ func (impl *WorkflowDagExecutorImpl) UpdateWorkflowRunnerStatusForDeployment(app return false } // If release not found, mark the deployment as failure - wfr.Status = pipelineConfig.WorkflowFailed + wfr.Status = cdWorkflow2.WorkflowFailed wfr.Message = fmt.Sprintf("helm client error: %s", util.GetClientErrorDetailedMessage(err)) wfr.FinishedOn = time.Now() return true @@ -260,13 +261,13 @@ func (impl *WorkflowDagExecutorImpl) UpdateWorkflowRunnerStatusForDeployment(app switch helmInstalledDevtronApp.GetReleaseStatus() { case serverBean.HelmReleaseStatusSuperseded: // If release status is superseded, mark the deployment as failure - wfr.Status = pipelineConfig.WorkflowFailed - wfr.Message = pipelineConfig.ErrorDeploymentSuperseded.Error() + wfr.Status = cdWorkflow2.WorkflowFailed + wfr.Message = cdWorkflow2.ErrorDeploymentSuperseded.Error() wfr.FinishedOn = time.Now() return true case serverBean.HelmReleaseStatusFailed: // If release status is failed, mark the deployment as failure - wfr.Status = pipelineConfig.WorkflowFailed + wfr.Status = cdWorkflow2.WorkflowFailed wfr.Message = helmInstalledDevtronApp.GetDescription() wfr.FinishedOn = time.Now() return true @@ -279,15 +280,15 @@ func (impl *WorkflowDagExecutorImpl) UpdateWorkflowRunnerStatusForDeployment(app if helmInstalledDevtronApp.GetApplicationStatus() == argoApplication.Healthy { // mark the deployment as succeed - wfr.Status = pipelineConfig.WorkflowSucceeded + wfr.Status = cdWorkflow2.WorkflowSucceeded wfr.FinishedOn = time.Now() return true } } - if wfr.Status == pipelineConfig.WorkflowInProgress { + if wfr.Status == cdWorkflow2.WorkflowInProgress { return false } - wfr.Status = pipelineConfig.WorkflowInProgress + wfr.Status = cdWorkflow2.WorkflowInProgress return true } @@ -316,7 +317,7 @@ func (impl *WorkflowDagExecutorImpl) handleAsyncTriggerReleaseError(ctx context. return } if util4.IsRunnerStatusFailed(cdWfr.Status) { - if cdWfr.Message == pipelineConfig.ErrorDeploymentSuperseded.Error() { + if cdWfr.Message == cdWorkflow2.ErrorDeploymentSuperseded.Error() { dbErr := impl.pipelineStatusTimelineService.MarkPipelineStatusTimelineSuperseded(cdWfr.Id) if dbErr != nil { impl.logger.Errorw("error updating CdPipelineStatusTimeline", "err", dbErr, "releaseErr", releaseErr) @@ -346,7 +347,7 @@ func (impl *WorkflowDagExecutorImpl) handleAsyncTriggerReleaseError(ctx context. } return } else if errors.Is(releaseErr, context.Canceled) || strings.Contains(releaseErr.Error(), context.Canceled.Error()) { - if err := impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(cdWfr, pipelineConfig.ErrorDeploymentSuperseded, overrideRequest.UserId); err != nil { + if err := impl.cdWorkflowCommonService.MarkCurrentDeploymentFailed(cdWfr, cdWorkflow2.ErrorDeploymentSuperseded, overrideRequest.UserId); err != nil { impl.logger.Errorw("error while updating current runner status to failed, handleAsyncTriggerReleaseError", "cdWfr", cdWfr.Id, "err", err) } return @@ -369,7 +370,7 @@ func (impl *WorkflowDagExecutorImpl) ProcessDevtronAsyncInstallRequest(cdAsyncIn } if util.IsHelmApp(overrideRequest.DeploymentAppType) { // update workflow runner status, used in app workflow view - err = impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, pipelineConfig.WorkflowStarting) + err = impl.cdWorkflowCommonService.UpdateNonTerminalStatusInRunner(newCtx, overrideRequest.WfrId, overrideRequest.UserId, cdWorkflow2.WorkflowStarting) if err != nil { impl.logger.Errorw("error in updating the workflow runner status, processDevtronAsyncHelmInstallRequest", "cdWfrId", cdWfr.Id, "err", err) return err diff --git a/pkg/workflow/status/WorkflowStatusService.go b/pkg/workflow/status/WorkflowStatusService.go index 19c3d9214d..f34a71b295 100644 --- a/pkg/workflow/status/WorkflowStatusService.go +++ b/pkg/workflow/status/WorkflowStatusService.go @@ -28,6 +28,7 @@ import ( "github.com/devtron-labs/devtron/internal/sql/repository/chartConfig" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/adapter/cdWorkflow" + cdWorkflow2 "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/cdWorkflow" "github.com/devtron-labs/devtron/internal/sql/repository/pipelineConfig/bean/timelineStatus" "github.com/devtron-labs/devtron/pkg/app" "github.com/devtron-labs/devtron/pkg/app/status" @@ -167,7 +168,7 @@ func (impl *WorkflowStatusServiceImpl) CheckHelmAppStatusPeriodicallyAndUpdateIn } wfr.UpdatedBy = 1 wfr.UpdatedOn = time.Now() - if wfr.Status == pipelineConfig.WorkflowFailed { + if wfr.Status == cdWorkflow2.WorkflowFailed { err = impl.pipelineStatusTimelineService.MarkPipelineStatusTimelineSuperseded(wfr.RefCdWorkflowRunnerId) if err != nil { impl.logger.Errorw("error updating CdPipelineStatusTimeline", "err", err) @@ -186,12 +187,12 @@ func (impl *WorkflowStatusServiceImpl) CheckHelmAppStatusPeriodicallyAndUpdateIn impl.logger.Errorw("error in fetching environment deployment config by appId and envId", "appId", appId, "envId", envId, "err", err) return err } - if slices.Contains(pipelineConfig.WfrTerminalStatusList, wfr.Status) { + if slices.Contains(cdWorkflow2.WfrTerminalStatusList, wfr.Status) { util3.TriggerCDMetrics(cdWorkflow.GetTriggerMetricsFromRunnerObj(wfr, envDeploymentConfig), impl.config.ExposeCDMetrics) } impl.logger.Infow("updated workflow runner status for helm app", "wfr", wfr) - if wfr.Status == pipelineConfig.WorkflowSucceeded { + if wfr.Status == cdWorkflow2.WorkflowSucceeded { pipelineOverride, err := impl.pipelineOverrideRepository.FindLatestByCdWorkflowId(wfr.CdWorkflowId) if err != nil { impl.logger.Errorw("error in getting latest pipeline override by cdWorkflowId", "err", err, "cdWorkflowId", wfr.CdWorkflowId) @@ -247,7 +248,7 @@ func (impl *WorkflowStatusServiceImpl) UpdatePipelineTimelineAndStatusByLiveAppl if err != nil { impl.logger.Errorw("error in getting acd application", "err", err, "argoAppName", pipeline) // updating cdWfr status - cdWfr.Status = pipelineConfig.WorkflowUnableToFetchState + cdWfr.Status = cdWorkflow2.WorkflowUnableToFetchState cdWfr.UpdatedOn = time.Now() cdWfr.UpdatedBy = 1 err = impl.cdWorkflowRepository.UpdateWorkFlowRunner(&cdWfr) @@ -355,9 +356,8 @@ func (impl *WorkflowStatusServiceImpl) UpdatePipelineTimelineAndStatusByLiveAppl if err != nil { impl.logger.Errorw("error in getting acd application", "err", err, "argoAppName", installedApp) // updating cdWfr status - installedAppVersionHistory.Status = pipelineConfig.WorkflowUnableToFetchState - installedAppVersionHistory.UpdatedOn = time.Now() - installedAppVersionHistory.UpdatedBy = 1 + installedAppVersionHistory.SetStatus(cdWorkflow2.WorkflowUnableToFetchState) + installedAppVersionHistory.UpdateAuditLog(1) installedAppVersionHistory, err = impl.installedAppVersionHistoryRepository.UpdateInstalledAppVersionHistory(installedAppVersionHistory, nil) if err != nil { impl.logger.Errorw("error on update installedAppVersionHistory", "installedAppVersionHistory", installedAppVersionHistory, "err", err) @@ -401,7 +401,7 @@ func (impl *WorkflowStatusServiceImpl) UpdatePipelineTimelineAndStatusByLiveAppl if isSucceeded { // handling deployment success event // updating cdWfr status - installedAppVersionHistory.SetStatus(pipelineConfig.WorkflowSucceeded) + installedAppVersionHistory.SetStatus(cdWorkflow2.WorkflowSucceeded) installedAppVersionHistory.SetFinishedOn() installedAppVersionHistory.UpdateAuditLog(1) installedAppVersionHistory, err = impl.installedAppVersionHistoryRepository.UpdateInstalledAppVersionHistory(installedAppVersionHistory, nil) @@ -569,9 +569,8 @@ func (impl *WorkflowStatusServiceImpl) syncACDHelmApps(deployedBeforeMinutes int impl.logger.Errorw("error in syncing argoCD app", "err", syncErr) timelineObject := impl.pipelineStatusTimelineService.NewHelmAppDeploymentStatusTimelineDbObject(installedAppVersionHistoryId, timelineStatus.TIMELINE_STATUS_DEPLOYMENT_FAILED, fmt.Sprintf("error occured in syncing argocd application. err: %s", syncErr.Error()), 1) _ = impl.pipelineStatusTimelineService.SaveTimeline(timelineObject, nil) - installedAppVersionHistory.Status = pipelineConfig.WorkflowFailed - installedAppVersionHistory.UpdatedBy = 1 - installedAppVersionHistory.UpdatedOn = time.Now() + installedAppVersionHistory.MarkDeploymentFailed(syncErr) + installedAppVersionHistory.UpdateAuditLog(1) _, installedAppUpdateErr := impl.installedAppVersionHistoryRepository.UpdateInstalledAppVersionHistory(installedAppVersionHistory, nil) if installedAppUpdateErr != nil { impl.logger.Errorw("error in updating cd workflow runner as failed in argocd app sync cron", "err", err) diff --git a/scripts/sql/29001900_helm_app_deployment_message.down.sql b/scripts/sql/29001900_helm_app_deployment_message.down.sql new file mode 100644 index 0000000000..25eb9b043a --- /dev/null +++ b/scripts/sql/29001900_helm_app_deployment_message.down.sql @@ -0,0 +1,3 @@ +-- Drop the message column from the "public"."installed_app_version_history" table +ALTER TABLE "public"."installed_app_version_history" + DROP COLUMN IF EXISTS message; \ No newline at end of file diff --git a/scripts/sql/29001900_helm_app_deployment_message.up.sql b/scripts/sql/29001900_helm_app_deployment_message.up.sql new file mode 100644 index 0000000000..8d08f59175 --- /dev/null +++ b/scripts/sql/29001900_helm_app_deployment_message.up.sql @@ -0,0 +1,3 @@ +-- Add message column to "public"."installed_app_version_history" table +ALTER TABLE "public"."installed_app_version_history" + ADD COLUMN IF NOT EXISTS message TEXT; \ No newline at end of file diff --git a/specs/helmApp/deployment-history-api-spec.yaml b/specs/helmApp/deployment-history-api-spec.yaml new file mode 100644 index 0000000000..2686dd7ea4 --- /dev/null +++ b/specs/helmApp/deployment-history-api-spec.yaml @@ -0,0 +1,244 @@ +openapi: "3.0.3" +info: + version: 1.0.0 + title: Devtron Labs +paths: + /orchestrator/application/deployment-history: + get: + description: get deployment histories list of helm app + parameters: + - in: query + name: appId + example: "12|helm-app|cluster1-ns1" + description: "pipe separated string of clusterinstance id, namespace and helm release name. Format: `||`. Only supplied for external helm apps" + required: false + allowEmptyValue: false + schema: + type: string + - in: query + name: installedAppId + example: "100" + description: Devtron charts installed instance id. Supplied for Devtron managed Helm Apps. + required: false + allowEmptyValue: false + schema: + type: number + responses: + '200': + description: deployment history + content: + application/json: + schema: + $ref: "#/components/schemas/DeploymentHistoryAndInstalledAppInfo" + '400': + description: Bad Request. Validation error/wrong request body. + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + code: 400 + status: "Bad Request" + errors: + - code: 400 + internalMessage: "invalid installed app id" + userMessage: "invalid installed app id" + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + code: 500 + status: "Internal Server Error" + errors: + - code: 500 + internalMessage: "internal server error" + userMessage: "internal server error" + '403': + description: Unauthorized User + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + code: 403 + status: "Forbidden" + errors: + - code: 403 + internalMessage: "unauthorized" + userMessage: "unauthorized" +components: + schemas: + ChartMetadata: + type: object + properties: + chartName: + type: string + description: name of the chart + example: envoy + chartVersion: + type: string + description: version of the helm chart + example: v1.2.3 + home: + type: string + description: chart home + example: nginx.com + sources: + type: array + description: source of the helm chart + example: + - "nginx.com" + - "github.com" + items: + type: string + description: + type: string + description: description of the helm chart + example: description of the helm chart + notes: + type: string + description: Contains the rendered templates/NOTES.txt + example: notes of the chart + HelmAppDeploymentDetail: + type: object + properties: + chartMetadata: + $ref: "#/components/schemas/ChartMetadata" + dockerImages: + type: array + description: docker images presrnt insise the chart + example: + - "docker.io/test-registry/test-repo:v12.0.9-beta" + - "docker.io/test-registry/test-repo:v12.0.10-beta" + - "docker.io/test-registry/test-repo:v12.0.11-beta" + items: + type: string + version: + type: integer + description: deployment version of the helm chart + example: 12 + deployedAt: + type: string + format: date-time + example: "2021-12-15T05:44:05Z" + deployedBy: + type: string + example: "user@gmail.com" + status: + type: string + example: "Failed" + mesasge: + type: string + example: "namespace 'api-south-1-prod-ns' doesn't exists" + DeploymentHistoryAndInstalledAppInfo: + type: object + properties: + deploymentHistory: + type: array + description: deployment history + items: + $ref: "#/components/schemas/HelmAppDeploymentDetail" + installedAppInfo: + $ref: "#/components/schemas/InstalledAppInfo" + InstalledAppInfo: + type: object + description: For externally installed helm charts this object can be null + properties: + appId: + type: integer + example: 100 + description: Application instance Id + installedAppId: + type: integer + example: 100 + description: Installed app instance Id + installedAppVersionId: + type: number + example: 1809 + description: App store installed app version Id + appStoreChartId: + type: number + example: 1023 + description: App store chart Id + environmentName: + type: string + example: api-south-1-prod + description: Environment Name + appOfferingMode: + type: string + example: EA_ONLY + enum: + - "EA_ONLY" + - "FULL" + description: Application created in server type + clusterId: + type: number + example: 3 + description: Cluster instance Id + environmentId: + type: number + example: 10 + description: Environment instance Id + appStoreChartRepoName: + type: string + example: cluster-utils + description: App store Chart Repository name + appStoreChartName: + type: string + example: node-termination-handler + description: App store Chart name + teamId: + type: number + example: 2 + description: Project instance Id + teamName: + type: string + example: client-2 + description: Project instance Id + deploymentType: + type: string + example: helm + enum: + - "helm" + - "argo_cd" + - "manifest_download" + description: Installed app Deployment type + helmPackageName: + type: string + example: "prod-cluster-util-api-south-1-prod-2021-12-15T05:44:05Z (GMT)" + description: Virtual helm package name. Only populated in case of isolated deployments. i.e deploymentType is `manifest_download`. + ErrorResponse: + required: + - code + - status + properties: + code: + type: integer + format: int32 + description: Error code + status: + type: string + description: Error message + errors: + type: array + description: errors + items: + $ref: '#/components/schemas/Error' + Error: + required: + - code + - status + properties: + code: + type: integer + format: int32 + description: Error internal code + internalMessage: + type: string + description: Error internal message + userMessage: + type: string + description: Error user message \ No newline at end of file