You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason of the bug is because: kusion init --online calls git clone(or git pull). If you exit when the git clone has not finished, there will be a directory .git under $KUSION_HOME/templates/external, but the .git directory is semi-finished and is not valid. If you run git clone (or git pull) again, the error comes.
Kusion uses github.com/pulumi/pulumi/sdk/v3/go/common/util/gitutil#GitCloneOrPull and github.com/pulumi/pulumi/sdk/v3/go/common/workspace#RetrieveGitFolder to do the git clone/pull job. I try to find a more robust alternative, and use git-go, which is recommended by git official, but the similar error still appears (still left the annoying .git directory and the failed git clone).
So the most simple and effective way is to clear the external templates directory and do git clone again.
Fix #549 try to catch ctrl+C and then do cleanup job to fix this bug. It's not a good idea, here is the reasons:
not only the ctrl+C and other interrupt signals will cause the bug, program panic, calling of os.Exit may also cause the bug;
the realization is troublesome, you have to listen two type events: the first is the interrupt signals, the second is whether the git clone succeeded. For the former, you have to listen them in the outer cli func, and passes them layer upon layer to the internal retrieve template repo function.
the remove action keeps the same as the retrieveURLTemplates.
What happened?
kusion init --online
failed, with error "cloning templates failed. Please try again: reference not found"What did you expect to happen?
kusion init --online succeeded
How can we reproduce it (as minimally and precisely as possible)?
Run
kusion init --online
, and exit (you can press CTRL+C) when git clone has not get finished.Then run
kusion init --online
again.The text was updated successfully, but these errors were encountered: