Skip to content

Commit

Permalink
Merge pull request #470 from openinfradev/fix-latest-task-api
Browse files Browse the repository at this point in the history
bugfix: return availableRollback value by GetTasks API
  • Loading branch information
ktkfree authored May 7, 2024
2 parents e1167a7 + 9aecbd0 commit 05af7fa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/delivery/http/app-serve-app.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,12 @@ func (h *AppServeAppHandler) GetAppServeAppTasksByAppId(w http.ResponseWriter, r
var out domain.GetAppServeAppTasksResponse
out.AppServeAppTasks = make([]domain.AppServeAppTaskResponse, len(tasks))
for i, task := range tasks {
// Rollbacking to latest task should be blocked.
if i > 0 && strings.Contains(task.Status, "SUCCESS") && task.Status != "ABORT_SUCCESS" &&
task.Status != "ROLLBACK_SUCCESS" {
task.AvailableRollback = true
}

if err := serializer.Map(r.Context(), task, &out.AppServeAppTasks[i]); err != nil {
log.Info(r.Context(), err)
continue
Expand Down

0 comments on commit 05af7fa

Please sign in to comment.