From 29357fb0c5309fe882ff1d49022979e03582751d Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Tue, 21 Jan 2025 18:29:06 +0000 Subject: [PATCH 1/6] upgrade buf to v2 Signed-off-by: Michael Beemer --- .github/workflows/README.md | 4 --- .github/workflows/buf-ci.yml | 17 +++++++++ .github/workflows/pr-checks.yml | 52 +++------------------------ .github/workflows/release-please.yaml | 18 ---------- Makefile | 2 +- protobuf/buf.gen.csharp.yaml | 6 ++-- protobuf/buf.gen.go-server.yaml | 13 ++++--- protobuf/buf.gen.go.yaml | 11 +++--- protobuf/buf.gen.java.yaml | 8 ++--- protobuf/buf.gen.php.yaml | 6 ++-- protobuf/buf.gen.python.yaml | 8 ++--- protobuf/buf.gen.ruby.yaml | 6 ++-- protobuf/buf.gen.rust.yaml | 8 ++--- protobuf/buf.gen.ts-connect.yaml | 12 +++---- protobuf/buf.gen.ts.yaml | 6 ++-- protobuf/buf.lock | 12 +++---- protobuf/buf.yaml | 25 ++++++++----- 17 files changed, 83 insertions(+), 131 deletions(-) delete mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/buf-ci.yml diff --git a/.github/workflows/README.md b/.github/workflows/README.md deleted file mode 100644 index c48521d..0000000 --- a/.github/workflows/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Run Workflows locally - -1. [Install act](https://github.com/nektos/act) -1. run `act --bind --directory .` diff --git a/.github/workflows/buf-ci.yml b/.github/workflows/buf-ci.yml new file mode 100644 index 0000000..1d29282 --- /dev/null +++ b/.github/workflows/buf-ci.yml @@ -0,0 +1,17 @@ +name: Buf CI +on: + push: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + delete: +permissions: + contents: read + pull-requests: write +jobs: + buf: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: bufbuild/buf-action@v1 + with: + token: ${{ secrets.BUF_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index e841445..b31146c 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -5,53 +5,9 @@ on: permissions: contents: read - -env: - GO_VERSION: 1.22 + pull-requests: write jobs: - lint-protos: - runs-on: ubuntu-latest - steps: - # Install the `buf` CLI - - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} - - name: Checkout repository - uses: actions/checkout@v4 - # Lint your Protobuf sources - - uses: bufbuild/buf-lint-action@v1 - with: - input: protobuf - - buf-format: - runs-on: ubuntu-latest - steps: - # Install the `buf` CLI - - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} - - name: Checkout repository - uses: actions/checkout@v4 - - name: Buf format check - run: buf format -d --exit-code - - buf-breaking-changes: - runs-on: ubuntu-latest - steps: - # Install the `buf` CLI - - uses: bufbuild/buf-setup-action@v1 - with: - github_token: ${{ github.token }} - - name: Checkout repository - uses: actions/checkout@v4 - # Run breaking change detection against the last commit - - uses: bufbuild/buf-breaking-action@v1 - with: - input: protobuf - against: 'https://github.com/open-feature/schemas.git#branch=main,ref=HEAD~1,subdir=protobuf' - - validate-schema: runs-on: ubuntu-latest steps: @@ -59,16 +15,16 @@ jobs: # Use ajv to validate schema - name: Setup node - uses: actions/setup-node@v4.0.1 + uses: actions/setup-node@v4.1.0 - name: Validate schema run: make ajv-validate-flagd-schema # Run go test suite to validate the json schema against positive and/or negative validations in /json/test - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: 'go.mod' - name: Validate Schema run: make test diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index a049b64..db62d15 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -26,26 +26,8 @@ jobs: signoff: "OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>" outputs: releases_created: ${{ steps.release.outputs.releases_created }} - # these are generated by release-please b/c this is in a manifest repo. - buf_release_tag: ${{ steps.release.outputs.protobuf--tag_name }} json_release_tag: ${{ steps.release.outputs.json--tag_name }} - push-module: - needs: release-please - name: push schema to buf registry - runs-on: ubuntu-latest - if: ${{ needs.release-please.outputs.releases_created && needs.release-please.outputs.buf_release_tag }} - steps: - # Run `git checkout` - - uses: actions/checkout@v4 - with: - ref: ${{ needs.release-please.outputs.buf_release_tag }} - # Install the `buf` CLI - - uses: bufbuild/buf-setup-action@v1 - # Push module to the BSR - - name: bsr-push - run: BUF_TOKEN="${{ secrets.BUF_TOKEN }}" buf push --tag "${{ needs.release-please.outputs.buf_release_tag }}" protobuf - create-schema-store-issue: needs: release-please name: create schema release reminder issue diff --git a/Makefile b/Makefile index 6933725..bd1d31d 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BUF_VERSION=v1.26.1 +BUF_VERSION=v1.50.0 guard-%: @ if [ "${${*}}" = "" ]; then \ diff --git a/protobuf/buf.gen.csharp.yaml b/protobuf/buf.gen.csharp.yaml index 5d251ac..bb6f704 100644 --- a/protobuf/buf.gen.csharp.yaml +++ b/protobuf/buf.gen.csharp.yaml @@ -1,8 +1,8 @@ -version: v1 +version: v2 managed: enabled: true plugins: - - plugin: buf.build/protocolbuffers/csharp:v23.4 + - remote: buf.build/protocolbuffers/csharp:v23.4 out: ../proto/csharp - - plugin: buf.build/grpc/csharp:v1.56.0 + - remote: buf.build/grpc/csharp:v1.56.0 out: ../proto/csharp diff --git a/protobuf/buf.gen.go-server.yaml b/protobuf/buf.gen.go-server.yaml index f8d4bbe..75fbc15 100644 --- a/protobuf/buf.gen.go-server.yaml +++ b/protobuf/buf.gen.go-server.yaml @@ -1,18 +1,17 @@ -version: v1 +version: v2 managed: enabled: true plugins: - - plugin: buf.build/protocolbuffers/go:v1.31.0 + - remote: buf.build/protocolbuffers/go:v1.31.0 out: ../proto/go-server - opt: - - paths=source_relative - - plugin: buf.build/grpc/go:v1.3.0 + opt: paths=source_relative + - remote: buf.build/grpc/go:v1.3.0 out: ../proto/go-server opt: - require_unimplemented_servers=false - paths=source_relative - - plugin: buf.build/grpc-ecosystem/gateway:v2.16.0 + - remote: buf.build/grpc-ecosystem/gateway:v2.16.0 out: ../proto/go-server opt: - paths=source_relative - - generate_unbound_methods=true \ No newline at end of file + - generate_unbound_methods=true diff --git a/protobuf/buf.gen.go.yaml b/protobuf/buf.gen.go.yaml index d786bfe..b5feb05 100644 --- a/protobuf/buf.gen.go.yaml +++ b/protobuf/buf.gen.go.yaml @@ -1,13 +1,12 @@ -version: v1 +version: v2 managed: enabled: true plugins: - - plugin: buf.build/protocolbuffers/go:v1.31.0 + - remote: buf.build/protocolbuffers/go:v1.31.0 out: ../proto/go - opt: - - paths=source_relative - - plugin: buf.build/grpc/go:v1.3.0 + opt: paths=source_relative + - remote: buf.build/grpc/go:v1.3.0 out: ../proto/go opt: - require_unimplemented_servers=false - - paths=source_relative \ No newline at end of file + - paths=source_relative diff --git a/protobuf/buf.gen.java.yaml b/protobuf/buf.gen.java.yaml index 2d510cf..6e529e3 100644 --- a/protobuf/buf.gen.java.yaml +++ b/protobuf/buf.gen.java.yaml @@ -1,8 +1,8 @@ -version: v1 +version: v2 managed: enabled: true plugins: - - plugin: buf.build/protocolbuffers/java:v23.4 + - remote: buf.build/protocolbuffers/java:v23.4 + out: ../proto/java + - remote: buf.build/grpc/java:v1.56.1 out: ../proto/java - - plugin: buf.build/grpc/java:v1.56.1 - out: ../proto/java \ No newline at end of file diff --git a/protobuf/buf.gen.php.yaml b/protobuf/buf.gen.php.yaml index 7c8868e..86a1a19 100644 --- a/protobuf/buf.gen.php.yaml +++ b/protobuf/buf.gen.php.yaml @@ -1,6 +1,6 @@ -version: v1 +version: v2 plugins: - - plugin: buf.build/grpc/php:v1.56.0 + - remote: buf.build/grpc/php:v1.56.0 out: ../proto/php - - plugin: buf.build/protocolbuffers/php:v23.4 + - remote: buf.build/protocolbuffers/php:v23.4 out: ../proto/php diff --git a/protobuf/buf.gen.python.yaml b/protobuf/buf.gen.python.yaml index b45c62a..db36211 100644 --- a/protobuf/buf.gen.python.yaml +++ b/protobuf/buf.gen.python.yaml @@ -1,8 +1,8 @@ -version: v1 +version: v2 managed: enabled: true plugins: - - plugin: buf.build/protocolbuffers/python:v23.4 + - remote: buf.build/protocolbuffers/python:v23.4 + out: ../proto/python + - remote: buf.build/grpc/python:v1.56.0 out: ../proto/python - - plugin: buf.build/grpc/python:v1.56.0 - out: ../proto/python \ No newline at end of file diff --git a/protobuf/buf.gen.ruby.yaml b/protobuf/buf.gen.ruby.yaml index 7691a7c..3850e6e 100644 --- a/protobuf/buf.gen.ruby.yaml +++ b/protobuf/buf.gen.ruby.yaml @@ -1,6 +1,6 @@ -version: v1 +version: v2 plugins: - - plugin: buf.build/grpc/ruby:v1.56.0 + - remote: buf.build/grpc/ruby:v1.56.0 out: ./lib/openfeature/flagd/provider - - plugin: buf.build/protocolbuffers/ruby:v23.4 + - remote: buf.build/protocolbuffers/ruby:v23.4 out: ./lib/openfeature/flagd/provider diff --git a/protobuf/buf.gen.rust.yaml b/protobuf/buf.gen.rust.yaml index a742eef..d7460ba 100644 --- a/protobuf/buf.gen.rust.yaml +++ b/protobuf/buf.gen.rust.yaml @@ -1,10 +1,8 @@ -# buf.gen.yaml -version: v1 +version: v2 managed: enabled: true plugins: - # Requires protoc-gen-tonic & protoc-gen-prost to enable service client creation - - name: prost + - local: protoc-gen-prost out: ../proto/rust - - name: tonic + - local: protoc-gen-tonic out: ../proto/rust diff --git a/protobuf/buf.gen.ts-connect.yaml b/protobuf/buf.gen.ts-connect.yaml index 14c346d..c20a710 100644 --- a/protobuf/buf.gen.ts-connect.yaml +++ b/protobuf/buf.gen.ts-connect.yaml @@ -1,10 +1,8 @@ -version: v1 +version: v2 plugins: - - plugin: buf.build/bufbuild/es:v1.2.1 + - remote: buf.build/bufbuild/es:v1.2.1 out: ../proto/ts - opt: - - target=ts - - plugin: buf.build/bufbuild/connect-es:v0.11.0 + opt: target=ts + - remote: buf.build/bufbuild/connect-es:v0.11.0 out: ../proto/ts - opt: - - target=ts + opt: target=ts diff --git a/protobuf/buf.gen.ts.yaml b/protobuf/buf.gen.ts.yaml index d54d43b..455d3a8 100644 --- a/protobuf/buf.gen.ts.yaml +++ b/protobuf/buf.gen.ts.yaml @@ -1,8 +1,8 @@ -version: v1 +version: v2 plugins: - - plugin: buf.build/community/stephenh-ts-proto:v1.156.0 + - remote: buf.build/community/stephenh-ts-proto:v1.156.0 out: ../proto/ts - opt: + opt: - outputServices=grpc-js - forceLong=string - esModuleInterop=true diff --git a/protobuf/buf.lock b/protobuf/buf.lock index 2465567..57759d2 100644 --- a/protobuf/buf.lock +++ b/protobuf/buf.lock @@ -1,11 +1,9 @@ # Generated by buf. DO NOT EDIT. -version: v1 +version: v2 deps: - - remote: buf.build - owner: googleapis - repository: googleapis + - name: buf.build/googleapis/googleapis commit: e9fcfb66f77242e5b8fd4564d7a01033 - - remote: buf.build - owner: grpc-ecosystem - repository: grpc-gateway + digest: b5:88319861f1e8014c4ca02b9fcc08c0cfe5a08ba518e9f66ce8b8c115895165e2bb579e84c3b8fd18b440c4217e8c426bc25f7edc60d00352924fbbbe871ead01 + - name: buf.build/grpc-ecosystem/grpc-gateway commit: bc28b723cd774c32b6fbc77621518765 + digest: b5:a613f827fa6ff35a4f5e87e80e35ac6b35e5792cc9c5a658351072777d88c6d4df785a0c14889090db11667cf5463d122c7193b3719c7861d3e5747c22ce1381 diff --git a/protobuf/buf.yaml b/protobuf/buf.yaml index 76693f6..8c25ea3 100644 --- a/protobuf/buf.yaml +++ b/protobuf/buf.yaml @@ -1,14 +1,23 @@ -version: v1 -name: buf.build/open-feature/flagd +version: v2 +modules: + - path: protobuf + name: buf.build/open-feature/flagd deps: - buf.build/googleapis/googleapis - buf.build/grpc-ecosystem/grpc-gateway -breaking: - use: - - FILE lint: use: - - DEFAULT + - STANDARD + except: + - FIELD_NOT_REQUIRED + - PACKAGE_NO_IMPORT_CYCLE ignore: - - buf.build/googleapis/googleapis - - buf.build/grpc-ecosystem/grpc-gateway + - protobuf/buf.build/googleapis/googleapis + - protobuf/buf.build/grpc-ecosystem/grpc-gateway + disallow_comment_ignores: true +breaking: + use: + - FILE + except: + - EXTENSION_NO_DELETE + - FIELD_SAME_DEFAULT From fc66ac5e213e878727acec61b0cfb82646e14850 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Tue, 21 Jan 2025 18:38:02 +0000 Subject: [PATCH 2/6] add input dir Signed-off-by: Michael Beemer --- .github/workflows/buf-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/buf-ci.yml b/.github/workflows/buf-ci.yml index 1d29282..9e09e5a 100644 --- a/.github/workflows/buf-ci.yml +++ b/.github/workflows/buf-ci.yml @@ -14,4 +14,5 @@ jobs: - uses: actions/checkout@v4 - uses: bufbuild/buf-action@v1 with: + input: protobuf token: ${{ secrets.BUF_TOKEN }} \ No newline at end of file From c04d1b7ccf320fa94cb64732ef126eb5a0dd49d2 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Tue, 21 Jan 2025 18:42:27 +0000 Subject: [PATCH 3/6] attempt 2 Signed-off-by: Michael Beemer --- .github/workflows/buf-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buf-ci.yml b/.github/workflows/buf-ci.yml index 9e09e5a..e2f8003 100644 --- a/.github/workflows/buf-ci.yml +++ b/.github/workflows/buf-ci.yml @@ -14,5 +14,5 @@ jobs: - uses: actions/checkout@v4 - uses: bufbuild/buf-action@v1 with: - input: protobuf - token: ${{ secrets.BUF_TOKEN }} \ No newline at end of file + token: ${{ secrets.BUF_TOKEN }} + breaking_against: ${{ github.event.repository.clone_url }}#format=git,commit=${{ github.event.pull_request.base.sha }},subdir=protobuf From 1cdeb80ce4f486cdd2b5c8be0fb86466d2add874 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Tue, 21 Jan 2025 18:53:26 +0000 Subject: [PATCH 4/6] fix lint issues Signed-off-by: Michael Beemer --- protobuf/buf.lock => buf.lock | 0 protobuf/buf.md => buf.md | 26 ++++++++++++-------------- protobuf/buf.yaml => buf.yaml | 0 3 files changed, 12 insertions(+), 14 deletions(-) rename protobuf/buf.lock => buf.lock (100%) rename protobuf/buf.md => buf.md (66%) rename protobuf/buf.yaml => buf.yaml (100%) diff --git a/protobuf/buf.lock b/buf.lock similarity index 100% rename from protobuf/buf.lock rename to buf.lock diff --git a/protobuf/buf.md b/buf.md similarity index 66% rename from protobuf/buf.md rename to buf.md index ed1d1ff..e49b8cf 100644 --- a/protobuf/buf.md +++ b/buf.md @@ -1,13 +1,11 @@ # Flagd build spec -### Managed by [OpenFeature](https://github.com/open-feature). +This repository contains grpc service definitions that developers can use for interacting with [flagd](https://flagd.dev). -This repository contains grpc service definitions that developers can use for interacting with [flagd](https://github.com/open-feature/flagd). +Below are the modules exposed through this repository: -Given below are the modules exposed through this repository, - -- [Flag evaluation](#Flag-evaluation) -- [Flag sync](#Flag-sync) +- [Flag evaluation](#flag-evaluation) +- [Flag sync](#flag-sync) ## Flag evaluation @@ -16,8 +14,8 @@ The module `schema.v1` contains a single `Service`, describing the 5 core `rpcs` response objects (`ResolveXXXRequest` and `ResolveXXXResponse`). The final `rpc` on the `Service` is a streamed response named `EventStream`, this is used to pass internal events to the client, such as `configuration_change` and `provider_ready`. -Internally, flagd uses the connect protocol, meaning it is compatible with grpc interfaces. If your desired language has -a supported plugin for generating connect stubs then it is recommended to use these over grpc. +Internally, flagd uses the connect protocol, meaning it is compatible with grpc interfaces. +If your desired language has a supported plugin for generating connect stubs then it is recommended to use these over grpc. ## Flag sync @@ -25,18 +23,18 @@ The module `sync.v1` is a service definition to provide flagd with feature flag The server exposes 2 `rpcs`. ### SyncFlags + Flagd acts as the client and initiates the streaming with `SyncFlagsRequest`. -The server implementation will then stream feature flag configurations through `SyncFlagsResponse`. The response contains -`SyncState` which can be utilized to provide flagd with flexible configuration updates. +The server implementation will then stream feature flag configurations through `SyncFlagsResponse`. +The response contains `SyncState` which can be utilized to provide flagd with flexible configuration updates. ### FetchAllFlags + Flagd acts as the client and sends the empty message `FetchAllFlagsRequest`. The server implementation responds with the full feature flag configuration through the `FetchAllFlagsResponse`. This `rpc` is used to re-sync flagd's internal state during configuration merge events. ## Code generation -Easiest way to generate grpc code for your language of choice is using provided [buf](https://buf.build/) templates. -For example, with required binaries in your path, java code generation can be done using -`buf generate --template buf.gen.java.yaml` command. - +Easiest way to generate gRPC code for your language of choice is using provided [buf](https://buf.build/) templates. +For example, with required binaries in your path, java code generation can be done using `buf generate --template buf.gen.java.yaml` command. diff --git a/protobuf/buf.yaml b/buf.yaml similarity index 100% rename from protobuf/buf.yaml rename to buf.yaml From 906b28420f11d25d7ee02e1fdf6488fe0ba08f08 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Tue, 21 Jan 2025 18:56:38 +0000 Subject: [PATCH 5/6] bump go version Signed-off-by: Michael Beemer --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 648e9c3..4fb9934 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/open-feature/flagd-schemas -go 1.18 +go 1.23 require github.com/xeipuuv/gojsonschema v1.2.0 From f0b3f83a2b1087de5deebcd897dc195d4b6a1414 Mon Sep 17 00:00:00 2001 From: Michael Beemer Date: Tue, 21 Jan 2025 18:57:42 +0000 Subject: [PATCH 6/6] remove unnessisary permission Signed-off-by: Michael Beemer --- .github/workflows/pr-checks.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index b31146c..15b37f6 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -5,7 +5,6 @@ on: permissions: contents: read - pull-requests: write jobs: validate-schema: