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

Rollback is not happening from UI instead of working from API #569

Open
chiragggupta90 opened this issue Dec 24, 2024 · 3 comments
Open
Labels
bug Something isn't working frontend help wanted Extra attention is needed

Comments

@chiragggupta90
Copy link

Hi Team,

While using this tool, i have observed that initial rollback is not happening while it is showing it is completed.
As per the logs rollback is happing from 2-->2 instead of 2-->1.
below are the logs while initiating rollback:

INFO[9115] Rolled back default/du to 2=>2
[GIN] 2024/12/24 - 08:25:07 | 202 | 1.499399089s | 172.21.42.98 | POST "/api/helm/releases/default/du/rollback"
[GIN] 2024/12/24 - 08:25:07 | 200 | 45.091µs | 172.21.42.98 | GET "/"
[GIN] 2024/12/24 - 08:25:07 | 200 | 91.224µs | 172.21.42.98 | GET "/assets/analytics.js"
[GIN] 2024/12/24 - 08:25:07 | 200 | 192.422µs | 172.21.42.98 | GET "/assets/index-f1036a4b.css"
[GIN] 2024/12/24 - 08:25:07 | 200 | 34.224µs | 172.21.42.98 | GET "/status"
[GIN] 2024/12/24 - 08:25:07 | 200 | 392.330147ms | 172.21.42.98 | GET "/api/helm/releases/default/du/history"
[GIN] 2024/12/24 - 08:25:08 | 200 | 653.089758ms | 172.21.42.98 | GET "/assets/index-7d01864f.js"
[GIN] 2024/12/24 - 08:25:08 | 200 | 94.302µs | 172.21.42.98 | GET "/assets/logo-header-1db0e193.svg"
[GIN] 2024/12/24 - 08:25:08 | 200 | 23.42µs | 172.21.42.98 | GET "/assets/arrow-down-icon-940a5660.svg"
[GIN] 2024/12/24 - 08:25:08 | 200 | 22.991µs | 172.21.42.98 | GET "/assets/k8s-watcher-f6ceb5e3.svg"
[GIN] 2024/12/24 - 08:25:08 | 200 | 30.973µs | 172.21.42.98 | GET "/status"
[GIN] 2024/12/24 - 08:25:08 | 200 | 154.919µs | 172.21.42.98 | GET "/assets/body-background-89ce527b.svg"
[GIN] 2024/12/24 - 08:25:08 | 200 | 36.388µs | 172.21.42.98 | GET "/assets/logo.svg"
[GIN] 2024/12/24 - 08:25:09 | 200 | 349.068962ms | 172.21.42.98 | GET "/api/helm/releases/default/du/history"

While trying to do it from API:
INFO[9175] Rolled back default/du to 2=>1
[GIN] 2024/12/24 - 08:26:07 | 202 | 1.634760999s | 172.21.42.98 | POST "/api/helm/releases/default/du/rollback"
[GIN] 2024/12/24 - 08:28:48 | 200 | 625.815µs | 172.21.42.98 | GET "/api/k8s/contexts"
[GIN] 2024/12/24 - 08:28:48 | 200 | 74.477µs | 172.21.42.98 | GET "/assets/packges-header-4f4494c9.svg"
[GIN] 2024/12/24 - 08:28:48 | 200 | 607.324541ms | 172.21.42.98 | GET "/api/helm/releases"
[GIN] 2024/12/24 - 08:28:48 | 200 | 43.53704ms | 172.21.42.98 | GET "/api/helm/releases/default/bbdev/resources?health=true"

seems like UI is not sending appropriate info

@undera undera added the bug Something isn't working label Jan 4, 2025
@undera
Copy link
Collaborator

undera commented Jan 4, 2025

Your analysis seem correct. Would be great if someone ReactJS-proficient would fix this bug.

@undera undera added help wanted Extra attention is needed frontend labels Jan 4, 2025
@msarfrazanwar
Copy link

@chiragggupta90 Can you share a UI screenshot highlighting part which initiates rollback ?

@chiragggupta90
Copy link
Author

chiragggupta90 commented Feb 10, 2025

Thanks @msarfrazanwar, here is the screen shot.

Image

once i click on Rollback then i can see that rollback is happening from 2 to 2 only. ideally it should be 2-->1

As a workaround i modified the backend code(golang) where i added a condition as below but actual resolution should be in frontend only.
pkg/dashboard/objects/releases.go

func (r *Release) Rollback(toRevision int) error {
r.mx.Lock()
defer r.mx.Unlock()

    hc, err := r.HelmConfig(r.Orig.Namespace)
    if err != nil {
            return errorx.Decorate(err, "failed to get helm config for namespace '%s'", "")
    }
    log.Infof("Revision value is from Post Data -->%d", toRevision)
    if r.Orig.Version == toRevision {
        log.Infof("Special handling for rollback when both versions are same")
        toRevision= r.Orig.Version - 1
    }
    log.Infof("Modified Revison values is -->%d", toRevision)
    client := action.NewRollback(hc)
    client.Version = toRevision
    err = client.Run(r.Orig.Name)
    if err != nil {
            return errorx.Decorate(err, "failed to rollback the release")
    }

    log.Infof("Rolled back %s/%s to %d=>%d", r.Orig.Namespace, r.Orig.Name, r.Orig.Version, toRevision)
    return nil

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frontend help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants