Skip to content

HSEARCH-5351 Switch to JReleaser for nexus publishing #4564

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marko-bekhta
Copy link
Member

https://hibernate.atlassian.net/browse/HSEARCH-5351

and the script for snapshots publishing through jreleaser: hibernate/hibernate-release-scripts#39


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


@marko-bekhta marko-bekhta requested a review from yrodiere April 10, 2025 10:33
@marko-bekhta marko-bekhta force-pushed the build/HSEARCH-5351-Switch-to-JReleaser-for-nexus-publishing branch 2 times, most recently from 5428768 to 437ceb9 Compare April 10, 2025 14:21
Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

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

I added a few comments, but LGTM overall. Thanks!

pom.xml Outdated
Comment on lines 1108 to 1110
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

You can probably remove these lines as well? The deploy plugin is enabled by default, AFAIK.

.gitignore Outdated
@@ -7,6 +7,7 @@
# Our build scripts - necessary for our release jobs
hibernate-noorm-release-scripts
hibernate-release-scripts
jreleaser
Copy link
Member

Choose a reason for hiding this comment

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

This is probably no longer needed, since the scripts now "install" jreleaser in hibernate-release-scripts?

url: https://oss.sonatype.org/service/local
snapshotUrl: https://oss.sonatype.org/content/repositories/snapshots/
closeRepository: true
releaseRepository: false
Copy link
Member

Choose a reason for hiding this comment

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

So we want to keep logging into the Nexus repository web UI to click the "release" button?

Fine by me, but I wonder: is there an equivalent for the Maven Central publishing API? If not, we'll probably want to make sure we don't rely on this manual step...

Copy link
Member Author

Choose a reason for hiding this comment

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

the idea here was not to release the repository while testing the migration, as for the future ... we can flip the flag for maintenance branches, as for the main one... idk... if we aren't adding new artifacts then it's probably fine to release the repo automatically, but if we are .. it'll probably be safer to go check the staged bundle before releasing, no?

as for the new APIs, I think they have some alternative to this:

The MavenCentral Maven deployer allows executing deployments in stages that is, you may set the stage property to UPLOAD, PUBLISH, and/or FULL

https://jreleaser.org/guide/latest/reference/deploy/maven/maven-central.html#_staged_deployments

but ... you know, I haven't tested this yet 😄
and while I was writing the comment, I thought I can (probably) try it on a local nexus, unless it's a Pro feature ...

jreleaser.yml Outdated
stagingRepositories:
- target/staging-deploy/maven
# Deployment identifier used for publication.
# deploymentId: dd9991b0-18a7-41e7-b1fe-37b8ea936f85
Copy link
Member

Choose a reason for hiding this comment

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

This is not a secret?

Copy link
Member Author

Choose a reason for hiding this comment

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

tbh ... I'm not sure if this one will even be required, I only copied it from the docs, and it is marked as optional. I think that it might only be needed if we do a release in multiple steps... but will have to test it to see 😃

The MavenCentral deployer requires the deploymentId property to be set when the stage is set to PUBLISH.

https://jreleaser.org/guide/latest/reference/deploy/maven/maven-central.html#_staged_deployments

@@ -62,13 +62,19 @@ pipeline {
def developmentVersion = Version.parseDevelopmentVersion(params.DEVELOPMENT_VERSION)
echo "Performing full release for version ${releaseVersion.toString()}"

withMaven(mavenSettingsConfig: params.RELEASE_DRY_RUN ? null : 'ci-hibernate.deploy.settings.maven',
mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
withMaven(mavenSettingsConfig: null, mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') {
Copy link
Member

Choose a reason for hiding this comment

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

The goal of the custom Maven settings here was also to override the default, which uses our Nexus mirror. We probably don't want to use the Nexus mirror during releases, and use "actual" dependencies downloaded from Maven central instead. Just in case our cache was poisoned somehow (mistakes happen).

See also how we use the custom Maven settings in snapshot publishing.

Note that we indeed don't need the credentials in Maven settings anymore. We should probably remove them from these maven settings on Jenkins once we switched to JReleaser everywhere.

@marko-bekhta marko-bekhta force-pushed the build/HSEARCH-5351-Switch-to-JReleaser-for-nexus-publishing branch from 437ceb9 to 6e6ed95 Compare April 25, 2025 09:02
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