so we have this problem for a while (EDIT: it is actually ticket Loading...) that currently the revapi ignores we put in our pom.xml doesn’t contain any version information. It’s a problem because when we’re performing a release we cleanup the revapi ignores, and some might have been added in master after the branch where to perform the release was created and our tools currently cannot guess easily which ignores to remove.
So my proposal is to start using the `attachments` elements of revapi schema: Differences Transformation :: Revapi . This element is basically a map that we use the way we want. I propose that we use an element `version` in it, containing the version the revapi ignore targets.
For example, in master before a 18.8.0 release I could have:
Then calling the compatibility cleanup on master after releasing 18.8.0 would only remove the first occurence. The algorithm would be to remove all occurences matching the version released basically.
The fact that we can put multiple version is only to help backporting without having to edit the ignores. We could also do it without that support if we want to avoid any mistake, and force people having to put the version manually.
Now I guess we should have a way to verify that any time we put a ignore we also have the version attached, I’m not sure at this point how it’s doable.
I guess that should not be too hard to implement that in an enforcer rule. It would also be in charge of making sure one of the version really matches the current branch next version.
If I read the schema definition correctly the same key is not accepted several times in the attachments element, so I suggest moving to a comma separated format instead.
Maybe with a best practice to always list version from the most recent to the least.
+1 overall, I’m just wondering if we actually need to list all the target versions here. If it’s only a technical information for our scripts, it might be less error prone to add a “update revapi difference version” to the backport process, no?
Honestly I’m not sure either about this. In some cases you know in advance in which branch the backport ignores will be exactly the same, in some other you don’t. So the idea behind my proposal would be to allow providing multiple version, but I wouldn’t enforce it: if a dev prefer to indicate a unique version per ignore per branch it’s perfectly fine.
Following @mleduc’s remark (the schema doesn’t accept the same key twice), the versions are a comma-separated list in a versions attachment, either on the item or on the whole revapi.differences group (the item wins):
Note that revapi only adds attachments to the differences, it doesn’t use them for matching, so it doesn’t change what gets ignored.
Enforcer rule (as suggested by @tmortagne): the build fails if an ignore has no versions, or if none of its versions is greater than xwiki.compatibility.previous.version and lower than or equal to the current version of the branch. I didn’t go for “must match the exact version of the branch”: master legitimately keeps ignores of the not-yet-released stable version, and it allows backporting an ignore with its whole list without editing it.
Cleanup script: this is where I’m diverging a bit from my first post. Instead of removing the ignores matching the released version, it keeps in each list only the versions in that same window, and removes the ignore only when nothing is left. For example:
on master after releasing 18.10.1, 18.10.1,19.0.0-rc-1 becomes 19.0.0-rc-1
on master after releasing 18.10.0, 19.0.0-rc-1 is kept (what we lose today)
on stable-18.10.x after releasing 18.10.1, 18.10.1,19.0.0-rc-1 is removed: 19.0.0-rc-1 belongs to master, which has its own copy of the ignore
So to answer @pjeanjean’s point: listing several versions is optional, and you never need to update the list by hand during a backport, the cleanup trims each branch’s copy at its next final release.
Once the commons PR is merged, all the existing ignores of rendering and platform will need to be tagged at the same time, otherwise their builds will break. I’ll take care of it. Same for contrib extensions with revapi ignores inheriting from xwiki-commons-pom: they’ll need to tag them or skip the rule with xwiki.enforcer.revapi-ignore-version.skip.
I think I’d use a more semantic name since version can mean a lot of things. When you read this it’s not obvious what version means. AFAIU it’s the xwiki or extension version in which the ignore was introduced. If we use the JIRA terminology, it’s the affectsVersions and in OP terminology it’s the observedInVersions.
WDYT about using either one of these?
Apart from this, it’s fine for me, thx for working on this automation. I just think that we’re going to mess it whenever we backport branches (as we do for @since versions), but I guess it’s a best effort.