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

Tool compatibility checks #3632

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

oheger-bosch
Copy link
Member

@oheger-bosch oheger-bosch commented Feb 12, 2021

This PR is related to #3223; it is a preparation for doing more advanced compatibility checks on tool versions as required by scan result storages to check the compatibility of stored scan results.

The PR introduces the following components:

  • A configuration class to define the compatibility of a tool. Tools are currently considered compatible if their name matches a pattern and the version is compatible. Regarding version checks, there are the following options: Semantic version checks based on requirements compatible to NPM version guidelines; calendar versions not older than a configurable time range; arbitrary regular expressions to match versions. Refer to the modified reference.conf for example configurations.
  • An utility class to test tool versions against a compatibility configuration.

The configurations for scan result storages have been updated to support the new compatibility configuration, but this is not yet evaluated; so this should not break existing configurations. When integrating this mechanism into the scan result storages, it is planned to make the compatibility configuration optional and keep the current behavior if it is missing.

Later on, the compatibility configuration is going to be extended to support (command line) options for tools as well.

model/src/main/kotlin/SemanticVersionRange.kt Outdated Show resolved Hide resolved
* date when this version was released. When using such versions, ranges can be constructed that span a specific
* period around a base version; so this would cover releases within a specific time frame.
*/
data class SemanticVersionRange(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you aware of com.vdurmont.semver4j.Requirement, or the various comparison function of Semver, like Semver.diff()? They seem to serve a similar purpose as this new class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at these features, but they did not seem to do quite the thing that was needed. After having a second look, the Requirement class could be a replacement for specifying a minimum and maximum version; the user could rather provide an expression following NPM versioning guides. This would, however, still not handle these delta checks and CalVers.

But do you agree in principle that we should support such kind of configuration as "a version that differs only in the patch level from the scanner used by ORT" or "a CalVer released in a specific time frame to the scanner used by ORT"?

@oheger-bosch oheger-bosch force-pushed the oheger-bosch/scanner/storage_compatibility branch from a62786d to fd7d357 Compare March 5, 2021 07:44
This is a rather generic class to define whether a specific tool in a
concrete version is considered compatible. So far the class allows
specifying the tool name several criteria to check for the tool
version; it is going to be extended later to take command line
arguments into account as well.

The class is going to be used by scan result storages to determine
whether a result produced by a concrete scanner version is compatible
with the current scanner.

Signed-off-by: Oliver Heger <oliver.heger@bosch.io>
Add a ToolCompatibilityMatcher class that is configured with a list of
ToolCompatibilityConfiguration objects. When asked for the
compatibility of a specific tool version the class tries to find a
configuration that applies to this tool and match it against the
criteria specified there.

This concept is rather generic. It is going to be used by scan result
storages to check the compatibility of stored scan results against the
current scanner version.

Signed-off-by: Oliver Heger <oliver.heger@bosch.io>
Each scan storage configuration now contains a list of
ToolCompatibilityConfiguration objects defining acceptance criteria
for specific scanners.

The goal of this change is to move the configuration of the
compatibility of scan results from the scanner options to the
configuration of scan result storages. This is more natural, as this
configuration is actually evaluated by scan result storages when they
are queried for scan results stored for a specific scanner.

Another advantage is an increased flexibility: Acceptance criteria for
scan results can now be configured not only per scanner but per
scanner and scan result storage.

Signed-off-by: Oliver Heger <oliver.heger@bosch.io>
@oheger-bosch oheger-bosch force-pushed the oheger-bosch/scanner/storage_compatibility branch from fd7d357 to 5abe25e Compare March 8, 2021 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants