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

No feedback when error occur during planning execution #159

Closed
gabriel-farache opened this issue Mar 12, 2024 · 12 comments
Closed

No feedback when error occur during planning execution #159

gabriel-farache opened this issue Mar 12, 2024 · 12 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects

Comments

@gabriel-farache
Copy link
Contributor

Describe the bug
When the plan command fails, there is no status change nor feedback given to the user; when getting the plan via the API, we still get 204 response code instead of an error

To Reproduce
Steps to reproduce the behavior:

  1. Create a workspace and a project
  2. Start a plan via the API with invalid input with remote source, ie: wrong url so the plan will fail
    Command executed should be similar to plan --name a --plan-progress-port 32881 --log-file m2kcli.log --source git+ssh://bitbucket.com/gfarache31/m2k-test@master --disable-local-execution
  3. Check the logs to see the error, something similar to:
time="2024-03-12T09:47:17Z" level=info msg="plan cmdArgs: [plan --name a --plan-progress-port 32881 --log-file m2kcli.log --source git+ssh://bitbucket.com/gfarache31/m2k-test@master --disable-local-execution]"
time="2024-03-12T09:47:17Z" level=info msg="Project: 4a3d44ae-ba55-49b9-ae67-9b0b6d66640e; level=info msg=\"Cloning the repository using git into '/tmp/move2kube3232420242/m2ksources' . This might take some time.\""
time="2024-03-12T09:47:18Z" level=info msg="Project: 4a3d44ae-ba55-49b9-ae67-9b0b6d66640e; level=fatal msg=\"failed to create the plan. Error: \\\"failed to clone the repo 'git+ssh://bitbucket.com/gfarache31/m2k-test@master'. Error: failed to clone using vcs url 'git+ssh://bitbucket.com/gfarache31/m2k-test@master' and clone options {CommitDepth:1 Overwrite:true MaxSize:-1 CloneDestinationPath:/tmp/move2kube3232420242/m2ksources}. Error: failed to perform clone operation using git. Error: repository already exists\\\"\""
time="2024-03-12T09:47:18Z" level=error msg="failed to update the database after planning finished. Error: \"failed to copy the plan file from /tmp/plan-4a3d44ae-ba55-49b9-ae67-9b0b6d66640e-4058952779/m2k.plan to /move2kube-api/data/projects/4a3d44ae-ba55-49b9-ae67-9b0b6d66640e/inputs/expanded/m2k.plan after planning finished. Error: \\\"failed to open the source file at path \\\\\\\"/tmp/plan-4a3d44ae-ba55-49b9-ae67-9b0b6d66640e-4058952779/m2k.plan\\\\\\\" Error: \\\\\\\"open /tmp/plan-4a3d44ae-ba55-49b9-ae67-9b0b6d66640e-4058952779/m2k.plan: no such file or directory\\\\\\\"\\\"\""
  1. Send a GET request to the plan and see you have a 204 response code instead of a 5XX one as the planning has failed

Expected behavior
I expect that plan status to change to failed or similar and to be able to get the error information via the API (maybe not the full reason but at least that it failed)

Screenshots
N/A

Desktop (please complete the following information):

  • OS: [e.g. iOS] Fedora
  • Browser [e.g. chrome, safari] chrome
  • Version [e.g. 22] v0.3.11

Additional context
Related to konveyor/move2kube-ui#169

@rgolangh
Copy link
Contributor

@ashokponkumar any chance this bug will be handled?

@ashokponkumar
Copy link
Member

@seshapad @HarikrishnanBalagopal Any thoughts on a fix for this issue?

@gabriel-farache
Copy link
Contributor Author

FYI, it appears that the logs in the log file m2kcli.log are the same as the one in the output
So the issue may come from the move2kube CLI itself

@gabriel-farache
Copy link
Contributor Author

The weird error originates from here https://github.com/konveyor/move2kube/blob/main/common/vcs/git.go#L260
Here, m2k is retrying to clone the repo but not on the target branch directly but the directory is not cleaned so it appears the directory that should have host/contained the cloned repository was created so when we try to clone again, it fails because a folder with the same name already exists.

By setting the loc to Warning instead of Debug I see the follwing log:

time="2024-07-05T14:58:48Z" level=info msg="Project: 80cc87ba-5c30-42ac-ac79-e9ad29bf9237; level=info msg=\"failed to clone the given branch 'masters': \\\"couldn't find remote ref \\\\\\\"refs/heads/masters\\\\\\\"\\\" . Will clone the entire repo and try again.\""

which confirm my above assumption.

I'll create a PR to clean the folder and to better log what is happening

@ashokponkumar
Copy link
Member

Thanks @gabriel-farache . Please let us know when the PR is ready for review

@gabriel-farache
Copy link
Contributor Author

@ashokponkumar My PR is ready for review, please let me know your feedback.

@gabriel-farache
Copy link
Contributor Author

@ashokponkumar do you know when a new release with the fixes can be released?

@ashokponkumar
Copy link
Member

@ashokponkumar do you know when a new release with the fixes can be released?

@HarikrishnanBalagopal @seshapad Can we please trigger a new release?

@HarikrishnanBalagopal
Copy link
Contributor

@ashokponkumar do you know when a new release with the fixes can be released?

@HarikrishnanBalagopal @seshapad Can we please trigger a new release?

Have triggered a new release.

@gabriel-farache
Copy link
Contributor Author

@HarikrishnanBalagopal Thank you! Now I see a v0.3.14-rc.0 tag in quay, should I use this or should I wait for the v0.3.14?

@gabriel-farache
Copy link
Contributor Author

@HarikrishnanBalagopal @ashokponkumar Any update on the release? Thx :)

@HarikrishnanBalagopal
Copy link
Contributor

@HarikrishnanBalagopal Thank you! Now I see a v0.3.14-rc.0 tag in quay, should I use this or should I wait for the v0.3.14?

@gabriel-farache yes please go ahead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
Development

No branches or pull requests

5 participants