Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Gitops optional for cicd #1861

Merged
merged 9 commits into from
Jun 13, 2022
18 changes: 16 additions & 2 deletions api/appStore/InstalledAppRestHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,28 @@ func (handler *InstalledAppRestHandlerImpl) FetchAppDetailsForInstalledApp(w htt
InternalMessage: "app detail fetched, failed to get resource tree from acd",
UserMessage: "app detail fetched, failed to get resource tree from acd",
}
appDetail.ResourceTree = &application.ResourceTreeResponse{}
appDetail.ResourceTree = map[string]interface{}{}
common.WriteJsonResp(w, nil, appDetail, http.StatusOK)
return
}
appDetail.ResourceTree = resp
appDetail.ResourceTree = common.ConvertResourceTree(resp)
handler.Logger.Debugf("application %s in environment %s had status %+v\n", installedAppId, envId, resp)
} else {
handler.Logger.Infow("appName and envName not found - avoiding resource tree call", "app", appDetail.AppName, "env", appDetail.EnvironmentName)
}
common.WriteJsonResp(w, err, appDetail, http.StatusOK)
}

func (handler *InstalledAppRestHandlerImpl) convertResourceTree(resp interface{}) map[string]interface{} {
var dat map[string]interface{}
b, err := json.Marshal(resp)
if err != nil {
handler.Logger.Errorw("error on marshal resource tree", "err", err)
return dat
}
if err := json.Unmarshal(b, &dat); err != nil {
handler.Logger.Errorw("error on unmarshal resource tree", "err", err)
return dat
}
return dat
}
10 changes: 5 additions & 5 deletions api/bean/AppView.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package bean
import (
"encoding/json"
"github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1"
"github.com/devtron-labs/devtron/client/argocdServer/application"
)

type AppContainer struct {
Expand Down Expand Up @@ -107,14 +106,15 @@ type DeploymentDetailContainer struct {
K8sVersion string `json:"k8sVersion"`
CiArtifactId int `json:"ciArtifactId"`
ClusterId int `json:"clusterId"`
DeploymentAppType string `json:"deploymentAppType"`
}

type AppDetailContainer struct {
DeploymentDetailContainer `json:",inline"`
InstanceDetail []InstanceDetail `json:"instanceDetail"` //pod list with cpu, memory usage percent
Environments []Environment `json:"otherEnvironment,omitempty"`
LinkOuts []LinkOuts `json:"linkOuts,omitempty"`
ResourceTree *application.ResourceTreeResponse `json:"resourceTree,omitempty"`
InstanceDetail []InstanceDetail `json:"instanceDetail"` //pod list with cpu, memory usage percent
Environments []Environment `json:"otherEnvironment,omitempty"`
LinkOuts []LinkOuts `json:"linkOuts,omitempty"`
ResourceTree map[string]interface{} `json:"resourceTree,omitempty"`
}

type Environment struct {
Expand Down
13 changes: 13 additions & 0 deletions api/helm-app/applicationClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type HelmAppClient interface {
IsReleaseInstalled(ctx context.Context, in *ReleaseIdentifier) (*BooleanResponse, error)
RollbackRelease(ctx context.Context, in *RollbackReleaseRequest) (*BooleanResponse, error)
TemplateChart(ctx context.Context, in *InstallReleaseRequest) (*TemplateChartResponse, error)
HelmInstallCustom(ctx context.Context, in *HelmInstallCustomRequest) (*HelmInstallCustomResponse, error)
}

type HelmAppClientImpl struct {
Expand Down Expand Up @@ -261,3 +262,15 @@ func (impl *HelmAppClientImpl) TemplateChart(ctx context.Context, in *InstallRel
}
return response, nil
}

func (impl *HelmAppClientImpl) HelmInstallCustom(ctx context.Context, in *HelmInstallCustomRequest) (*HelmInstallCustomResponse, error) {
applicationClient, err := impl.getApplicationClient()
if err != nil {
return nil, err
}
response, err := applicationClient.HelmInstallCustom(ctx, in)
if err != nil {
return nil, err
}
return response, nil
}
514 changes: 368 additions & 146 deletions api/helm-app/applist.pb.go

Large diffs are not rendered by default.

Loading