Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,13 @@ func (impl *InstalledAppDeploymentTypeChangeServiceImpl) fetchDeletedInstalledAp
if err != nil && util2.CheckAppReleaseNotExist(err) {
successfulInstalledApps = appendToDeploymentChangeStatusList(successfulInstalledApps, installedApp, "", bean.Success)
} else {
failedInstalledApps = appendToDeploymentChangeStatusList(failedInstalledApps, installedApp, appStoreBean.APP_NOT_DELETED_YET_ERROR, bean.NOT_YET_DELETED)
failError := appStoreBean.APP_NOT_DELETED_YET_ERROR
failStatus := bean.NOT_YET_DELETED
if util2.CheckPermissionErrorForArgoCd(err) {
failError = string(bean.PermissionDenied)
failStatus = bean.Failed
}
failedInstalledApps = appendToDeploymentChangeStatusList(failedInstalledApps, installedApp, failError, failStatus)
}
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/appStore/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

const RELEASE_NOT_EXIST = "release not exist"
const NOT_FOUND = "not found"
const PermissionDenied = "permission denied"

func MoveFileToDestination(filePath, destinationPath string) error {
err := os.Rename(filePath, destinationPath)
Expand Down Expand Up @@ -42,3 +43,7 @@ func CheckAppReleaseNotExist(err error) bool {
// RELEASE_NOT_EXIST check for helm App and NOT_FOUND check for argo app
return strings.Contains(err.Error(), NOT_FOUND) || strings.Contains(err.Error(), RELEASE_NOT_EXIST)
}

func CheckPermissionErrorForArgoCd(err error) bool {
return strings.Contains(err.Error(), PermissionDenied)
}
9 changes: 5 additions & 4 deletions pkg/bean/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,11 @@ func IsHelmApp(deploymentType string) bool {
type Status string

const (
Success Status = "Success"
Failed Status = "Failed"
INITIATED Status = "Migration initiated"
NOT_YET_DELETED Status = "Not yet deleted"
Success Status = "Success"
Failed Status = "Failed"
INITIATED Status = "Migration initiated"
NOT_YET_DELETED Status = "Not yet deleted"
PermissionDenied Status = "permission denied"
)

const RELEASE_NOT_EXIST = "release not exist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (impl *GitCliManagerImpl) commit(ctx GitContext, rootDir string, commitMsg

func (impl *GitCliManagerImpl) lastCommitHash(ctx GitContext, rootDir string) (response, errMsg string, err error) {
impl.logger.Debugw("git log ", "location", rootDir)
cmd, cancel := impl.createCmdWithContext(ctx, "git", "-C", rootDir, "log", "--pretty=format:'%h'", "-n", "1")
cmd, cancel := impl.createCmdWithContext(ctx, "git", "-C", rootDir, "log", "--format=format:%H", "-n", "1")
defer cancel()
output, errMsg, err := impl.runCommandWithCred(cmd, ctx.auth)
impl.logger.Debugw("git commit output", "root", rootDir, "opt", output, "errMsg", errMsg, "error", err)
Expand Down