-
Notifications
You must be signed in to change notification settings - Fork 169
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
feat: implement scripts for binary release build #932
Conversation
@andygrove FYI. This will build an uber jar but does not have the script to deploy. That script can be a different PR. |
MacOS build hits this - BLAKE3-team/BLAKE3#180. Will try the suggested solutions. |
dev/release/build-release-comet.sh
Outdated
-t "comet-rm:$IMGTAG" \ | ||
--build-arg HAS_MACOS_SDK=${HAS_MACOS_SDK} \ | ||
--build-arg MACOS_SDK=${MACOS_SDK} \ | ||
--load \ |
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 had to make this change to get this to work (or at least get further along) on linux, based on the comment at docker/buildx#59 (comment).
--load \ | |
--push \ |
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.
The next issue I hit was:
------
> exporting to image:
------
ERROR: failed to solve: failed to push comet-rm:latest: push access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Cleaning up ...
Error response from daemon: No such container: comet-arm64-builder-container
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.
--push
will try to push to docker hub and we don't want to do that since this is a temporary image. --load
will load into your local containerd store but it that does not work for you then let me look for a workaround for this.
@andygrove I changed the script to build a different image for each architecture instead of a single multi-arch image. It makes things much simpler at the cost of having multiple images (and a small increase in building time). It also removes the need to have the local container store and will also work with a custom docker backend as long as the backend supports |
@andygrove @viirya For the binary builder I chose to use Ubuntu 20.04 as the base image because that is the image we currently use for our published docker images. Should we consider using an older version of Ubuntu? |
Hmm, I think for OSS Comet we don't have the restriction on supported glibc for platform compatibility. Glibc 2.31 seems to be released on 2020. I think it is old enough for the compatibility of our binary release. For example, Centos 7 is already EOL (https://blog.centos.org/2023/04/end-dates-are-coming-for-centos-stream-8-and-centos-linux-7/) Ubuntu 20.04 looks like a reasonable choice. I personally wouldn't want to spend too much efforts on resolving issues on building on older versions of Ubuntu. |
I ran the scripts locally and they seem to have worked. I ran this command:
The resulting jar file contains the following native libs:
|
The artifact
seems to be a leftover from a manual run. The script will not prepare macos binaries at the moment. |
@andygrove thank you for testing! This is ready for review. |
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.
LGTM. Thanks @parthchandra!
endif | ||
|
||
# build native libs for arm64 architecture Linux/MacOS on a Linux/arm64 machine/container | ||
core-arm64-libs: |
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 are two core-arm64-libs
targets?
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.
Removed.
Makefile
Outdated
ifdef $(HAS_OSXCROSS) | ||
cd native && cargo zigbuild -j 1 --target aarch64-apple-darwin --release | ||
endif | ||
cd native && cargo build -j 2 --release |
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.
So for MacOSX build, we need to run both cargo zigbuild
and cargo build
?
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.
Oops. This was a mistake. I experimented with zigbuild for macos. Removed
Makefile
Outdated
# build native libs for arm64 architecture Linux/MacOS on a Linux/arm64 machine/container | ||
core-arm64-libs: | ||
# if the environment variable HAS_OSXCROSS is defined | ||
ifdef $(HAS_OSXCROSS) |
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 need MacOS X SDK installed for HAS_OSXCROSS case?
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 part is a placeholder for future work to enable MacOS. MacOS Sdk has to be provided to the Docker file as input and the build-release-comet script will copy it into the release builder's Docker image.
I removed the option because the build did not succeed but left the work so we can fix this later. I can remove it if it makes things clearer.
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
ARG HAS_MACOS_SDK="false" |
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.
https://hub.docker.com/r/messense/cargo-zigbuild claims they have MacOS X SDK pre-installed in their docker image. Can we reuse it to use MacOS X SDK for Comet build?
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 did not try the docker image from zigbuild (yet). I will try it and if it works, then we can remove the HAS_OSXCROSS portions entirely.
Follow up issue: #947
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 tried the zigbuild docker image and the build failed. I'll investigate the failure in the followup.
@viirya Any further comments? |
@@ -46,6 +46,22 @@ format: | |||
./mvnw compile test-compile scalafix:scalafix -Psemanticdb $(PROFILES) | |||
./mvnw spotless:apply $(PROFILES) | |||
|
|||
# build native libs for amd64 architecture Linux/MacOS on a Linux/amd64 machine/container | |||
core-amd64-libs: | |||
cd native && cargo build -j 2 --release |
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.
Don't we need to specify target
for this?
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 will build the binary for the same architecture as the machine. So no need to specify target.
ifdef HAS_OSXCROSS | ||
rustup target add x86_64-apple-darwin | ||
cd native && cargo build -j 2 --target x86_64-apple-darwin --release | ||
endif |
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.
So as the L51 is not in an else
block, if HAS_OSXCROSS
is true, we will build the library for x86_64-apple-darwin additionally? I.e., two libraries for core-amd64-libs
?
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. For the amd64 architecture, one for linux and one for MacOS
./mvnw "-Dmaven.repo.local=${LOCAL_REPO}" -P spark-3.5 -P scala-2.13 -DskipTests install | ||
|
||
echo "Installed to local repo: ${LOCAL_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.
Do we need to remove the created docker image/container after installation?
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.
The container is removed in the cleanup part of the script which is invoked on exit or error.
Looks good to me, with a few minor questions. |
Which issue does this PR close?
Closes #721
Rationale for this change
Allows us to publish artifacts to maven
What changes are included in this PR?
Scripts, and Dockerfile to do the binary build in a docker container and include them in an uber jar
How are these changes tested?
Locally.