-
Notifications
You must be signed in to change notification settings - Fork 9
Add compilation of python schema and service libraries #114
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
Merged
karenyrx
merged 49 commits into
opensearch-project:main
from
finnegancarroll:rules-proto-grpc-min-4.5
Jul 26, 2025
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
034811d
Add python rules and dependencies.
finnegancarroll 36d620b
Add python headers and disable upd.
finnegancarroll 285bd16
Upd exclusion does not work - Path error.
finnegancarroll e3f189a
Update Dockerfile.
finnegancarroll 2df5f64
Move back to proto rule_python per:https://groups.google.com/g/grpc-i…
finnegancarroll e8a97fe
Add user to dockerfile so we can build non root.
finnegancarroll 4121232
STASH - Disable java build - Pip install proto deps. Issue: https://g…
finnegancarroll 23ed744
Bump rules_proto - May need to bump bazel.
finnegancarroll 1df228b
Change rules_proto version to more stable release. Minimal python exa…
finnegancarroll 2cce6cd
STASH - Failing on go_register_toolchains again. Just patched apple.
finnegancarroll e28c103
Update patches simplify build - Don't use rules_proto_grpc.
finnegancarroll 1698f13
Min example given by rules-proto-grpc 4.5.
finnegancarroll 4dc8833
Typo.
finnegancarroll 5eb4f2d
Generate schema python files from proto
finnegancarroll 00577af
Attempt gRPC document service compile.
finnegancarroll 5001af6
Fixed proto 3.19 bug by disabling bazelmod.
finnegancarroll 9031b48
Update absail - Still failing. Proto version fixed.
finnegancarroll 907eff9
Revert rules_proto_grpc_python_repos ordering. Needs to be last.
finnegancarroll c2c3329
WORKING PYTHON MINIMAL EXAMPLE - SCHEMA + GRPC.
finnegancarroll 85c5d31
Remove unnecessary bindings. PYTHON COMPILES.
finnegancarroll eed1a87
Clean up additional deps.
finnegancarroll ae7de23
Add back in java schema compilation.
finnegancarroll 49a4ecf
Add java grpc deps - Maven.
finnegancarroll 0f2a4a4
Add python search service. Add java document service.
finnegancarroll c67e122
Remove commented code.
finnegancarroll dd57777
Add java search service.
finnegancarroll 931ceed
Fix permission issues for bazeluser in Dockerfile.
finnegancarroll 3990532
Update jar name for generate_java script.
finnegancarroll 819081f
Update dockerfile - remove bazel version.
finnegancarroll fc61a31
Changelog.
finnegancarroll 49b5898
Update java source file names to match new library rule.
finnegancarroll e2f9bb0
Remove unnecessary deps from dockerfile.
finnegancarroll 6c61e5c
Remove unused guava/jsr bazel java imports.
finnegancarroll 2166aed
Set bazelmod disabled flag as default.
finnegancarroll 30056ab
Remove notes from dockerfile.
finnegancarroll d1115e3
Add test stage for running OS grpc UT/ITs with compiled proto.
finnegancarroll 05d2f29
Fix OS clone path - Permission issue for running OS.
finnegancarroll 9c16267
Add maven local flag in test stage.
finnegancarroll 304d675
Dockerfile test stage update OpenSearch os protos dependency to snaps…
finnegancarroll 8feb517
Newline end of Dockerfile.
finnegancarroll ce529c6
Split python and java stages in docker & CI.
finnegancarroll 953e7a3
Update dev guide build commands.
finnegancarroll 1333b30
Remove package_proto_jar.sh diff.
finnegancarroll 29bab09
Changelog.
finnegancarroll 66f1616
EOF newlines for git.
finnegancarroll f72b086
Java example in doc to java_protos_all.
finnegancarroll 537ab24
Remove gRPC build system patch - Update rules_apple to include patch …
finnegancarroll a0c3674
Remove rules_go patch. Neglect to load toolchain but pin updated vers…
finnegancarroll 9b7800a
Changelog.
finnegancarroll File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 5.4.1 | ||
| 7.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: Build OpenSearch Protobufs PYTHON Artifacts | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build-protobufs-python: | ||
| runs-on: ubuntu-latest | ||
| if: github.repository == 'opensearch-project/opensearch-protobufs' | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin # Temurin is a distribution of adoptium | ||
| java-version: 21 | ||
| - name: build protobufs python | ||
| run: bazel build //:python_protos_all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,25 @@ | ||
| # protos/BUILD.bazel | ||
| load("@rules_java//java:defs.bzl", "java_proto_library") | ||
| load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library") | ||
|
|
||
| package(default_visibility = ["//visibility:public"]) | ||
|
|
||
| # Java proto library | ||
| java_proto_library( | ||
| name = "protos_java", | ||
| deps = [ | ||
| "//protos/services:document_service_proto", | ||
| "//protos/services:search_service_proto" | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| # Java gRPC library | ||
| java_grpc_library( | ||
| name = "document_service_grpc_java", | ||
| srcs = ["//protos/services:document_service_proto"], | ||
| deps = [":protos_java"], | ||
| java_library( | ||
| name = "java_protos_all", | ||
| visibility = ["//visibility:public"], | ||
| exports = [ | ||
| "//protos/schemas:common_java_proto", | ||
| "//protos/schemas:document_java_proto", | ||
| "//protos/schemas:search_java_proto", | ||
| "//protos/services:document_service_java_proto", | ||
| "//protos/services:search_service_java_proto", | ||
| ], | ||
| ) | ||
|
|
||
| java_grpc_library( | ||
| name = "search_service_grpc_java", | ||
| srcs = ["//protos/services:search_service_proto"], | ||
| deps = [":protos_java"], | ||
| py_library( | ||
| name = "python_protos_all", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//protos/schemas:common_python_proto", | ||
| "//protos/schemas:document_python_proto", | ||
| "//protos/schemas:search_python_proto", | ||
| "//protos/services:document_service_python_proto", | ||
| "//protos/services:search_service_python_proto", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| FROM ubuntu:22.04 AS base-bazel | ||
|
|
||
| ENV BAZEL_VERSION=7.0.0 | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| curl \ | ||
| git \ | ||
| zip \ | ||
| unzip \ | ||
| openjdk-21-jdk \ | ||
| maven \ | ||
| g++ \ | ||
| gcc \ | ||
| && apt-get clean | ||
|
|
||
| RUN apt-get install software-properties-common -y | ||
| RUN add-apt-repository ppa:deadsnakes/ppa -y | ||
| RUN apt-get install python3.10 python3.10-dev -y | ||
|
|
||
| RUN curl -fsSL https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh -o bazel-installer.sh \ | ||
| && chmod +x bazel-installer.sh \ | ||
| && ./bazel-installer.sh \ | ||
| && rm bazel-installer.sh | ||
|
|
||
| RUN bazel --version | ||
|
|
||
| FROM base-bazel AS build-bazel | ||
|
|
||
| # Run as non-root - Required for rules_python | ||
| # See: https://github.com/bazelbuild/rules_python/pull/713 | ||
| # Create group and user | ||
| RUN groupadd -r bazeluser && useradd -r -m -g bazeluser bazeluser | ||
| RUN mkdir -p /build && \ | ||
| chown -R bazeluser:bazeluser /build && \ | ||
| chmod -R 777 /build | ||
|
|
||
| USER bazeluser | ||
| WORKDIR /build | ||
|
|
||
| # Copy entire repository for convenience | ||
| # Invalidate cache to ensure updates are captured | ||
| ARG CACHEBUST=1 | ||
| COPY --chown=bazeluser:bazeluser . . | ||
|
|
||
| ################################################# | ||
| ##### JAVA STAGES ############################### | ||
| ################################################# | ||
|
|
||
| FROM build-bazel AS build-bazel-java | ||
|
|
||
| RUN bazel build //:java_protos_all | ||
|
|
||
| FROM build-bazel-java AS package-bazel-java | ||
|
|
||
| RUN /build/tools/java/package_proto_jar.sh | ||
|
|
||
| FROM package-bazel-java AS test-bazel-java | ||
|
|
||
| ARG OPENSEARCH_BRANCH=main | ||
| ARG PROTO_SNAPSHOT_VERSION=0.4.0 | ||
|
|
||
| ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 | ||
| ENV PATH=$PATH:$JAVA_HOME/bin | ||
| ENV PUB_ARTIFACTS=/build/generated/maven/publish/ | ||
|
|
||
| RUN mvn install:install-file \ | ||
| -Dfile=${PUB_ARTIFACTS}protobufs-${PROTO_SNAPSHOT_VERSION}-SNAPSHOT.jar \ | ||
| -DpomFile=${PUB_ARTIFACTS}protobufs-${PROTO_SNAPSHOT_VERSION}-SNAPSHOT.pom \ | ||
| -Dsources=${PUB_ARTIFACTS}protobufs-${PROTO_SNAPSHOT_VERSION}-SNAPSHOT-sources.jar \ | ||
| -Djavadoc=${PUB_ARTIFACTS}protobufs-${PROTO_SNAPSHOT_VERSION}-SNAPSHOT-javadoc.jar | ||
|
|
||
| RUN git clone --branch ${OPENSEARCH_BRANCH} https://github.com/opensearch-project/OpenSearch.git /build/opensearch | ||
finnegancarroll marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| WORKDIR /build/opensearch | ||
|
|
||
| # Update transport-grpc/build.gradle to use PROTO_SNAPSHOT_VERSION | ||
| RUN sed -i 's/org\.opensearch:protobufs:[0-9]\+\.[0-9]\+\.[0-9]\+/org.opensearch:protobufs:'"${PROTO_SNAPSHOT_VERSION}"'/' /build/opensearch/plugins/transport-grpc/build.gradle | ||
|
|
||
| RUN ./gradlew :plugins:transport-grpc:test -Drepos.mavenLocal | ||
| RUN ./gradlew :plugins:transport-grpc:internalClusterTest -Drepos.mavenLocal | ||
|
|
||
| ################################################# | ||
| ##### PYTHON STAGES ############################# | ||
| ################################################# | ||
|
|
||
| FROM build-bazel AS build-bazel-python | ||
|
|
||
| RUN bazel build //:python_protos_all | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.