konveyor/tackle2-addon

bug: repo branch is changed permanently when an addon does `git checkout`

Opened this issue · 2 comments

Bug

When an addon runs on an app, fetches the repo for that app and changes the git branch to a different one, that change is permanent. Future addon runs will use that new branch. Even the Tackle UI shows the new branch instead of the one the user specified.

Steps to reproduce

  1. Create an application in the Tackle 2 Hub with a repo url and a branch main.
  2. Run an addon that fetches the repo and checkouts a different branch or creates a new branch.
  3. Once the addon is finished, go back to the Tackle 2 Hub UI and look at the application. The branch will have changed.

Context

Currently working around this issue in Move2Kube addon by detecting the current branch before checking out a new branch
https://github.com/konveyor/addon-move2kube/blob/main/cmd/utils.go#L114-L126
and then checking out the original branch once the transformation is finished.
https://github.com/konveyor/addon-move2kube/blob/main/cmd/utils.go#L148-L151

@HarikrishnanBalagopal I figured running what I had over here would demonstrate the behavior that you were describing, but I didn't see that.

TACKLE HUB UI
image

GitHub UI looking at my tackle-pathfinder fork
image

Did I miss something?