Skip to content

Commit

Permalink
Merge pull request #55 from openinfradev/add-default-rev
Browse files Browse the repository at this point in the history
app-serving: rollback 비활성화 로직 버그 수정
  • Loading branch information
Siyeop authored May 22, 2023
2 parents 042b7d8 + 6d967db commit f2e1359
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions internal/delivery/http/app-serve-app.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,17 @@ func (h *AppServeAppHandler) GetAppServeApp(w http.ResponseWriter, r *http.Reque
return
}

// For very first task, rollback should be disabled.
if len(app.AppServeAppTasks) > 1 {
newTasks := make([]domain.AppServeAppTask, 0)
for _, t := range app.AppServeAppTasks {
if strings.Contains(t.Status, "SUCCESS") && t.Status != "BLUEGREEN_ABORT_SUCCESS" &&
t.Status != "ROLLBACK_SUCCESS" {
t.AvailableRollback = true
}
newTasks = append(newTasks, t)
newTasks := make([]domain.AppServeAppTask, 0)

for idx, t := range app.AppServeAppTasks {
// Rollbacking to latest task should be blocked.
if idx > 0 && strings.Contains(t.Status, "SUCCESS") && t.Status != "BLUEGREEN_ABORT_SUCCESS" &&
t.Status != "ROLLBACK_SUCCESS" {
t.AvailableRollback = true
}
app.AppServeAppTasks = newTasks
newTasks = append(newTasks, t)
}
app.AppServeAppTasks = newTasks

var out domain.GetAppServeAppResponse
out.AppServeApp = *app
Expand Down
2 changes: 1 addition & 1 deletion pkg/domain/app-serve-app.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type AppServeAppTask struct {
ExtraEnv string `json:"extraEnv,omitempty"` // env variable list for java app
Port string `json:"port,omitempty"` // java app port
ResourceSpec string `json:"resourceSpec,omitempty"` // resource spec of app pod
HelmRevision int32 `json:"helmRevision,omitempty"` // revision of deployed helm release
HelmRevision int32 `gorm:"default:0" json:"helmRevision,omitempty"` // revision of deployed helm release
Strategy string `json:"strategy,omitempty"` // deployment strategy (eg, rolling-update)
PvEnabled bool `json:"pvEnabled"`
PvStorageClass string `json:"pvStorageClass"`
Expand Down

0 comments on commit f2e1359

Please sign in to comment.