Alizer (which stands for Application Analyzer) is a utility whose goal is to extract information about an application source code. Such information are:
- Programming languages.
- Frameworks.
- Tools used to build the application.
Additionally, Alizer can also select one devfile (cloud workspace file) from a list of available devfiles and/or detect components (the concept of component is taken from Odo and its definition can be read on odo.dev).
The Go CLI can be built with the below command:
$ go build alizer.go
./alizer analyze [OPTION]... [PATH]...
--log {debug|info|warning} sets the logging level of the CLI. The arg accepts only 3 values [`debug`, `info`, `warning`]. The default value is `warning` and the logging level is `ErrorLevel`.
./alizer component [OPTION]... [PATH]...
--log {debug|info|warning} sets the logging level of the CLI. The arg accepts only 3 values [`debug`, `info`, `warning`]. The default value is `warning` and the logging level is `ErrorLevel`.
--no-port-detection if this flag exists then no port detection is applied on the given application. If this flag doesn't exist then we are applying port detection as normal. In case we have both --no-port-detection and --port-detection the --no-port-detection overrides everything.
--port-detection {docker|compose|source} port detection strategy to use when detecting a port. Currently supported strategies are 'docker', 'compose' and 'source'. You can pass more strategies at the same time. They will be executed in order. By default Alizer will execute docker, compose and source.
Deprecation Warning: The --port-detection
flag soon will be deprecated.
./alizer devfile [OPTION]... [PATH]...
--log {debug|info|warning} sets the logging level of the CLI. The arg accepts only 3 values [`debug`, `info`, `warning`]. The default value is `warning` and the logging level is `ErrorLevel`.
--registry strings registry where to download the devfiles. Default value: https://registry.devfile.io
--min-schema-version strings the minimum SchemaVersion of the matched devfile(s). The minimum accepted value is `2.0.0`, otherwise an error is returned.
--max-schema-version strings the maximum SchemaVersion of the matched devfile(s). The minimum accepted value is `2.0.0`, otherwise an error is returned.
To analyze your source code with Alizer, just import it and use the recognizer:
import "github.com/devfile/alizer/pkg/apis/recognizer"
languages, err := recognizer.Analyze("your/project/path")
It detects all components which are found in the source tree where each component consists of:
- Name: name of the component
- Path: root of the component
- Languages: list of languages belonging to the component ordered by their relevance.
- Ports: list of ports used by the component
import "github.com/devfile/alizer/pkg/apis/recognizer"
// In case port detection is needed.
components, err := recognizer.DetectComponents("your/project/path")
// If there is no need for port detection
components, err := recognizer.DetectComponentsWithoutPortDetection("your/project/path")
For more info about name detection, see the name detection doc.
For more info about port detection, see the port detection doc.
It selects a devfile from a list of devfiles (from a devfile registry or other storage) based on the information found in the source tree.
import "github.com/devfile/alizer/pkg/apis/recognizer"
import "github.com/devfile/alizer/pkg/apis/model"
// In case you want specific range of schemaVersion for matched devfiles
devifileFilter := model.DevfileFilter {
MinSchemaVersion: "<minimum-schema-version>",
MaxSchemaVersion: "<maximum-schema-version>",
}
// If you don't want a specific range of schemaVersion values
devfileFilter := model.DevfileFilter{}
// Call match devfiles func
devfiles, err := recognizer.MatchDevfiles("myproject", devfiles, devifileFilter)
Example of analyze
command:
[
{
"Name": "Go",
"Aliases": ["golang"],
"Weight": 94.72,
"Frameworks": [],
"Tools": ["1.18"],
"CanBeComponent": true
}
]
Example of component
command:
[
{
"Name": "spring4mvc-jpa",
"Path": "path-of-the-component",
"Languages": [
{
"Name": "Java",
"Aliases": null,
"Weight": 100,
"Frameworks": ["Spring"],
"Tools": ["Maven"],
"CanBeComponent": true
}
],
"Ports": null
}
]
Example of devfile
command:
[
{
"Name": "nodejs",
"Language": "JavaScript",
"ProjectType": "Node.js",
"Tags": ["Node.js", "Express", "ubi8"]
}
]
This is an open source project open to anyone. This project welcomes contributions and suggestions!
For information on getting started, refer to the CONTRIBUTING instructions.
An Alizer release is created each time a PR having updates on code is merged. You can create a new release here.
- A tag should be created with the version of the release as name.
Alizer
follows thev{major}.{minor}.{bugfix}
format (e.gv0.1.0
) - The title of the release has to be the equal to the new tag created for the release.
- The description of the release is optional. You may add a description if there were outstanding updates in the project, not mentioned in the issues or PRs of this release.
For each release a group of binary files is generated. More detailed we have the following types:
linux/amd64
linux/ppc65le
linux/s390x
windows/amd64
darwin/amd64
In order to download a binary file:
- Go to the release you are interested for
https://github.com/devfile/alizer/releases/tag/<release-tag>
- In the Assets section you will see the list of generated binaries for the release. The names of the binaries are following the template
alizer-{version}-{ostype}-{architecture}
.
Further information for the devfile organization security policy can be found here
If you discover an issue please file a bug, and we will fix it as soon as possible.
Issues are tracked in the devfile/api repo with the label area/alizer