generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: obtain Java and Python artifacts from .m2 or Python virtual environment from input #864
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 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
oracle-contributor-agreement
bot
added
the
OCA Verified
All contributors have signed the Oracle Contributor Agreement.
label
Sep 17, 2024
tromai
force-pushed
the
811-use-cached-artifacts-instead-of-downloading-them-when-possible
branch
from
September 24, 2024 04:55
4c95c95
to
7ac9e54
Compare
tromai
force-pushed
the
811-use-cached-artifacts-instead-of-downloading-them-when-possible
branch
from
December 3, 2024 23:50
7ac9e54
to
0020c0d
Compare
tromai
changed the title
feat: obtain Java and Python artifacts from .m2 or Python virtual environment from input (WIP)
feat: obtain Java and Python artifacts from .m2 or Python virtual environment from input
Dec 4, 2024
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
tromai
force-pushed
the
811-use-cached-artifacts-instead-of-downloading-them-when-possible
branch
from
December 10, 2024 00:39
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
tromai
force-pushed
the
811-use-cached-artifacts-instead-of-downloading-them-when-possible
branch
from
December 18, 2024 01:43
65c9014
to
9a1da36
Compare
behnazh-w
approved these changes
Dec 18, 2024
tromai
deleted the
811-use-cached-artifacts-instead-of-downloading-them-when-possible
branch
December 18, 2024 04:22
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-repo
that takes a path to a maven local repo. This flag is optional.If
--local-maven-repo
is 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-repo
is provided torun_macaron.sh
, the directory provided with this flag is mount to${MACARON_WORKSPACE}/analyze_local_maven_repo_readonly
.If
--local-maven-repo
is NOT provided torun_macaron.sh
,run_macaron.sh
default behavior is consistent with Macaron running as a package, regarding loading the default location$HOME/.m2
of the host:$HOME/.m2/
of the host is not available, an empty directory is created within theoutput
dir 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/.m2
as maven local repo inside the container, as$HOME/.m2
inside 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
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
Analyzer
instance), 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:maven
maps to the maven local repo pathpypi
maps 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_data
object as a list of string.Tasks
--local-maven-repo
as CLI option.--local-maven-repo
into the container.--local-maven-repo
--local-maven-repo
behaviordumps-defaults
command not being handled inrun_macaron.sh