beam icon indicating copy to clipboard operation
beam copied to clipboard

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

Open lostluck opened this issue 1 year ago • 2 comments

The binary zips we're putting up in GitHub release artifacts will be at URLs with the following pattern.

http://github.com/apache/beam/releases/download/RELEASE/apache_beam-RELEASE-prism-OS-ARCH.zip

This issue is the sibling to #31403.

This is with the full release version that matches the release tag. That is for version 2.57.0, the tag is v2.57.0.

Since we're building with Go os and architecture tags, we may need to translate however we detect those to match the Go build terms.

OS: windows linux darwin ARCH: amd64 arm64

darwin is the Mac/OSX version.


Detecting these in Java is pretty straight forward.

OS:

https://stackoverflow.com/questions/228477/how-do-i-programmatically-determine-operating-system-in-java

It boils down to System.getProperty("os.name") and do some processing to convert to the values we need.

Architecture would be with the os.arch property, and similar processing: with the important values being "AArch64" and "x86" for our immeadiate purposes.


We can write the file out as a zip file, and then read it in with https://docs.oracle.com/javase/8/docs/api/java/util/zip/ZipFile.html. Though there's probably a way to use the input stream directly so we only need to save the unpacked binary.


Making a http request in Java without extra library's appears to be https://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java

lostluck avatar May 24 '24 22:05 lostluck

@lostluck Is the intent for when a release becomes available, the untagged-<commit> will convert to <release-tag>? For example, https://github.com/apache/beam/releases/download/v2.57.0/apache_beam-v2.57.0-prism-linux-amd64.zip resulted in a 404 while https://github.com/apache/beam/releases/download/untagged-dadf35fc62aedc91ebcb/apache_beam-v2.57.0-prism-linux-amd64.zip worked.

damondouglas avatar Jun 25 '24 21:06 damondouglas

Nevermind. I realized that it is a draft release.

damondouglas avatar Jun 26 '24 02:06 damondouglas