-
Notifications
You must be signed in to change notification settings - Fork 13
avoid "Restoring original project mainline states" during "project update" #122
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
Conversation
1df7aaa to
3f8d543
Compare
|
Hm,
Sorry, this is like the parameter |
|
My method |
|
Yes, this was by intention and I tried to describe this in my initial comment and that's exactly the point I wanted to discuss with you. ;) Probably I don't completely get your use case. My assumption was that the SBOM you'll use in --copy-from would be created by CaPyCli from the original project and then be modified as needed by the user - and I also added code to "project createbom" so that created SBOMs now also contain the release-project relation, so that all data is preserved. I can see your point, but on the other hand, I considered it quite unintuitive, if you pass an SBOM to overwrite the releases during the copy process, that the actual release data would be used from SBOM, but the meta data from the existing project. In general, I wonder if it's a good idea to have --copy-from take an SBOM to modify releases at the same time. Perhaps it would be clearer to have a "just copy" operation, followed by "project update" to modify the releases as needed? And the latter should probably than consider current state plus the information in the SBOM, with clearly described priority, but that's also some work to get the implementation right... |
|
@tngraf and me agreed that I will restore the functionality to retain project mainline states and project relations from SW360, but also that the data in the SBOM will have priority if included. Main intended use case here is to run "project --create --copy-from" with an SBOM created fresh by "capycli getdependencies" or from another scanner which doesn't have the project mainline states included. However, if the SBOM contains these details, we shall use it. |
0b76318 to
ed9cc94
Compare
e249cdd to
e87e471
Compare
Existing test case did't trigger get_release_project_mainline_states due to incomplete/wrong JSON response. Also add a new test case for "project create --copy_from".
SW360 REST API loves surprises in JSON encoding. It uses different ways to describe linked releases in request and response bodies. The mocked responses were seemingly copy&pasted from the requests, so they used the wrong structure. This also fixes some copy&paste errors in the release IDs so that `sw360:releases` and `linkedReleases` are consistent. While all of this had no effect on the test cases, it was confusing for me when reading the code.
If args.copy_from is set, data of new project is already available, no need to get_project() again.
08de316 to
9fea462
Compare
|
@tngraf, I now changed the code as discussed to respect the release states provided in the SBOM and maintaining state from SW360 if SBOM doesn't contain information about it. So from my side, this can be merged. Please have a look. :) |
Instead of restoring all release states after project update in a big loop, SW360 REST API also allows to pass full release information during release update. For large projects, this is much faster and avoids timeouts or even crashes due to REST API rate limiting. This also respects states provided in the SBOM which will overwrite existing states. Fixes #121
9fea462 to
a128897
Compare
This changes the release state handling during "project update". Instead of storing project release states from SW360 and restoring it release by release at the end, we pass on full release data to REST API endpoint for updating linked releases.
As an SBOM has to be provided during "project update" or "project create --copy_from" anyways, we take the release states stored in the SBOM instead of keeping the state in SW360.
Note that this requires also the change from sw360/sw360python#41 for correct "project update" support.
Fixes #121