generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 29
feat: obtain Java and Python artifacts from .m2 or Python virtual environment from input #864
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
Merged
tromai
merged 16 commits into
staging
from
811-use-cached-artifacts-instead-of-downloading-them-when-possible
Dec 18, 2024
Merged
feat: obtain Java and Python artifacts from .m2 or Python virtual environment from input #864
tromai
merged 16 commits into
staging
from
811-use-cached-artifacts-instead-of-downloading-them-when-possible
Dec 18, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4c95c95 to
7ac9e54
Compare
7ac9e54 to
0020c0d
Compare
tromai
commented
Dec 4, 2024
tromai
commented
Dec 5, 2024
tromai
commented
Dec 5, 2024
nicallen
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
benmss
reviewed
Dec 9, 2024
tests/integration/cases/docker_local_maven_repo_input_errors/test.yaml
Outdated
Show resolved
Hide resolved
f5a4c66 to
da0f514
Compare
benmss
approved these changes
Dec 12, 2024
nicallen
approved these changes
Dec 12, 2024
…nd improve the unit tests for run_macaron.sh
…emove the behavior of checking one PURL against multiple local artifact repos
…rn values of this feature
…s integration test case
…on3.* directories
65c9014 to
9a1da36
Compare
behnazh-w
approved these changes
Dec 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #811
Description
This pull request adds the following features:
Providing a Maven local repository.
A new CLI parameter is added
--local-maven-repothat takes a path to a maven local repo. This flag is optional.If
--local-maven-repois not used, Macaron will load the path to the local maven repo (at$HOME/.m2) if that directory is available.Macaron will treat this maven local repo as READ-ONLY.
What directory to mount if Macaron is being run as a Docker container?
If
--local-maven-repois provided torun_macaron.sh, the directory provided with this flag is mount to${MACARON_WORKSPACE}/analyze_local_maven_repo_readonly.If
--local-maven-repois NOT provided torun_macaron.sh,run_macaron.shdefault behavior is consistent with Macaron running as a package, regarding loading the default location$HOME/.m2of the host:$HOME/.m2/of the host is not available, an empty directory is created within theoutputdir and mounted as read only to${MACARON_WORKSPACE}/analyze_local_maven_repo_readonly. Then Macaron running within the Docker container will be provided with this empty directory as--local-maven-repo. We do so to avoid Macaron loading$HOME/.m2as maven local repo inside the container, as$HOME/.m2inside the container is being used by the cyclone-dx SBOM generator.$HOME/.m2/of the host is available, it will be mounted to${MACARON_WORKSPACE}/analyze_local_maven_repo_readonly.Providing Python virtual environment as input
This has been implemented in #748.
Resolving artifacts from local repositories for a PackageURL
This is a high-level diagram of finding local artifacts for a PURL
graph LR purl[Input - PackageURL] -->patt_gen{1 - Generating glob patterns} -->patts(artifact dir glob patterns) lrps[Input - Local repository path] patts -->fa{2 - Find artifact dis from local repo path} lrps -->fa fa -->result(Output - list of artifact directories existed within the local repo path.)Generating glob patterns
From a PackageURL, we can directly obtain the glob patterns representing the location of artifact dirs in a local repo. These glob patterns will be different between a maven PURL and a PYPI PURL.
Glob patterns matching on the repo path corresponding to the input PURL's type.
In Macaron (the main's
Analyzerinstance), we will store mappings between a PURL type (e.gmaven) to its corresponding local repo path (if provided by the user). Right now, we only have maximum 2 entries:mavenmaps to the maven local repo pathpypimaps to the python virtual env pathIf the user doesn't provide a local repo path, there will be no entry for it in these mappings.
Using the input PURL's type, we will find the corresponding local repo path from this mapping.
Then we use the glob patterns obtained earlier to look for artifacts within this path. We don't raise error if we cannot find any artifact dir that matches any of the glob patterns.
Storing the discovered artifacts paths
They will be stored in the analyze context instance's
dynamic_dataobject as a list of string.Tasks
--local-maven-repoas CLI option.--local-maven-repointo the container.--local-maven-repo--local-maven-repobehaviordumps-defaultscommand not being handled inrun_macaron.sh