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

Locate and download Prism binary #31796

Merged

Conversation

damondouglas
Copy link
Contributor

@damondouglas damondouglas commented Jul 7, 2024

This PR closes #31402 with a support class that locates, downloads, and prepares the Prism binary.

cc: @lostluck


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@damondouglas damondouglas force-pushed the prism-java-runner-wrapper-resolver branch from 29ea609 to e0a355f Compare July 8, 2024 18:15
@github-actions github-actions bot removed the java label Jul 8, 2024
@damondouglas damondouglas changed the title DRAFT Locate and download Prism binary Locate and download Prism binary Jul 8, 2024
@damondouglas damondouglas marked this pull request as ready for review July 8, 2024 20:30
Copy link
Contributor

github-actions bot commented Jul 8, 2024

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @damccorm added as fallback since no labels match configuration

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

private String resolve(URL from, Path to) throws IOException {
if (from.toString().startsWith(GITHUB_DOWNLOAD_PREFIX)) {
URL shaSumReference = new URL(from + "." + SHA512_EXT);
validateShaSum512(shaSumReference, from);
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this validation get us actually? What vector are we protecting against here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Validates download happened correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not super familiar with the pattern being used here, so this could be me not understanding how this ordering works, but doesn't the actual download happen after this in downloadFn? The way I'm reading this, validateShaSum512 verifies that the remote files match by downloading/comparing, but then downloadFn redownloads it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is still "downloading" as part of the sha verification. Instead of storing the bytes on a temporary file, it just validates from the bytes directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because of the likelihood of downloading a zip or not, it was just easier to keep it separate. It's not that big a file so it doesn't matter. It would be ugly to have to store the bytes then shove it in a file and figure out whether or not to do that when its a zip or not as a source. Honestly, I'm tempted to just remove this validateShaSum method. The goal of this whole PR is just to download the thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

My vote is to not do the sha validation at this stage. It would only apply when downloading GitHub. But we aren't making it consistent this release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it. Thank you @lostluck

@github-actions github-actions bot added java and removed java labels Jul 9, 2024
@github-actions github-actions bot added java and removed java labels Jul 10, 2024
@github-actions github-actions bot added java and removed java labels Jul 10, 2024
@github-actions github-actions bot removed the java label Jul 10, 2024
Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@damondouglas damondouglas merged commit 8d5c3b5 into apache:master Jul 10, 2024
15 checks passed
@damondouglas damondouglas deleted the prism-java-runner-wrapper-resolver branch July 10, 2024 22:47
acrites pushed a commit to acrites/beam that referenced this pull request Jul 17, 2024
* Stage PrismRunner implementation and dependencies

* Locate and download Prism binary

* Sync with head

* Remove redundant check

* Remove sha verification; delete files in test setup

* Remove destination dir; check exists

* Add tests for 404 and tag prefix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task][prism] Have java wrapper check and download released prism binary if available.
3 participants