schema-registry-gitops icon indicating copy to clipboard operation
schema-registry-gitops copied to clipboard

Using client.properties doesn't work with the latest version

Open vitalvi opened this issue 2 years ago • 7 comments

Hello, If I use latest version of schema-registry-gitops docker image with client.properties file for example

docker run --network host -v "$(pwd)/client.properties":/cfg/client.properties -v "$(pwd)/contracts":/data domnikl/schema-registry-gitops --properties /cfg/client.properties plan /data/schema-registry.yml

It fails with an exception

picocli.CommandLine$InitializationException: Could not instantiate class dev.domnikl.schema_registry_gitops.cli.Apply: java.lang.reflect.InvocationTargetException
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5538)
        at picocli.CommandLine$Model$CommandUserObject.getInstance(CommandLine.java:11863)
        at picocli.CommandLine$Model$CommandSpec.userObject(CommandLine.java:6278)
        at picocli.CommandLine$Interpreter.clear(CommandLine.java:13056)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13101)
        at picocli.CommandLine$Interpreter.processSubcommand(CommandLine.java:13395)
        at picocli.CommandLine$Interpreter.processArguments(CommandLine.java:13310)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13122)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:13091)
        at picocli.CommandLine$Interpreter.parse(CommandLine.java:12992)
        at picocli.CommandLine.parseArgs(CommandLine.java:1478)
        at picocli.CommandLine.execute(CommandLine.java:2077)
        at dev.domnikl.schema_registry_gitops.MainKt.main(Main.kt:26)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5513)
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5534)

But this seems to work if I use 1.3.0 version

docker run --network host -v "$(pwd)/client.properties":/cfg/client.properties -v "$(pwd)/contracts":/data domnikl/schema-registry-gitops:1.3.0 --properties /cfg/client.properties plan /data/schema-registry.yml

vitalvi avatar Jun 03 '22 08:06 vitalvi

I can reproduce it and it's a problem with the dependency injection and how picocli instantiates commands or subcommands. Unfortunately there is no way to integrate with Dagger, so I need to remove Dagger and I want to replace it with Spring Boot (as it can be integrated with Picocli quite easily). This unfortunately is a bigger change, so in the meantime I would advise you to use 1.3.0 or change to environment variables as this will still work.

domnikl avatar Jul 06 '22 13:07 domnikl

Fixed in 1.5.0

domnikl avatar Jul 08 '22 13:07 domnikl

Thanks a lot @domnikl

vitalvi avatar Jul 11 '22 05:07 vitalvi

@domnikl - Appreciate your effort on the tool. The issue is still there on 1.5 release. 2022-08-10 10:00:06.499 WARN Unable to get bean of class class dev.domnikl.schema_registry_gitops.cli.Apply, using default Picocli factory

I tried 1.3 It doesn't create new schemas in schema registry. It says succeed but no schema created.

2022-08-09 16:51:47.883 INFO [SUBJECT] without-compatiblity 2022-08-09 16:51:47.884 INFO + registered (version 2) 2022-08-09 16:51:47.884 INFO 2022-08-09 16:51:47.885 INFO [SUCCESS] Applied state from /Users/Downloads/schemaregistry-gitops/data/schema-registry.yaml to https://localhost:8083

akthodu avatar Aug 10 '22 14:08 akthodu

@akthodu could you please try again with 1.6.0?

domnikl avatar Aug 11 '22 13:08 domnikl

I really appreciate taking time and releasing 1.6.0. This time I don't see initiation error. But I see the schemas are not getting deployed in schema registry.

2022-08-12 09:52:10.483 INFO [SUCCESS] All changes are compatible and can be applied. TKA15D6@ZTN34Q12JNRY schemaregistry-gitops % java -jar schema-registry-gitops.jar.1.6 apply --properties data/client.properties data/schema-registry.yaml 2022-08-12 09:52:29.252 INFO [SUBJECT] mon.pmdm.sku-key 2022-08-12 09:52:29.264 INFO + registered (version 3) 2022-08-12 09:52:29.454 INFO + compatibility NONE 2022-08-12 09:52:29.454 INFO 2022-08-12 09:52:29.572 INFO [SUBJECT] without-compatiblity 2022-08-12 09:52:29.572 INFO + registered (version 2) 2022-08-12 09:52:29.572 INFO 2022-08-12 09:52:29.577 INFO [SUCCESS] Applied state from data/schema-registry.yaml to https://localhost:8083 TKA15D6@ZTN34Q12JNRY schemaregistry-gitops % TKA15D6@ZTN34Q12JNRY schemaregistry-gitops % TKA15D6@ZTN34Q12JNRY schemaregistry-gitops % java -jar schema-registry-gitops.jar.1.6 apply --properties data/client.properties data/schema-registry.yaml 2022-08-12 09:52:35.327 INFO [SUBJECT] mon.pmdm.sku-key 2022-08-12 09:52:35.336 INFO + registered (version 3) 2022-08-12 09:52:35.412 INFO + compatibility NONE 2022-08-12 09:52:35.412 INFO 2022-08-12 09:52:35.477 INFO [SUBJECT] without-compatiblity 2022-08-12 09:52:35.477 INFO + registered (version 2) 2022-08-12 09:52:35.477 INFO 2022-08-12 09:52:35.480 INFO [SUCCESS] Applied state from data/schema-registry.yaml to https://localhost:8083

Nothing gets deployed in schema registry.

akthodu avatar Aug 12 '22 14:08 akthodu

Thanks for testing it again @akthodu! Unfortunately I can not replicate what you wrote. The examples from the repo are being registered just fine. And even in your output the registry created versions 2 and 3 and reported that back to schema-registry-gitops. Please try registering them yourself using the REST API of Confluent Schema Registry as it seems to not store the schemas correctly.

domnikl avatar Aug 25 '22 10:08 domnikl

Closed as of no activity.

domnikl avatar Sep 27 '22 10:09 domnikl