smallrye / smallrye-mutiny

An Intuitive Event-Driven Reactive Programming Library for Java
https://smallrye.io/smallrye-mutiny
Apache License 2.0
817 stars 128 forks source link

Fix JReleaser not working anymore #1724

Open jponge opened 1 month ago

jponge commented 1 month ago

With the update to the SmallRye release workflows, JReleaser is not working anymore:

In the interim I have added a task in justfile (aka just jreleaser) that replicates what was previously working in CI. When we do this locally a proper changelog is being computed, but the GitHub release note isn't updated so we need to do that manually. Still, the Maven plugin is configured with overwrite to yes, so this should perform the update according to the JReleaser docs.

The major change compared to the previous workflow (see at tag 2.6.2 https://github.com/smallrye/smallrye-mutiny/tree/b6b0934ee5594630347079426d2a1721d08ab3d9) is that JReleaser is not doing the release and tagging anymore as this is now done by the maven-release-plugin in the prepare-release.yml workflow. The JReleaser configuration has been updated to reflect that change properly (<skipTag>true</skipTag>).

One thing we might explore (first week of November) is to replace the prepare-release.yml workflow by using JReleaser again to tag and release with it, which would have us adopt half of the classic SmallRye release workflows.

jponge commented 1 month ago

/cc @cescoffier @gastaldi @aalmiray)

aalmiray commented 1 month ago

Might be related to a push I made yesterday evening when computing the target commit to be tagged. The change was reverted a few hours ago. Latest early-access release should have the fix.

aalmiray commented 1 month ago

@jponge which version of JReleaser was used when the problem occurred?

jponge commented 1 month ago

@aalmiray this is with 1.14.0 / https://github.com/smallrye/smallrye-mutiny/blob/main/pom.xml

aalmiray commented 1 month ago

What I can tell is that the default tag format is set to v{{projectVersion}} which does not match the tags found in the repo. Please add the following <tagName>{{projectVersion}}</tagName> to the <github> releaser

<github>
    <owner>smallrye</owner>
    <name>smallrye-mutiny</name>
    <enabled>true</enabled>
    <overwrite>true</overwrite>
    <skipTag>true</skipTag>
    <tagName>{{projectVersion}}</tagName>
aalmiray commented 1 month ago

@aalmiray this is with 1.14.0 / https://github.com/smallrye/smallrye-mutiny/blob/main/pom.xml

OK, then please disregard the comment about JReleaser early-access as that only affects users of the JReleaser CLI, not plugins.

jponge commented 1 month ago

Thanks I will try that!

What I can tell is that the default tag format is set to v{{projectVersion}} which does not match the tags found in the repo. Please add the following <tagName>{{projectVersion}}</tagName> to the <github> releaser

<github>
    <owner>smallrye</owner>
    <name>smallrye-mutiny</name>
    <enabled>true</enabled>
    <overwrite>true</overwrite>
    <skipTag>true</skipTag>
    <tagName>{{projectVersion}}</tagName>
jponge commented 1 month ago

That being said, tags are passed using environment variables: JRELEASER_PROJECT_VERSION, JRELEASER_TAG_NAME and JRELEASER_PREVIOUS_TAG_NAME

aalmiray commented 1 month ago

Ah, that makes sense as well. Had no idea those values were set using env vars.

jponge commented 4 days ago

Hi @aalmiray, I think I need your help because I don't understand what's going wrong with the current JReleaser configuration 😉

I've moved most of the workflow to be run locally instead of on GitHub Action (there are only 2 workflows when a tag is created: pushing to Maven Central, and rebuilding the website).

To do that I have a justfile with 2 tasks:

The idea is to have a local branch ready, review it, then perform the release from it once it's all good, and eventually merge it.

My main issue is that in this configuration JReleaser doesn't create any release. The computed changelog is locally ok, but there is no tag, no release and no changelog being uploaded. For some reason GitHub Discussions announcements seem disabled as well.

For what it's worth I have a release branch here: https://github.com/smallrye/smallrye-mutiny/tree/release/2.7.0-RC4 but it won't be merged since no tag has been created from it. The thing that's puzzling me is that I override a bunch of environment variables so that JReleaser knows the release is not on main but another branch (see https://github.com/smallrye/smallrye-mutiny/blob/main/justfile#L39), I override the tag name because we don't use a v prefix, etc.

output.properties looks like this:

#JReleaser 1.15.0
#Wed Nov 20 17:42:26 CET 2024
commitFullHash=44d2898875464d4506f4f056c526bf6216bdc4e7
commitShortHash=44d2898
javaVendor=Oracle Corporation
javaVersion=22
javaVmVersion=22+36-jvmci-b02
milestoneName=2.7.0-RC4
platform=osx-aarch_64
platformReplaced=osx-aarch_64
previousTagName=2.6.2
projectName=mutiny-project
projectSnapshot=false
projectVersion=2.7.0-RC4
projectVersionMajor=2
projectVersionMinor=7
projectVersionNumber=2.7.0
projectVersionPatch=0
projectVersionTag=RC4
releaseBranch=release/2.7.0-RC4
releaseName=Release 2.7.0-RC4
tagName=2.7.0-RC4
timestamp=2024-11-20T17\:42\:21.866501+01\:00

and the Maven plugin logs:

[INFO] --- jreleaser-maven-plugin:1.15.0:full-release (default-cli) @ mutiny-project ---
[INFO] JReleaser 1.15.0
[INFO]   - basedir set to /Users/jponge/Code/Reactive/smallrye-mutiny
[INFO]   - outputdir set to /Volumes/Code/Reactive/smallrye-mutiny/target/jreleaser
[INFO] git-root-search set to false
[INFO] Loading variables from /Users/jponge/.jreleaser/config.properties
[WARNING] Variables source /Users/jponge/.jreleaser/config.properties does not exist
[INFO] Validating configuration
[INFO] Strict mode set to false
[INFO] Project version set to 2.7.0-RC4
[INFO] Release is not snapshot
[INFO] Timestamp is 2024-11-20T17:42:21.866501+01:00
[INFO] HEAD is at 44d2898
[INFO] Platform is osx-aarch_64
[INFO] dry-run set to false
[INFO] Generating changelog
[WARNING] Cannot parse version 'old-jekyll-website-june22'
[WARNING] locking FileBasedConfig[/Users/jponge/.config/jgit/config] failed after 5 retries
[INFO] Storing changelog: ../../../../../Volumes/Code/Reactive/smallrye-mutiny/target/jreleaser/release/CHANGELOG.md
[INFO] Calculating checksums for distributions and files
[INFO]   [checksum] No files configured for checksum. Skipping
[INFO] Cataloging artifacts
[INFO]   Cataloging is not enabled. Skipping
[INFO] Signing distributions and files
[INFO]   [sign] Signing is not enabled. Skipping
[INFO] Deploying Maven artifacts
[INFO]   [maven] Deploying is not enabled. Skipping
[INFO] Uploading distributions and files
[INFO]   [upload] Uploading is not enabled. Skipping
[INFO] Releasing to https://github.com/smallrye/smallrye-mutiny@release/2.7.0-RC4
[WARNING] Changelog is larger than 10K characters. Trimmed content added as release body. Original content added as release asset `README.md`
[INFO] Announcing release
[INFO]   [announce] Announcing is not enabled. Skipping
[INFO] Writing output properties to ../../../../../Volumes/Code/Reactive/smallrye-mutiny/target/jreleaser/output.properties
[INFO] JReleaser succeeded after 1.178 s

Many thanks if you have any idea 🙏

jponge commented 4 days ago

Also the POM configuration is here: https://github.com/smallrye/smallrye-mutiny/blob/main/pom.xml#L560

aalmiray commented 4 days ago

Do you have a copy of the trace.log found at target/jreleaser?

jponge commented 4 days ago

Yes: https://gist.github.com/jponge/97a3a3ad2ad3c7b1a9fd9c39c9aebb54

jponge commented 4 days ago

Interestingly the logs have:

[DEBUG] looking up release with tag 2.7.0-RC4 at repository smallrye/smallrye-mutiny
[DEBUG] fetching release on smallrye/smallrye-mutiny with tag 2.7.0-RC4
[DEBUG] release 2.7.0-RC4 does not exist
[DEBUG] creating release 2.7.0-RC4
[DEBUG] tagging local repository with 2.7.0-RC4 @ 44d2898

but I cannot see a 2.7.0-RC4 tag locally:

$ git tag | grep 2.7
2.7.0-RC1
2.7.0-RC2
2.7.0-RC3
aalmiray commented 4 days ago

There's a bunch of merge commits which inflate the changelog's size. The log has a warning

[WARN]  Changelog is larger than 10K characters. Trimmed content added as release body. Original content added as release asset `README.md`

I'd suggest skipping all merge commits by enabling skipMergeCommits in the changelog.

UPDATE: I've seen you've already done this with https://github.com/smallrye/smallrye-mutiny/commit/e9b402f0c1e2d17062419de870ef5d28c222583b

jponge commented 4 days ago

I did that (not on this run).

Is there anything else that'd look suspicious?

I recall having such too big changelogs when JReleaser was running from GitHub Action, but it never prevented a tag from being created, and I was always able to manually edit the release notes afterwards/

On Wed, Nov 20, 2024 at 8:00 PM Andres Almiray @.***> wrote:

There's a bunch of merge commits which inflate the changelog's size. The log has a warning

[WARN] Changelog is larger than 10K characters. Trimmed content added as release body. Original content added as release asset README.md

I'd suggest skipping all merge commits by enabling skipMergeCommits in the changelog.

— Reply to this email directly, view it on GitHub https://github.com/smallrye/smallrye-mutiny/issues/1724#issuecomment-2489334519, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAGK2JS4IFF42UQDZITGJL2BTL27AVCNFSM6AAAAABQQ6HNVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBZGMZTINJRHE . You are receiving this because you were mentioned.Message ID: @.***>

aalmiray commented 4 days ago

Skipping merge commits still make the changelog too big

$ wc target/jreleaser/release/CHANGELOG.md 
     164     898   14453 target/jreleaser/release/CHANGELOG.md

However JReleaser will truncate the release notes while uploading them as a separate release asset

[INFO] Releasing to https://github.com/aalmiray/smallrye-mutiny@release/2.7.0-RC4
[WARNING] Changelog is larger than 10K characters. Trimmed content added as release body. Original content added as release asset `README.md`
[INFO]  - uploading RELEASE.md
aalmiray commented 4 days ago

I ran a local release and diffed the logs from what you posted. I get pretty much the same results except for the repo owner which was set to aalmiray. At the moment I cannot find the reason for the errors you're seeing.

aalmiray commented 3 days ago

The local release was ran form the main branch. Then tried to run it from a release branch an encountered an error such as https://github.com/jreleaser/jreleaser/issues/1421

I suspect setting the targetCommitish for a release when the remote branch does not yet exist may be causing trouble https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release

But you're not getting this error.

jponge commented 3 days ago

I suspect setting the targetCommitish for a release when the remote branch does not yet exist may be causing trouble https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release

This is why I had pushed the branch to GitHub in the state where the release version was set, so when JReleaser was called the branch did exist both locally and remotely.

aalmiray commented 3 days ago

Ah. That confirms it. I have a bug to file and fix.

jponge commented 3 days ago

In the interim I might experiment with JReleaser to compute a changelog, and gh release to release + tag.

aalmiray commented 3 days ago

Alright. I can confirm that JReleaser will fail with a 422 error when the target branch does not exist in the remote at the time of creating the branch.

Followed these steps on a local environment:

A release was successfully posted without errors.

jponge commented 3 days ago

Thanks @aalmiray, but I had actually pushed the branch, see https://github.com/smallrye/smallrye-mutiny/blob/main/justfile#L25 where I suggest to push the branch after some local checks have been done.

The actual JReleaser call is done after that.

aalmiray commented 3 days ago

Yes, I recall that. Which means the failure you've got must be caused by something else.

jponge commented 3 days ago

I've been able to create a release using gh:

gh release create ${RELEASE_VERSION} \
  --discussion-category 'Announcements' \
  --notes-file target/jreleaser/release/CHANGELOG.md \
  --target ${JRELEASER_BRANCH} \
  --prerelease --latest=false
aalmiray commented 3 days ago

What happened with the changelog being above 10k in size?

jponge commented 3 days ago

It got clipped but it's still complete (you get a "read more" link)

jponge commented 3 days ago

See https://github.com/smallrye/smallrye-mutiny/releases/tag/2.7.0-RC4