Skip to content

Commit

Permalink
Merge pull request #3813 from jamsman94/feature/variableDescription
Browse files Browse the repository at this point in the history
add description field to variables
  • Loading branch information
jamsman94 authored Nov 8, 2024
2 parents 5153a0b + 456890d commit 9b187ce
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 22 deletions.
1 change: 1 addition & 0 deletions pkg/microservice/aslan/core/build/service/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func generateBuildModuleFromOpenAPIRequest(req *OpenAPIBuildCreationReq, log *za
Value: kv.DefaultValue,
Type: commonmodels.ParameterSettingType(kv.Type),
ChoiceOption: kv.ChoiceOption,
Description: kv.Description,
IsCredential: kv.IsCredential,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ type KeyVal struct {
CallFunction string `bson:"call_function,omitempty" json:"call_function,omitempty" yaml:"call_function,omitempty"`
FunctionReference []string `bson:"function_reference,omitempty" json:"function_reference,omitempty" yaml:"function_reference,omitempty"`
IsCredential bool `bson:"is_credential" json:"is_credential" yaml:"is_credential"`
Description string `bson:"description" json:"description" yaml:"description"`
}

type Item struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ func (j *JobProperties) DeepCopyEnvs() []*KeyVal {
RegistryID: env.RegistryID,
ChoiceOption: choiceOption,
IsCredential: env.IsCredential,
Description: env.Description,
})
}
return envs
Expand Down
1 change: 1 addition & 0 deletions pkg/microservice/aslan/core/common/service/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ func MergeBuildEnvs(templateEnvs []*commonmodels.KeyVal, customEnvs []*commonmod
for _, v := range templateEnvs {
if cv, ok := customEnvMap[v.Key]; ok {
cv.ChoiceOption = v.ChoiceOption
cv.Description = v.Description
cv.Script = v.Script
cv.FunctionReference = v.FunctionReference
cv.CallFunction = v.CallFunction
Expand Down
22 changes: 0 additions & 22 deletions pkg/microservice/aslan/core/workflow/service/workflow/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,28 +559,6 @@ func JobSkiped(job *commonmodels.Job) bool {
return job.Skipped
}

func RenderKeyVals(input, origin []*commonmodels.KeyVal) []*commonmodels.KeyVal {
resp := make([]*commonmodels.KeyVal, 0)

for _, originKV := range origin {
item := &commonmodels.KeyVal{
Key: originKV.Key,
Value: originKV.Value,
Type: originKV.Type,
IsCredential: originKV.IsCredential,
ChoiceOption: originKV.ChoiceOption,
}
for _, inputKV := range input {
if originKV.Key == inputKV.Key {
// always use origin credential config.
item.Value = inputKV.Value
}
}
resp = append(resp, item)
}
return resp
}

// use service name and service module hash to generate job name
func jobNameFormat(jobName string) string {
if len(jobName) <= 63 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ func renderKeyVals(input, origin []*commonmodels.KeyVal) []*commonmodels.KeyVal
Type: originKV.Type,
IsCredential: originKV.IsCredential,
ChoiceOption: originKV.ChoiceOption,
Description: originKV.Description,
FunctionReference: originKV.FunctionReference,
CallFunction: originKV.CallFunction,
Script: originKV.Script,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ func PresetWorkflowArgs(namespace, workflowName string, log *zap.SugaredLogger)
Value: moduleEnv.Value,
IsCredential: moduleEnv.IsCredential,
ChoiceOption: moduleEnv.ChoiceOption,
Description: moduleEnv.Description,
Type: moduleEnv.Type,
})
}
Expand Down
1 change: 1 addition & 0 deletions pkg/types/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type ParameterSetting struct {
// ExternalSetting It is the configuration of the external system to obtain the variable
ExternalSetting *ExternalSetting `json:"external_setting"`
IsCredential bool `json:"is_credential"`
Description string `json:"description"`
}

type ExternalSetting struct {
Expand Down

0 comments on commit 9b187ce

Please sign in to comment.