feat: prepare for dependency lang install/setup

This commit is contained in:
Marvin Zhang
2024-12-14 22:18:22 +08:00
parent 298420b0a6
commit 25580b4694
6 changed files with 34 additions and 36 deletions

View File

@@ -1,8 +1,11 @@
package constants
const (
DependencyTypePython = "python"
DependencyTypeNode = "node"
DependencyTypePython = "python"
DependencyTypeNode = "node"
DependencyTypeGo = "go"
DependencyTypeJava = "java"
DependencyTypeBrowser = "browser"
)
const (

View File

@@ -73,7 +73,7 @@ func GetModelInstances() []any {
*new(DatabaseMetric),
*new(Dependency),
*new(DependencyLog),
*new(DependencySetting),
*new(DependencyConfig),
*new(DependencyRepo),
*new(Environment),
*new(Git),

View File

@@ -0,0 +1,12 @@
package models
type DependencyConfig struct {
any `collection:"dependency_configs"`
BaseModel[DependencyConfig] `bson:",inline"`
Key string `json:"key" bson:"key"`
Name string `json:"name" bson:"name"`
Cmd string `json:"cmd" bson:"cmd"`
Proxy string `json:"proxy" bson:"proxy"`
SetupNodeIds []string `json:"setup_node_ids" bson:"setup_node_ids"`
SetupScriptPath string `json:"setup_script_path" bson:"setup_script_path"`
}

View File

@@ -1,12 +0,0 @@
package models
type DependencySetting struct {
any `collection:"dependency_settings"`
BaseModel[DependencySetting] `bson:",inline"`
Key string `json:"key" bson:"key"`
Name string `json:"name" bson:"name"`
Description string `json:"description" bson:"description"`
Enabled bool `json:"enabled" bson:"enabled"`
Cmd string `json:"cmd" bson:"cmd"`
Proxy string `json:"proxy" bson:"proxy"`
}

View File

@@ -26,6 +26,7 @@ const (
DependencyServiceCode_SYNC DependencyServiceCode = 0
DependencyServiceCode_INSTALL DependencyServiceCode = 1
DependencyServiceCode_UNINSTALL DependencyServiceCode = 2
DependencyServiceCode_SETUP DependencyServiceCode = 3
)
// Enum value maps for DependencyServiceCode.
@@ -34,11 +35,13 @@ var (
0: "SYNC",
1: "INSTALL",
2: "UNINSTALL",
3: "SETUP",
}
DependencyServiceCode_value = map[string]int32{
"SYNC": 0,
"INSTALL": 1,
"UNINSTALL": 2,
"SETUP": 3,
}
)
@@ -310,9 +313,8 @@ type DependencyServiceUpdateLogsRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NodeKey string `protobuf:"bytes,1,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"`
DependencyId string `protobuf:"bytes,2,opt,name=dependency_id,json=dependencyId,proto3" json:"dependency_id,omitempty"`
Logs []string `protobuf:"bytes,3,rep,name=logs,proto3" json:"logs,omitempty"`
DependencyId string `protobuf:"bytes,1,opt,name=dependency_id,json=dependencyId,proto3" json:"dependency_id,omitempty"`
Logs []string `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"`
}
func (x *DependencyServiceUpdateLogsRequest) Reset() {
@@ -347,13 +349,6 @@ func (*DependencyServiceUpdateLogsRequest) Descriptor() ([]byte, []int) {
return file_services_dependency_service_proto_rawDescGZIP(), []int{4}
}
func (x *DependencyServiceUpdateLogsRequest) GetNodeKey() string {
if x != nil {
return x.NodeKey
}
return ""
}
func (x *DependencyServiceUpdateLogsRequest) GetDependencyId() string {
if x != nil {
return x.DependencyId
@@ -402,18 +397,17 @@ var file_services_dependency_service_proto_rawDesc = []byte{
0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64,
0x65, 0x6e, 0x63, 0x79, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69,
0x65, 0x73, 0x22, 0x78, 0x0a, 0x22, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79,
0x65, 0x73, 0x22, 0x5d, 0x0a, 0x22, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65,
0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x64, 0x65,
0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63,
0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x65,
0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73,
0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x2a, 0x3d, 0x0a, 0x15,
0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x00, 0x12,
0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09,
0x55, 0x4e, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x32, 0xfb, 0x01, 0x0a, 0x11,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x70, 0x65,
0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a,
0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x67,
0x73, 0x2a, 0x48, 0x0a, 0x15, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x59,
0x4e, 0x43, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10,
0x01, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x02,
0x12, 0x09, 0x0a, 0x05, 0x53, 0x45, 0x54, 0x55, 0x50, 0x10, 0x03, 0x32, 0xfb, 0x01, 0x0a, 0x11,
0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x5c, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x25, 0x2e, 0x67,
0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65,

View File

@@ -18,6 +18,7 @@ enum DependencyServiceCode {
SYNC = 0;
INSTALL = 1;
UNINSTALL = 2;
SETUP = 3;
}
message DependencyServiceConnectResponse {