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

fix: deployment timelines fix for helm apps #3794

Merged
merged 5 commits into from
Aug 23, 2023
Merged
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
16 changes: 14 additions & 2 deletions pkg/app/AppService.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func (impl *AppServiceImpl) UpdateDeploymentStatusForGitOpsPipelines(app *v1alph
// new revision is not reconciled yet, thus status will not be changes and will remain in progress
}
} else {
isValid, installedAppVersionHistory, appId, envId, err := impl.CheckIfPipelineUpdateEventIsValidForAppStore(app.ObjectMeta.Name)
isValid, installedAppVersionHistory, appId, envId, err := impl.CheckIfPipelineUpdateEventIsValidForAppStore(app.ObjectMeta.Name, gitHash)
if err != nil {
impl.logger.Errorw("service err, CheckIfPipelineUpdateEventIsValidForAppStore", "err", err)
return isSucceeded, isTimelineUpdated, err
Expand Down Expand Up @@ -581,7 +581,7 @@ func (impl *AppServiceImpl) UpdateDeploymentStatusForGitOpsPipelines(app *v1alph
return isSucceeded, isTimelineUpdated, nil
}

func (impl *AppServiceImpl) CheckIfPipelineUpdateEventIsValidForAppStore(gitOpsAppName string) (bool, *repository4.InstalledAppVersionHistory, int, int, error) {
func (impl *AppServiceImpl) CheckIfPipelineUpdateEventIsValidForAppStore(gitOpsAppName string, gitHash string) (bool, *repository4.InstalledAppVersionHistory, int, int, error) {
isValid := false
var err error
installedAppVersionHistory := &repository4.InstalledAppVersionHistory{}
Expand Down Expand Up @@ -617,6 +617,18 @@ func (impl *AppServiceImpl) CheckIfPipelineUpdateEventIsValidForAppStore(gitOpsA
impl.logger.Errorw("error in getting appId and environmentId using installedAppVersionId", "err", err, "installedAppVersionId", installedAppVersionHistory.InstalledAppVersionId)
return isValid, installedAppVersionHistory, 0, 0, err
}
if gitHash != "" && installedAppVersionHistory.GitHash != gitHash {
installedAppVersionHistoryByHash, err := impl.installedAppVersionHistoryRepository.GetLatestInstalledAppVersionHistoryByGitHash(gitHash)
if err != nil {
impl.logger.Errorw("error on update application status", "gitHash", gitHash, "installedAppVersionHistory", installedAppVersionHistory, "err", err)
return isValid, installedAppVersionHistory, appId, envId, err
}
if installedAppVersionHistoryByHash.StartedOn.Before(installedAppVersionHistory.StartedOn) {
//we have received trigger hash which is committed before this apps actual gitHash stored by us
// this means that the hash stored by us will be synced later, so we will drop this event
return isValid, installedAppVersionHistory, appId, envId, nil
}
}
if util2.IsTerminalStatus(installedAppVersionHistory.Status) {
//drop event
return isValid, installedAppVersionHistory, appId, envId, nil
Expand Down
Loading