konveyor / move2kube-api

HTTP REST API for move2kube
https://move2kube.konveyor.io/
Apache License 2.0
6 stars 18 forks source link

feat: Add support for enabling and disabling QA category to Move2Kube API #162

Open Akash-Nayak opened 7 months ago

Akash-Nayak commented 7 months ago

Added feature requested in https://github.com/konveyor/move2kube/issues/1155, https://github.com/konveyor/move2kube/issues/1151#issuecomment-1993816895

Currently, Move2Kube API doesn't have support for --qa-enable and --qa-disable flags, which are supported by Move2Kube CLI.

Screenshot 2024-03-15 at 7 25 46 PM

Now, Move2Kube API will also support enabling/disabling QA category, similar to how the Move2Kube CLI allows for enabling/disabling the QA category using --qa-disable and --qa-enable flags.

Screenshot 2024-03-15 at 5 56 28 PM

Disabling QA category/categories

For example, to disable the questions from the transformers, network and sourceanalyzer categories-

Screenshot 2024-03-15 at 6 19 21 PM

Move2Kube only asks the questions from the categories that are not disabled. So, in this case it directly ask the question from imageregistry category as the transformers, sourceanalyzer and network categories are disabled.

Screenshot 2024-03-15 at 6 16 44 PM

It can also be done using the curl command in multiple ways.

$ curl -X 'POST' \
  'http://localhost:8080/api/v1/workspaces/{workspace-id}/projects/{project-id}/outputs?skip-qa=false&disable-qa-category=transformers,network,sourceanalyzer' \  
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d ''
$ curl -X 'POST' \
  'http://localhost:8080/api/v1/workspaces/{workspace-id}/projects/{project-id}/outputs?skip-qa=false&disable-qa-category=transformers&disable-qa-category=network&disable-qa-category=sourceanalyzer' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d ''
$ curl -X 'POST' \
  'http://localhost:8080/api/v1/workspaces/{workspace-id}/projects/{project-id}/outputs?skip-qa=false&disable-qa-category=transformers%2Cnetwork%2Csourceanalyzer' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d ''

Enabling QA category/categories

For example, to enable the questions only from the cicd category-

Screenshot 2024-03-15 at 6 35 40 PM

Move2Kube transform straightaway skips all the questions that belong to the categories other than the enabled category (cicd in this case).

Screenshot 2024-03-15 at 6 36 48 PM

This can also be done using the curl command.

$ curl -X 'POST' \
  'http://localhost:8080/api/v1/workspaces/d5d1883e-85b4-47f3-a7f1-fb8f47a55566/projects/87d5b97b-2002-488a-af21-2054c089da55/outputs?skip-qa=false&enable-qa-category=cicd' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d ''

To enable this support, I have also updated the QA engine of Move2Kube- https://github.com/konveyor/move2kube/pull/1156

Signed-off-by: Akash Nayak akash19nayak@gmail.com

github-actions[bot] commented 7 months ago

Thanks for making a pull request! 😃 One of the maintainers will review and advise on the next steps.

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 14.48%. Comparing base (09e78d0) to head (1d94cbe).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #162 +/- ## ======================================= Coverage 14.48% 14.48% ======================================= Files 2 2 Lines 214 214 ======================================= Hits 31 31 Misses 179 179 Partials 4 4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.