We have 4 environment dev/stg/prod and one more dedicated to QA. Each of the 3 environments have its own schema registry and here id and versions of the subjects are different. The QA pipeline is used to mirror each environment and then make the next set of schema changes and make sure they can be push to the other environments. If these changes pass then the dev/stg/prod schema will be good to update.
What I need is a way to clone each environments schema registry to the QA environment. These is needed so that the version ids and the schema IDs match the events and the others elements.
Is there anyway to clone the topic of the schema registry so that all its values are kept the same?
Thanks
why can’t export schema and import where ever you want?
here is what I would do.
Source:
curl http://kafkaschemaregistry:8081/subjects/${TOPIC}-value/versions/latest|jq -r '.schema|fromjson' > ${TOPIC}.json
Destination:
export SCHEMA=$(jq tostring ${TOPIC}.json)
curl -X POST -H "Content-Type:application/json" -d"{\"schema\":$SCHEMA}" http://kafkaschemaregistry:8081/subjects/${TOPIC}-value/versions
yes assuming that I delete the given subject and I import all the version from the source schema registry. However when in the QA environment I try to process events the schema ID will not match to the QA environment because even if the schemas have the same data and version # their IDs will be different and that is used by the Avro deserializer.
Unless there is a way to reset the IDs to 0 and then try to inserts dummy schemas until I reach the same ID in the target as in the source.
I was thinking if there is any way to just copy the topic files from one schema to the other?