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

Inconsistent build-qualifier computation between goals tycho-packaging-plugin:build-qualifier and package-feature #553

Closed
HannesWell opened this issue Jan 22, 2022 · 7 comments
Milestone

Comments

@HannesWell
Copy link
Member

The goals and tycho-packaging-plugin:build-qualifier and tycho-packaging-plugin:package-feature seem to have a different logic how to compute/obtain the build-qualifier of a plugin included in a feature with respect to merged git-branches.

The build-qualifier goal seems to consider the paths via both parent-git-commits of a merge-commit when computing the latest time a Plug-in was touched by a commit, while the package-feature goal seems to consider only one parent/path (in my case only the second one). But maybe the build-qualifier goal just takes the other one and is 'right' by chance in this case.

This can lead to errors like the following where the dependency of a feature to a plug-in cannot be resolved during the assembly of the repository:

[INFO] --- tycho-p2-repository-plugin:2.6.0:assemble-repository (default-assemble-repository) @ org.eclipse.m2e.site ---
[INFO] {osgi.os=win32, osgi.ws=win32, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: org.eclipse.m2e.site raw:1.16.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):1.16.0-SNAPSHOT
[ERROR]   Missing requirement: org.eclipse.m2e.feature.feature.group 1.19.2.20220121-2010 requires 'org.eclipse.equinox.p2.iu; org.eclipse.m2e.sourcelookup [1.17.5.20220120-2044,1.17.5.20220120-2044]' but it could not be found
[ERROR]   Cannot satisfy dependency: org.eclipse.m2e.site raw:1.16.0.'SNAPSHOT'/format(n[.n=0;[.n=0;[-S]]]):1.16.0-SNAPSHOT depends on: org.eclipse.equinox.p2.iu; org.eclipse.m2e.feature.feature.group 0.0.0

The version required by the feature is 1.17.5.20220120-2044 while that plug-in is build with version 1.17.5.20220121-0829:

[INFO] ------------< org.eclipse.m2e:org.eclipse.m2e.sourcelookup >------------
[INFO] Building [bundle] M2E Source Lookup Core 1.17.5-SNAPSHOT         [23/53]
[INFO] ---------------------------[ eclipse-plugin ]---------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ org.eclipse.m2e.sourcelookup ---
[INFO] 
[INFO] --- tycho-packaging-plugin:2.6.0:build-qualifier (default-build-qualifier) @ org.eclipse.m2e.sourcelookup ---
[INFO] The project's OSGi version is 1.17.5.20220121-0829

The Git-History looks like the following and the build was performed with the currently checkout branch guavaOld:

grafik

On the master branch the affected plug-in was last touched with commit 7a6f149 on the branch being built that plug-in was last touched with commit 43cc2ad:

grafik

What's interesting is that the feature.xml file written to the feature-project's target folder (in this case org.eclipse.m2e.feature\target\feature.xml) contains the correctly expanded versions, but in the jar file created next to it the feature.xml has the wrong version of the included plug-in. So it looks like the mistake is happening in the packing step.

@laeubi
Copy link
Member

laeubi commented Jan 22, 2022

Just wondering, do you do an incremental build (mvn install) or do you ensure its a full build (mvn clean install)?

@HannesWell
Copy link
Member Author

HannesWell commented Jan 22, 2022

After continuing my debugging it looks like the tycho-p2-plugin:p2-metadata is the cause in this case

[INFO] tycho-p2-plugin:2.6.0:p2-metadata-default (default-p2-metadata-default) org.eclipse.m2e.feature ---
[WARNING] MavenProject: org.eclipse.m2e:org.eclipse.m2e.feature:1.19.2-SNAPSHOT @ C:\dev\git\eclipse.m2e-core\org.eclipse.m2e.feature\.polyglot.feature.xml: baseline and build artifacts have same version but different contents
   no-classifier: different
      META-INF/ECLIPSE_.RSA: present in baseline only
      META-INF/ECLIPSE_.SF: present in baseline only
      feature.xml: different
      p2.inf: different

[INFO] MavenProject: org.eclipse.m2e:org.eclipse.m2e.feature:1.19.2-SNAPSHOT @ C:\dev\git\eclipse.m2e-core\org.eclipse.m2e.feature\.polyglot.feature.xml
    The main artifact has been replaced with the baseline version.

In the m2e-build on the Jenkins server, that is affected here, the p2-metadata goal is used instead of p2-metadata-default but the effect is the same.

While the replacement of the m2e.feature actually makes sense (it was not touched in the meantime), although it leads to the described errors, I wonder why the replacement does not happen if all changes are squashed on top of the current master?
Not replacing the feature-jar is the correct behavior in this case but the logic that prevents the replacement seems to not consider merged branches.

@HannesWell
Copy link
Member Author

Just wondering, do you do an incremental build (mvn install) or do you ensure its a full build (mvn clean install)?

I do a full build mvn clean verify.

@laeubi
Copy link
Member

laeubi commented Jan 22, 2022

You need to increment the feature version as well if you increment a bundle version, this is not the tycho-p2-plugin:p2-metadata plugin but the baseline replace mojo.

@HannesWell
Copy link
Member Author

You need to increment the feature version as well if you increment a bundle version, this is not the tycho-p2-plugin:p2-metadata plugin but the baseline replace mojo.

But I did not increment the bundle version. It was incremented in the commit before (7a6f149), but since there was no release in-between I did not have to increment it. The feature version was incremented longer before both commits, but there was also no release since then. I think this is fine.

I think the problem here is that due to other commits that were pushed on the master-branch in the meantime a newer version of the feature (in terms of build-qualifier) is available in the base-line repo. And because there was no other commit on the branch that touches anything that would affect the features build-qualifier, the feature version is driven by that other commits change. So the feature is correctly replaced by the base-line version since it has the exact same version (including build-qualifier) as the one in the baseline. But that baseline-version of the feature contains the wrong build-qualifier of the plugin.

So it looks like everything works as expected. However I have the impression that the baseline replacement performed by the tycho-p2-plugin:p2-metadata plugin does not work well with a GitHub workflow where one performs merges on a branch. In this case force pushes avoid this problem.

@laeubi
Copy link
Member

laeubi commented Jan 22, 2022

Tycho tycho-p2-plugin:p2-metadata plugindos not do the replacement as far as I know, this "replace with baseline" is something specifically requested by the m2e pom and not tycho standard behavior.

@HannesWell
Copy link
Member Author

Tycho tycho-p2-plugin:p2-metadata plugindos not do the replacement as far as I know, this "replace with baseline" is something specifically requested by the m2e pom and not tycho standard behavior.

It looks like it actually is the default behavior of the tycho-p2-plugin:p2-metadata plugin. The field baselineReplace of P2MetadataMojo defaults to all. About all the doc says:
(default): Replace build artifacts with baseline version. Attached artifacts only present in the build are removed.

@laeubi laeubi added this to the 2.7 milestone Feb 13, 2022
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

No branches or pull requests

2 participants