Skip to content

Commit c0dc007

Browse files
handled the release not found case for app detail of external app (#5791)
Co-authored-by: Rajeev Ranjan<[email protected]>
1 parent c022e5f commit c0dc007

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

api/helm-app/HelmAppRestHandler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
clientErrors "github.com/devtron-labs/devtron/pkg/errors"
2929
"github.com/devtron-labs/devtron/pkg/fluxApplication"
3030
bean2 "github.com/devtron-labs/devtron/pkg/k8s/application/bean"
31+
"github.com/devtron-labs/devtron/pkg/pipeline"
3132
"net/http"
3233
"strconv"
3334
"strings"
@@ -144,6 +145,11 @@ func (handler *HelmAppRestHandlerImpl) GetApplicationDetail(w http.ResponseWrite
144145
//RBAC enforcer Ends
145146
appdetail, err := handler.helmAppService.GetApplicationDetail(context.Background(), appIdentifier)
146147
if err != nil {
148+
149+
if pipeline.CheckAppReleaseNotExist(err) {
150+
common.WriteJsonResp(w, err, nil, http.StatusNotFound)
151+
return
152+
}
147153
apiError := clientErrors.ConvertToApiError(err)
148154
if apiError != nil {
149155
err = apiError

cmd/external-app/wire_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/pipeline/AppDeploymentTypeChangeManager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ func (impl *AppDeploymentTypeChangeManagerImpl) fetchDeletedApp(ctx context.Cont
744744
impl.logger.Errorw("error in getting application detail", "err", err, "deploymentAppName", pipeline.DeploymentAppName)
745745
}
746746

747-
if err != nil && checkAppReleaseNotExist(err) {
747+
if err != nil && CheckAppReleaseNotExist(err) {
748748
successfulPipelines = impl.appendToDeploymentChangeStatusList(
749749
successfulPipelines,
750750
pipeline,

pkg/pipeline/PipelineBuilder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ type PipelineStrategy struct {
284284
Default bool `json:"default"`
285285
}
286286

287-
func checkAppReleaseNotExist(err error) bool {
287+
func CheckAppReleaseNotExist(err error) bool {
288288
// RELEASE_NOT_EXIST check for helm App and NOT_FOUND check for argo app
289289
return strings.Contains(err.Error(), bean.NOT_FOUND) || strings.Contains(err.Error(), bean.RELEASE_NOT_EXIST)
290290
}

0 commit comments

Comments
 (0)