-
Notifications
You must be signed in to change notification settings - Fork 4
feat(sdk): consume platform protos from BSR #395
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| name: "Update Platform Branch" | ||
| # This workflow updates the platform.branch property in all pom.xml files to a new tag or branch. | ||
| name: "Update Platform Version" | ||
| # This workflow updates the platform.bsr.label property in all pom.xml files to a published BSR label. | ||
| # It is triggered by a manual dispatch or by a call from another workflow - notably from platform changes to protocol/go. | ||
| # This property is used to select which versions of the protocol buffer definitions to use. | ||
| # This property selects which published version of the protocol buffer definitions to use. | ||
| # | ||
| # To test: | ||
| # `act workflow_dispatch -W ./.github/workflows/update-platform-branch.yaml --input tag=protocol/go/v0.3.1` | ||
|
|
@@ -20,7 +20,7 @@ on: | |
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "The new tag or branch to update the platform.branch property to use for targeting the RPC protocol buffers." | ||
| description: "The protocol/go tag whose BSR label should be used for RPC protocol buffers." | ||
| required: true | ||
| default: "protocol/go/v0.3.0" | ||
|
|
||
|
|
@@ -38,6 +38,9 @@ jobs: | |
| with: | ||
| persist-credentials: true | ||
|
|
||
| - name: Set up Buf | ||
| uses: bufbuild/buf-setup-action@a47c93e0b1648d5651a065437926377d060baa99 # v1.50.0 | ||
|
|
||
| - name: Set up GitHub CLI as Actions bot | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
@@ -46,30 +49,43 @@ jobs: | |
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Fetch latest semver tag for protocol/go | ||
| - name: Resolve published Platform schema version | ||
| id: fetch-latest-tag | ||
| env: | ||
| REQUESTED_TAG: ${{ inputs.tag }} | ||
| run: | | ||
| if [ -z "${{ github.event.inputs.tag }}" ]; then | ||
| LATEST_TAG=$(git ls-remote --tags https://github.com/opentdf/platform.git | \ | ||
| grep "refs/tags/protocol/go" | \ | ||
| sed 's|.*/||' | \ | ||
| if [ -z "$REQUESTED_TAG" ]; then | ||
| BSR_LABEL=$(buf registry module label list buf.build/opentdf/platform --format json | \ | ||
| jq -r '.labels[].name | select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$"))' | \ | ||
| sort -V | \ | ||
| tail -n1) | ||
|
Comment on lines
+58
to
61
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- applicable repository conventions ---'
find /tmp/coderabbit-repo-knowledge/opentdf-java-sdk-3aa148ae -type f -name '*.md' -maxdepth 3 -print
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/update-platform-branch.yaml
printf '%s\n' '--- repository references to label list ---'
rg -n -C 3 'registry module label list|next_page|BSR_LABEL' .github README.md 2>/dev/null || trueRepository: opentdf/java-sdk Length of output: 13909 🌐 Web query:
💡 Result: The buf registry module label list command supports pagination when using the --format=json flag [1][2]. When you request JSON output, the API response includes a next_page key if there are additional results available [1][3]. You can use this value as the argument for the --page-token flag in subsequent commands to retrieve the next set of data [1][2][4]. Key flags related to pagination and output include: --format string: Set to json to enable the pagination response structure [1][2]. --page-size uint32: Controls the number of items returned per page [1][2]. --page-token string: Used to request a specific page of results using the token provided in the previous response [1][2]. Example usage pattern: buf registry module label list <remote/owner/module> --format json --page-size 10 If the result contains a "next_page" value, you would follow up with: buf registry module label list <remote/owner/module> --format json --page-size 10 --page-token <next_page_value> Citations:
🏁 Script executed: #!/bin/bash
set -e
printf '%s\n' '--- repository-wide convention ---'
cat /tmp/coderabbit-repo-knowledge/opentdf-java-sdk-3aa148ae/conventions/repo-wide.md
printf '%s\n' '--- relevant learnings ---'
cat /tmp/coderabbit-repo-knowledge/opentdf-java-sdk-3aa148ae/learnings/repo-wide.mdRepository: opentdf/java-sdk Length of output: 1866 Read all pages before selecting the latest label. With 🤖 Prompt for AI AgentsSource: MCP tools |
||
| echo "LATEST_TAG=$LATEST_TAG" >> "$GITHUB_ENV" | ||
| if [ -z "$BSR_LABEL" ]; then | ||
| BSR_LABEL="main" | ||
| LATEST_TAG="main" | ||
| else | ||
| LATEST_TAG="protocol/go/$BSR_LABEL" | ||
| fi | ||
| else | ||
| echo "LATEST_TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_ENV" | ||
| if [[ ! "$REQUESTED_TAG" =~ ^protocol/go/v[0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?$ ]]; then | ||
| echo "Invalid protocol/go tag: $REQUESTED_TAG" >&2 | ||
| exit 1 | ||
| fi | ||
| LATEST_TAG="$REQUESTED_TAG" | ||
| BSR_LABEL="${LATEST_TAG##*/}" | ||
| fi | ||
| buf build "buf.build/opentdf/platform:$BSR_LABEL" | ||
| echo "LATEST_TAG=$LATEST_TAG" >> "$GITHUB_ENV" | ||
| echo "BSR_LABEL=$BSR_LABEL" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Check if update is needed | ||
| id: check-update | ||
| run: | | ||
| CURRENT_TAG=$(grep -oP '<platform.branch>\K.*(?=</platform.branch>)' pom.xml | head -n1) | ||
| if [ "$CURRENT_TAG" = "$LATEST_TAG" ]; then | ||
| echo "Platform branch is already up-to-date." | ||
| CURRENT_LABEL=$(grep -oP '<platform.bsr.label>\K.*(?=</platform.bsr.label>)' sdk/pom.xml) | ||
| if [ "$CURRENT_LABEL" = "$BSR_LABEL" ]; then | ||
| echo "Platform BSR label is already up-to-date." | ||
| echo "no_updates=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| echo "CURRENT_TAG=$CURRENT_TAG" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Check for existing PR | ||
| if: steps.check-update.outputs.no_updates != 'true' | ||
|
|
@@ -88,11 +104,11 @@ jobs: | |
| git fetch origin update-platform-branch:update-platform-branch | ||
| git checkout update-platform-branch | ||
|
|
||
| - name: Update platform.branch in pom.xml files | ||
| - name: Update platform.bsr.label in pom.xml files | ||
| if: steps.check-update.outputs.no_updates != 'true' | ||
| id: update-platform-branch | ||
| run: | | ||
| find . -name "pom.xml" -exec sed -i.bak "s|<platform.branch>.*</platform.branch>|<platform.branch>protocol/go/${LATEST_TAG}</platform.branch>|g" {} \; | ||
| find . -name "pom.xml" -exec sed -i.bak "s|<platform.bsr.label>.*</platform.bsr.label>|<platform.bsr.label>${BSR_LABEL}</platform.bsr.label>|g" {} \; | ||
| CHANGED_FILES=$(find . -name "pom.xml" -exec diff -u {} {}.bak \;) | ||
| if [ -z "$CHANGED_FILES" ]; then | ||
| echo "No changes detected in pom.xml files." | tee -a $GITHUB_STEP_SUMMARY | ||
|
|
@@ -146,11 +162,11 @@ jobs: | |
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| RELEASE_NOTES=$(gh release view protocol/go/$LATEST_TAG --repo opentdf/platform --json body --jq '.body') | ||
| RELEASE_NOTES=$(gh release view "$LATEST_TAG" --repo opentdf/platform --json body --jq '.body') | ||
| cat <<EOF > pr_body.txt | ||
| This PR updates the platform.branch property in all pom.xml files to the new tag or branch: $LATEST_TAG. | ||
| This PR updates the platform.bsr.label property in all pom.xml files to the BSR label for $LATEST_TAG. | ||
|
|
||
| See the release: https://github.com/opentdf/platform/releases/tag/protocol%2Fgo%2F$LATEST_TAG | ||
| See the release: https://github.com/opentdf/platform/releases/tag/$LATEST_TAG | ||
|
|
||
| Release Notes: | ||
| $RELEASE_NOTES | ||
|
|
@@ -177,4 +193,3 @@ jobs: | |
| --body-file pr_body.txt \ | ||
| --head $BRANCH_NAME \ | ||
| --base main | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.