Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/cluster/EnvironmentService.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ func (impl EnvironmentServiceImpl) GetEnvironmentListForAutocomplete(isDeploymen
allowedDeploymentConfigString []string
)
deploymentConfigValues, _ := impl.attributesRepository.FindByKey(fmt.Sprintf("%d", model.Id))
if err = json.Unmarshal([]byte(deploymentConfigValues.Value), &deploymentConfig); err != nil {
//if empty config received(doesn't exist in table) which can't be parsed
if err = json.Unmarshal([]byte(deploymentConfigValues.Value), &deploymentConfig); err != nil && deploymentConfigValues.Value != "" {
return nil, err
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/pipeline/PipelineBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,8 @@ func (impl PipelineBuilderImpl) CreateCdPipelines(pipelineCreateRequest *bean.Cd
func (impl PipelineBuilderImpl) validateDeploymentAppType(pipeline *bean.CDPipelineConfigObject) error {
var deploymentConfig map[string]bool
deploymentConfigValues, _ := impl.attributesRepository.FindByKey(fmt.Sprintf("%d", pipeline.EnvironmentId))
if err := json.Unmarshal([]byte(deploymentConfigValues.Value), &deploymentConfig); err != nil {
//if empty config received(doesn't exist in table) which can't be parsed
if err := json.Unmarshal([]byte(deploymentConfigValues.Value), &deploymentConfig); err != nil && deploymentConfigValues.Value != "" {
rerr := &util.ApiError{
HttpStatusCode: http.StatusInternalServerError,
InternalMessage: err.Error(),
Expand Down
2 changes: 1 addition & 1 deletion pkg/pipeline/PipelineBuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestPipelineBuilderImpl_validateDeploymentAppType(t *testing.T) {
mockDeploymentConfigConfig := &repository.Attributes{
Id: 1,
Key: "2",
Value: "",
Value: "fsfdfz",
Active: false,
AuditLog: sql.AuditLog{},
}
Expand Down