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

[MNG-8211] Fail the build if CI Friendly revision used without value #1656

Merged
merged 6 commits into from
Aug 22, 2024

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Aug 15, 2024

As this is almost always source of confusion. If feature is used and there is no proper value set, fail the build, as users for sure does not plan to deploy artifacts with version ${revision} (or any expression in project.version).

Still, to not be disruptive, the old behaviour can be achieved by setting maven.build.allowExpressionInEffectiveProjectVersion=true project property.


https://issues.apache.org/jira/browse/MNG-8211

As this is almost always source of confusion. If feature is used
and there is no proper value set, fail the build, as users for
sure does not plan to deploy artifacts with version `${revision}`.

---

https://issues.apache.org/jira/browse/MNG-8211
@cstamas cstamas self-assigned this Aug 15, 2024
@cstamas
Copy link
Member Author

cstamas commented Aug 15, 2024

Copy link

@laeubi laeubi left a comment

Choose a reason for hiding this comment

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

It seems currently only one value is assumed but one can combine values e.g.

<version>${revision}${sha1}${changelist}</version>

see

Matcher m = CI_FRIENDLY_EXPRESSION.matcher(string.trim());
while (m.find()) {
String property = m.group(1);
if (!versionProcessor.isValidProperty(property)) {
addViolation(
problems,
severity,
version,
fieldName,
null,
"contains an expression but should be a constant.",
tracker);
return false;
}
}

@cstamas
Copy link
Member Author

cstamas commented Aug 20, 2024

This PR does it in wrong place:

  • this should happen in validator when validating effective model?

@cstamas
Copy link
Member Author

cstamas commented Aug 20, 2024

Example of failure: https://gist.github.com/cstamas/01b1b6152aca56f1383148ef74245583

@cstamas
Copy link
Member Author

cstamas commented Aug 21, 2024

This PR would really help to reduce user confusion with CI Friendly version.
Combined with Nisse https://github.com/maveniverse/nisse they can have full experience.

@cstamas cstamas added this to the 3.9.10 milestone Aug 22, 2024
@cstamas
Copy link
Member Author

cstamas commented Aug 22, 2024

Last example of failure but also the "escape hatch" in effect: https://gist.github.com/cstamas/1e880b2381bf1c543db052a1298e5074

@cstamas cstamas merged commit 0d5ab52 into apache:maven-3.9.x Aug 22, 2024
12 checks passed
@cstamas cstamas deleted the maven-3.9.x-MNG-8211 branch August 22, 2024 10:54
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.

3 participants