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

Bdio 2 #85

Merged
merged 7 commits into from Dec 2, 2019
Merged

Bdio 2 #85

merged 7 commits into from Dec 2, 2019

Conversation

JakeMathews
Copy link
Contributor

Added support for bdio 2 in Detect. There are a lot of changes here which mostly pertain to upgrading the version of integration-bdio we are using. We will generate bdio 2 but not upload it in 6.1.0 of Detect.

@JakeMathews
Copy link
Contributor Author

Will be adding tests soon.

@blackduck-copilot
Copy link

blackduck-copilot bot commented Nov 21, 2019

Black Duck Security Report

Branch master has no Black Duck results, and could not be compared to #85. Analyze branch master to get a change comparison.

Removed Components

High Risk: 1
Medium Risk: 1
Clean: 96

Click here to see full report

final Bdio2Document bdio2Document = bdio2Factory.createBdio2Document(bdioMetadata, bdio2Project, dependencyGraph);

final Bdio2Writer bdio2Writer = new Bdio2Writer();
final File bdio2OutputFile = new File(bdioOutput, bdioCodeLocation.getBdioName() + ".bdio");

Choose a reason for hiding this comment

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

This .bdio file would be a zip file, the Blackduck endpoint for Polaris is good to consume chunks of the data and not the whole zip file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can Polaris consume the zipped .bdio format?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are currently planning to only output the .bdio archive for now. If this is a problem for Polaris we need to reconsider our approach.

final File bdio2OutputFile = new File(bdioOutput, bdioCodeLocation.getBdioName() + ".bdio");
try {
final OutputStream outputStream = new FileOutputStream(bdio2OutputFile);
bdio2Writer.writeBdioDocument(outputStream, bdio2Document);
Copy link

Choose a reason for hiding this comment

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

Some questions:

  • Is chunking supported?
  • Is this file an archive of multiple files (including the header and one or more entries)?
  • Have you tried uploading the old generated BDIO1 and the new generated BDIO2 documents (against the same repo target) and confirmed the results and relationships are the same?
  • Is it possible to dry-run the BDIO2 contents to disk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Not for 6.1.0. That is coming later.
  2. Yes it is an archive with the .bdio file extension.
  3. Yes and results were the same.
  4. For 6.1.0 Detect can only generate bdio in offline mode, and in that mode files from the run are preserved on the disk. When we support bdio 2 in online mode the user can also set detect.cleanup=false to have the files persist.

Choose a reason for hiding this comment

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

Thanks. For SCA on Polaris, the intent will be for the Polaris CLI to drive Detect dependency scans with output of the BDIO2 header and chunked entry files. For standalone Black Duck, the system primarily has accepted start mode header, multiple chunk additions, and a completion message. The archive has primarily been for generic download/upload via the UI, but we don't have any clients using this mechanism right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The BDIO library (https://github.com/blackducksoftware/bdio) currently has no implementation of a StreamSupplier other than a BdioFile (https://github.com/blackducksoftware/bdio/blob/1cd704a24ee2affbf03b635e3e41d5be8b2fd329/bdio2/src/main/java/com/blackducksoftware/bdio2/BdioWriter.java#L74). If another implementation of StreamSupplier was implemented that only outputs the header and chunked entries instead of an archive, we could use that.

Choose a reason for hiding this comment

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

@JakeMathews @ketul-shukla, can you get together with Jake to better understand this mechanism? Currently, we are definitely chunking BDIO2 files internally. What is the library mechanism to support this type of structure?

@JakeMathews JakeMathews merged commit 7b9a4c9 into master Dec 2, 2019
@JakeMathews JakeMathews deleted the bdio-2 branch December 2, 2019 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants