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

Fix JReleaser not working anymore #1724

Open
jponge opened this issue Oct 24, 2024 · 29 comments
Open

Fix JReleaser not working anymore #1724

jponge opened this issue Oct 24, 2024 · 29 comments
Assignees
Labels
ci/cd/build CI/CD pipeline and build

Comments

@jponge
Copy link
Member

jponge commented Oct 24, 2024

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

  • GitHub release notes are not computed properly
  • GitHub discussions announcements are 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 jponge added the ci/cd/build CI/CD pipeline and build label Oct 24, 2024
@jponge jponge added this to the 2.7.0 milestone Oct 24, 2024
@jponge jponge self-assigned this Oct 24, 2024
@jponge
Copy link
Member Author

jponge commented Oct 24, 2024

/cc @cescoffier @gastaldi @aalmiray)

@aalmiray
Copy link

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
Copy link

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

@jponge
Copy link
Member Author

jponge commented Oct 24, 2024

@aalmiray
Copy link

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
Copy link

@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
Copy link
Member Author

jponge commented Oct 24, 2024

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
Copy link
Member Author

jponge commented Oct 24, 2024

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

@aalmiray
Copy link

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

@jponge
Copy link
Member Author

jponge commented Nov 20, 2024

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
Copy link
Member Author

jponge commented Nov 20, 2024

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

@aalmiray
Copy link

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

@jponge
Copy link
Member Author

jponge commented Nov 20, 2024

@jponge
Copy link
Member Author

jponge commented Nov 20, 2024

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
Copy link

aalmiray commented Nov 20, 2024

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 e9b402f

@jponge
Copy link
Member Author

jponge commented Nov 20, 2024 via email

@aalmiray
Copy link

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
Copy link

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
Copy link

The local release was ran form the main branch. Then tried to run it from a release branch an encountered an error such as jreleaser/jreleaser#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
Copy link
Member Author

jponge commented Nov 20, 2024

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
Copy link

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

@jponge
Copy link
Member Author

jponge commented Nov 21, 2024

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

@aalmiray
Copy link

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:

  • clone https://github.com/aalmiray/smallrye-mutiny
  • created a local branch release/2.7.0-RC4
  • pushed the branch to remote
  • performed a release with JReleaser: gm -ntp -Pjreleaser jreleaser:release -Djreleaser.dry.run=false -pl :mutiny-project

A release was successfully posted without errors.

@jponge
Copy link
Member Author

jponge commented Nov 21, 2024

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
Copy link

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

@jponge
Copy link
Member Author

jponge commented Nov 21, 2024

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
Copy link

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

@jponge
Copy link
Member Author

jponge commented Nov 21, 2024

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

@jponge
Copy link
Member Author

jponge commented Nov 21, 2024

@jponge jponge removed this from the 2.7.0 milestone Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/cd/build CI/CD pipeline and build
Projects
None yet
Development

No branches or pull requests

2 participants