Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add examples to readme
Browse files Browse the repository at this point in the history
eemcmullan committed Sep 14, 2023
1 parent 4a12b5c commit 7f95e1a
Showing 1 changed file with 59 additions and 7 deletions.
66 changes: 59 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@
Kantra is an experimental CLI that unifies analysis and transformation capabilities of Konveyor.

## Installation
### Linux
The easiest way to install Kantra is to get it via the container image. To download latest container image, run:

Easiest way to install Kantra is to get it via the container image. To download latest container image, run:
### Linux

```sh
podman pull quay.io/konveyor/kantra:latest && podman run --name kantra-download quay.io/konveyor/kantra:latest 1> /dev/null 2> /dev/null && podman cp kantra-download:/usr/local/bin/kantra . && podman rm kantra-download
@@ -25,12 +25,19 @@ Ensure that we use the connection to the VM `<vm_name>` we created earlier by de
podman system connection default <vm_name>
```


```sh
podman pull quay.io/konveyor/kantra:latest && podman run --name kantra-download quay.io/konveyor/kantra:latest 1> /dev/null 2> /dev/null && podman cp kantra-download:/usr/local/bin/darwin-kantra kantra && podman rm kantra-download
```

This will copy the binary into your current working directory. To make it available system-wide, run:
### Windows

```sh
podman pull quay.io/konveyor/kantra:latest && podman run --name kantra-download quay.io/konveyor/kantra:latest 1> /dev/null 2> /dev/null && podman cp kantra-download:/usr/local/bin/windows-kantra kantra && podman rm kantra-download
```

---

The above will copy the binary into your current directory. Move it to PATH for system-wide use:

```sh
sudo mv ./kantra /usr/local/bin/
@@ -70,7 +77,7 @@ Use "kantra [command] --help" for more information about a command.

### Analyze

Analyze allows running source code and binary analysis using analyzer-lsp.
Analyze allows running source code and binary analysis using [analyzer-lsp](https://github.com/konveyor/analyzer-lsp)

To run analysis on application source code, run:

@@ -90,6 +97,7 @@ Flags:
--analyze-known-libraries analyze known open-source libraries
-h, --help help for analyze
-i, --input string path to application source code or a binary
--json-output create analysis and dependency output as json
--list-sources list rules for available migration sources
--list-targets list rules for available migration targets
-m, --mode string analysis mode. Must be one of 'full' or 'source-only' (default "full")
@@ -129,7 +137,7 @@ Use "kantra transform [command] --help" for more information about a command.

#### OpenRewrite

`openrewrite` subcommand allows running OpenRewrite recipes on source code.
`openrewrite` subcommand allows running [OpenRewrite](https://docs.openrewrite.org/) recipes on source code.


```sh
@@ -157,7 +165,7 @@ kantra transform openrewrite --input=<path/to/source/code> --target=<exactly_one

#### Rules

`rules` subcommand allows converting Windup XML rules to analyzer-lsp YAML rules.
`rules` subcommand allows converting Windup XML rules to analyzer-lsp YAML rules using [windup-shim](https://github.com/konveyor/windup-shim)

```sh
Convert XML rules to YAML
@@ -180,6 +188,50 @@ To run `transform rules` on application source code, run:
kantra transform rules --input=<path/to/xmlrules> --output=<path/to/output/dir>
```

## Quick Demos

Once you have kantra installed, these examples will help you run both an
analyze and a transform command.

### Analyze

- Get the example application to run analysis on
`git clone https://github.com/konveyor/example-applications`

- List available target technologies
`kantra analyze --list-targets`

- Run analysis with a specified target technology
`kantra analyze --input=<path-to/example-applications/example-1> --output=<path-to-output-dir> --target=cloud-readiness`

- Several analysis reports will have been created in your specified output path:

```sh
$ ls ./output/ -1
analysis.log
dependencies.yaml
dependency.log
output.yaml
static-report
```

`output.yaml` is the file that contains issues report.
`static-report` contains the static HTML report.
`dependencies.yaml`contains a dependencies report.

### Transform

- Get the example application to transform source code
`git clone https://github.com/ivargrimstad/jakartaee-duke`

- View available OpenRewrite recipes
`kantra transform openrewrite --list-targets`

- Run a recipe on the example application
`kantra transform openrewrite --input=<path-to/jakartaee-duke> --target=jakarta-imports`

- Inspect the `jakartaee-duke` application source code diff to see the transformation


## Code of Conduct
Refer to Konveyor's Code of Conduct [here](https://github.com/konveyor/community/blob/main/CODE_OF_CONDUCT.md).

0 comments on commit 7f95e1a

Please sign in to comment.