-
Notifications
You must be signed in to change notification settings - Fork 2k
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 to generate BOM file #22417
Tool to generate BOM file #22417
Conversation
While creating dependency tree for the external BOMs - I came across - https://repo1.maven.org/maven2/com/fasterxml/jackson/jackson-bom/2.11.3/jackson-bom-2.11.3.pom - which uses properties to version control the different dependencies - and it made me think that this is a good way to automatically move all our SDK dependencies to latest core (have the core library version defined as properties in parent POM, and then make all SDKs use that property as the version, shipping core would then entail updating the property and all libraries will automatically pick that up). Any reason - why this approach won't work, should not be used? /cc: @srnagar , @alzimmermsft , @JonathanGiles In reply to: 875680300 In reply to: 875680300 |
ba0f718
to
a0e66c2
Compare
b72d5ad
to
adfd432
Compare
eng/bomgenerator/buildAndRun.cmd
Outdated
set "versioningClientFileLocation=%~dp0..\versioning\version_client.txt" | ||
set "bomPomFileLocation=%~dp0..\..\sdk\boms\azure-sdk-bom\pom.xml" | ||
set "outputFileLocation=%~dp0..\..\sdk\boms\azure-sdk-bom\newpom.xml" | ||
mvn clean install && mvn exec:java -Dexec.args="-inputFile=%versioningClientFileLocation% -outputFile=%outputFileLocation% -pomFile=%bomPomFileLocation%" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity is there a reason you decided to write a java based tool for generating this? Not that it matters too much but most of the other versioning tools are written in python so this would need to duplicate a chunk of that logic. Do we think we should move more of the versioning tooling to java? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were three main reasons 1. I rely on a library shrinkwrap that basically emulates maven assembly resolution to create the dependency map for each library. I also depend on maven reader and writer library which is again available for java. (I believe there are solutions that can call java methods from python directly but I did not delve into that much) 2. This can in future become a plug-in and be part of a build step. 3. My vested interest in getting more comfy in Java.
When you say duplication of code - do you mean parsing the files and versions etc, or other things too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we think we should move more of the versioning tooling to java?
This is a tough one. I see why python is the language of choice here? But at the same time for scenarios like BOM having things in java and reuse library\solutions from the ecosystem is beneficial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the context. I don't have an issue with this, especially if this becomes a plugin and produced as part of the maven build.
The duplication I was thinking about is the parsing and understanding of our version files. It isn't overly complicated but there are some interesting rules in there to understand dependency vs current versions as well as our unreleased/beta versions.
One of the biggest reason we use things like python and powershell scripts for our versioning and other engsys tasks is to avoid needing to do a restore and build step before using the tool. Interpreted languages are much better suited for those type of tasks. For that reason it might be kind of difficult to implement all the versioning rules in a java based tool, at least one that lives in this repo. If we did use a java tool for these type of things I'd suggest we move the building/publishing of that tool into another repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @srnagar also said having a plugin which lived in a repo like azure-sdk would be a better place to put this. How about I make this the first step and use it to polish the tool a little and once it is mature and ready to be turned into a plugin, I can move it a more suited location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the biggest reason we use things like python and powershell scripts for our versioning and other engsys tasks is to avoid needing to do a restore and build step before using the tool. Interpreted languages are much better suited for those type of tasks.
I did not think of this .. thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do end up putting this in another repo the right place for it would be https://github.com/Azure/azure-sdk-tools/tree/main/tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :)
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/Main.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/Main.java
Outdated
Show resolved
Hide resolved
BomGenerator() { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed #Resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyVersionComparator.java
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/BomGenerator.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
|
||
private void makeDependencyInEligible(BomDependency dependency) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add logs to indicate why dependencies are marked as ineligible. #Pending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have a work-item to add better logging\reporting in the system.
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyAnalyzer.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/Utils.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/BomGenerator.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/BomGenerator.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/BomGenerator.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/BomGenerator.java
Outdated
Show resolved
Hide resolved
return this.bomEligibleDependencies; | ||
} | ||
|
||
public Boolean validate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this return Boolean
when the method call value it is returning is boolean
?
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyComparator.java
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/Main.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/models/BomDependencyNoVersion.java
Show resolved
Hide resolved
00e822b
to
07b0a5e
Compare
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyComparator.java
Show resolved
Hide resolved
Incorporate all PR comments
07b0a5e
to
adabb89
Compare
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/BomGenerator.java
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/Utils.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/Utils.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyAnalyzer.java
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyAnalyzer.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyAnalyzer.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyAnalyzer.java
Outdated
Show resolved
Hide resolved
eng/bomgenerator/src/main/java/com/azure/tools/bomgenerator/DependencyAnalyzer.java
Show resolved
Hide resolved
Thank you for the feedback, |
The tool generates the BOM in the following way:
TODO: