Skip to content
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

Branches are not being created during artifacts migration from v2 to v3 #5627

Open
dpilin opened this issue Nov 28, 2024 · 1 comment
Open

Comments

@dpilin
Copy link

dpilin commented Nov 28, 2024

Description

Registry
Version
: 3.0.4
Persistence type: SQL

Environment

Kubernetes 1.26

Steps to Reproduce

  1. Download all-artifacts.zip from Apicurio-registry v2 according to the instruction. In my case it is apicurio-registry 2.5.10.Final
  2. Deploy a fresh installation of Apicurio-registry v3 (the bug is also reproducible on localhost using Docker and in-memory DB):
    docker run -d -p 8080:8080 apicurio/apicurio-registry:3.0.4
  3. Import artifacts to registry v3 using curl:
    curl -Sv -X POST "http://localhost:8080/apis/registry/v3/admin/import" -H "Accept: application/json" -H "Content-Type: application/zip" --data-binary @all-artifacts.zip
  4. Make sure that the artifacts being imported successfully:
    curl http://localhost:8080/apis/registry/v3/groups/default/artifacts
  5. Take any artifactId, check that its versions are available in both apis:
    curl http://localhost:8080/apis/registry/v2/groups/default/artifacts/SomeArtifact-value/versions/ curl http://localhost:8080/apis/registry/v3/groups/default/artifacts/SomeArtifact-value/versions/
  6. Make sure that its versions also available as a list in confluence-compatible API:
    http://localhost:8080/apis/ccompat/v7/subjects/SomeArtifact-value/versions
  7. Try obtaining the latest version using ccompat API:
    curl http://localhost:8080/apis/ccompat/v7/subjects/SomeArtifact-value/versions/latest {"message":"No version '<tip of the branch 'latest'>' found for artifact with ID 'SomeArtifact-value' in group 'default'.","error_code":40402}
  8. The same goes for api v2:
    $ curl http://localhost:8080/apis/registry/v2/groups/default/artifacts/SomeArtifact-value/versions/latest {"message":"No version '<tip of the branch 'latest'>' found for artifact with ID 'SomeArtifact-value' in group 'default'.","error_code":404,"detail":"VersionNotFoundException: No version '<tip of the branch 'latest'>' found for artifact with ID 'SomeArtifact-value' in group 'default'.","name":"VersionNotFoundException"

Expected vs Actual Behaviour

It was expected here to obtain the last version of artifact (there were two of them in this case) from Confluence-compatible API and API v2. But due to lack of branch field it is not possible anymore in version 3.0.4.

I believe this field should be added during /v3/admin/import request to maintain backwards-compatbility.

I also tried creating a new artifact from scratch using API v2, this way branch with name "latest" was created automatically and there was no such problem:

curl -X POST -H "Content-type: application/json; artifactType=AVRO" -H "X-Registry-ArtifactId: SomeTestArtifact-value" --data '{"type":"record","name":"price","namespace":"com.example","fields":[{"name":"symbol","type":"string"},{"name":"price","type":"string"}]}' http://localhost:8080/apis/registry/v2/groups/default/artifacts

curl -X POST "http://localhost:8080/apis/registry/v2/groups/default/artifacts/SomeTestArtifact-value/versions" -H "Content-Type: application/json" -d '{"type": "record", "name": "price", "namespace":"com.example", "fields": [{"name": "symbol", "type": "string"}, {"name": "price", "type": "string"}]}'

curl http://localhost:8080/apis/registry/v3/groups/default/artifacts/SomeTestArtifact-value/branches
{"branches":[{"branchId":"latest","createdOn":"2024-11-28T11:58:21Z","owner":"","modifiedOn":"2024-11-28T11:58:21Z","modifiedBy":"","systemDefined":true}],"count":1}

curl http://localhost:8080/apis/ccompat/v7/subjects/SomeTestArtifact-value/versions/latest
{"id":249,"subject":"SomeTestArtifact-value","version":2,"schema":"{\"type\": \"record\", \"name\": \"price\", \"namespace\":\"com.example\", \"fields\": [{\"name\": \"symbol\", \"type\": \"string\"}, {\"name\": \"price\", \"type\": \"string\"}]}","references":[]}

curl http://localhost:8080/apis/registry/v2/groups/default/artifacts/SomeTestArtifact-value/versions/latest
{"type": "record", "name": "price", "namespace":"com.example", "fields": [{"name": "symbol", "type": "string"}, {"name": "price", "type": "string"}]}

@creckord
Copy link

Same issue here. This also happens on all v2 endpoints that implicitly are looking for a latest version, e.g.

  • /groups/{groupId}/artifacts/{artifactId}/meta
  • /groups/{groupId}/artifacts/{artifactId}/rules
  • /groups/{groupId}/artifacts/{artifactId} (this one is a little different, as it still gives a 404, but without the "tip of the branch" message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants