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

IPROTO-383 Allow proto-schema-compatibility-maven-plugin to compare a… #323

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

ryanemerson
Copy link
Contributor

@ryanemerson ryanemerson commented Sep 18, 2024

https://issues.redhat.com/browse/IPROTO-383

@tristantarrant This is needed for the Keycloak release, where we intend to eventually check schema compatibility against multiple branches.

Tested using Infinispan commons and the following configuration:

            <plugin>
               <groupId>org.infinispan.protostream</groupId>
               <artifactId>proto-schema-compatibility-maven-plugin</artifactId>
               <version>5.0.9-SNAPSHOT</version>
               <configuration>
                  <commitProtoLock>${commitProtoLockChanges}</commitProtoLock>
                  <remoteLockFiles>https://raw.githubusercontent.com/infinispan/infinispan/refs/heads/main/commons/all/proto.lock</remoteLockFiles>
               </configuration>
            </plugin>

Changing the branch of the remoteLockFiles to 14.0.x will cause the check to fail as expected.

}

private void checkRemoteCompatibility(ProtoLock currentState) throws IOException {
if (remoteLockFiles.isEmpty())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you will want to inject MavenSession into the plugin

@Parameter(defaultValue = "${session}")
private MavenSession session;

and then use session.isOffline() to respect Maven's offline setting


for (String file : remoteLockFiles.split(",")) {
getLog().info(String.format("Checking backwards compatibility check against remote file '%s'", file));
try (InputStream is = new URL(file).openStream()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In offline mode we may want to allow URLs with the file protocol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have protoSourceRoot and protoLockRoot for defining checks against local files.

@tristantarrant tristantarrant merged commit caffddb into infinispan:main Oct 1, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants