zitadel: use local plugins for console protobuf generation

Previously, the console portion of ZITADEL used Buf remote plugins to generate
sources. This resulted in the hash for the protobuf generated code changing
whenever the remote builders changed. This change patches the console
configuration to use local plugins from Nixpkgs instead of remote ones, to
ensure the output isn't influenced by remote changes.
This commit is contained in:
Ruby Iris Juric 2023-12-30 13:19:24 +11:00
parent 067c1958fa
commit dd38622bab
No known key found for this signature in database
GPG Key ID: B6D7116C451A5B41
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,21 @@
diff --git a/console/buf.gen.yaml b/console/buf.gen.yaml
index 1737c2ded..d6affa8bc 100644
--- a/console/buf.gen.yaml
+++ b/console/buf.gen.yaml
@@ -3,12 +3,12 @@ version: v1
managed:
enabled: true
plugins:
- - plugin: buf.build/protocolbuffers/js
+ - plugin: js
out: src/app/proto/generated
opt: import_style=commonjs,binary
- - plugin: buf.build/grpc/web
+ - plugin: grpc-web
out: src/app/proto/generated
opt: import_style=typescript,mode=grpcweb
- - plugin: buf.build/grpc-ecosystem/openapiv2
+ - plugin: openapiv2
out: src/app/proto/generated
opt: allow_delete_body
\ No newline at end of file

View File

@ -6,15 +6,24 @@
{ mkYarnPackage
, fetchYarnDeps
, lib
, grpc-gateway
, protoc-gen-grpc-web
, protoc-gen-js
}:
let
protobufGenerated = generateProtobufCode {
pname = "zitadel-console";
nativeBuildInputs = [
grpc-gateway
protoc-gen-grpc-web
protoc-gen-js
];
workDir = "console";
bufArgs = "../proto --include-imports --include-wkt";
outputPath = "src/app/proto";
hash = "sha256-NmlKjKWxmqatyR6OitlQ7bfl6U6PS6KWqTALwX42HS4=";
hash = "sha256-Bpoe1UZGLTxUqdLbvOod6/77R4CsYQ4PirMfqvI9Lz8=";
};
in
mkYarnPackage rec {

View File

@ -62,6 +62,7 @@ let
name = "${pname}-buf-generated";
src = zitadelRepo;
patches = [ ./console-use-local-protobuf-plugins.patch ];
nativeBuildInputs = nativeBuildInputs ++ [ buf ];