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

[release] 422 Unprocessable Entity during Github release #1421

Open
triceo opened this issue Jun 21, 2023 · 7 comments
Open

[release] 422 Unprocessable Entity during Github release #1421

triceo opened this issue Jun 21, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@triceo
Copy link

triceo commented Jun 21, 2023

I get an exception when releasing a project using JReleaser Maven Plugin (running in Github Actions) configured like so:

  <plugin>
    <groupId>org.jreleaser</groupId>
    <artifactId>jreleaser-maven-plugin</artifactId>
    <version>1.6.0</version>
    <inherited>false</inherited>
    <configuration>
      <jreleaser>
        <signing>
          <active>ALWAYS</active>
          <armored>true</armored>
        </signing>
        <release>
          <github>
            <draft>true</draft>
            <overwrite>true</overwrite>
            <sign>true</sign>
            <issues>
              <enabled>true</enabled>
            </issues>
            <changelog>
              <formatted>ALWAYS</formatted>
              <preset>conventional-commits</preset>
              <contentTemplate>.github/workflows/release-changelog-template.md</contentTemplate>
              <contributors>
                <format>- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}</format>
              </contributors>
            </changelog>
          </github>
        </release>
        <deploy>
          <maven>
            <nexus2>
              <maven-central>
                <active>ALWAYS</active>
                <!-- TODO Remove verifyPom tag, hack for https://github.com/jreleaser/jreleaser/issues/1397 -->
                <verifyPom>false</verifyPom>
                <url>https://s01.oss.sonatype.org/service/local</url>
                <closeRepository>true</closeRepository>
                <releaseRepository>false</releaseRepository>
                <stagingRepositories>target/staging-deploy</stagingRepositories>
                <artifactOverrides>
                  <artifactOverride>
                    <groupId>ai.timefold.solver</groupId>
                    <artifactId>timefold-solver-core</artifactId>
                    <sourceJar>false</sourceJar>
                    <javadocJar>false</javadocJar>
                  </artifactOverride>
                  <artifactOverride>
                    <groupId>ai.timefold.solver</groupId>
                    <artifactId>timefold-solver-spring-boot-starter</artifactId>
                    <sourceJar>false</sourceJar>
                    <javadocJar>false</javadocJar>
                  </artifactOverride>
                  <artifactOverride>
                    <groupId>ai.timefold.solver</groupId>
                    <artifactId>timefold-solver-ide-config</artifactId>
                    <sourceJar>true</sourceJar>
                    <javadocJar>false</javadocJar>
                  </artifactOverride>
                  <artifactOverride>
                    <groupId>ai.timefold.solver</groupId>
                    <artifactId>timefold-solver-webui</artifactId>
                    <sourceJar>true</sourceJar>
                    <javadocJar>false</javadocJar>
                  </artifactOverride>
                </artifactOverrides>
              </maven-central>
            </nexus2>
          </maven>
        </deploy>
      </jreleaser>
    </configuration>
  </plugin>

This is the last thing I get in the trace log:

[DEBUG] fetching all branches on TimefoldAI/timefold-solver
[DEBUG] looking up release with tag v0.10.0 at repository TimefoldAI/timefold-solver
[DEBUG] fetching release on TimefoldAI/timefold-solver with tag v0.10.0
[DEBUG] release v0.10.0 does not exist
[DEBUG] creating release v0.10.0
[DEBUG] tagging local repository with v0.10.0
[DEBUG] creating release on TimefoldAI/timefold-solver with tag v0.10.0
422 Unprocessable Entity
org.jreleaser.sdk.commons.RestAPIException: 422: Unprocessable Entity
at org.jreleaser.sdk.commons.ClientUtils.lambda$builder$1(ClientUtils.java:113)
    ...
Caused by: org.jreleaser.sdk.commons.RestAPIException: 422: Unprocessable Entity
at org.jreleaser.sdk.commons.ClientUtils.lambda$builder$1(ClientUtils.java:113)
at feign.ResponseHandler.decodeError(ResponseHandler.java:136)
at feign.ResponseHandler.handleResponse(ResponseHandler.java:70)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:114)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:70)
at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:96)
at jdk.proxy3/jdk.proxy3.$Proxy31.createRelease(Unknown Source)
at org.jreleaser.sdk.github.Github.createRelease(Github.java:334)
at org.jreleaser.sdk.github.GithubReleaser.createRelease(GithubReleaser.java:352)
at org.jreleaser.sdk.github.GithubReleaser.createRelease(GithubReleaser.java:235)
... 35 more

This is the branch of our project that exhibits the issue:
https://github.com/TimefoldAI/timefold-solver/tree/triceo-releasetest

This was the run that failed:
https://github.com/TimefoldAI/timefold-solver/actions/runs/5332409307

@triceo triceo added the bug Something isn't working label Jun 21, 2023
@triceo
Copy link
Author

triceo commented Jun 21, 2023

Could it be that, while this new release is v0.10.0, the previous release was 0.9.39 (without the v), and therefore nothing could be found?

@aalmiray
Copy link
Member

I believe I’ve seen this 422 error before at least once. I think it’s not related to a change in tag pattern as that affects changelog generation, not release publication.

@triceo
Copy link
Author

triceo commented Jun 21, 2023

I have just confirmed it is related to the tag.
When I specified previousTagName, the issue went away.
(Or it went away for a different environmental reason.)

@aalmiray
Copy link
Member

Alright, thanks for verifying. I suppose there's a recent change that requires the tag pattern also during release 😅

@aalmiray aalmiray changed the title 422 Unprocessable Entity during Github release [release] 422 Unprocessable Entity during Github release Jun 21, 2023
@aalmiray
Copy link
Member

FWIW 422 is returned when validation fails or the endpoint has been spammed -> https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release

The error occurs after setting initial parameters to create a release

GhRelease release = new GhRelease();
release.setName(github.getEffectiveReleaseName());
release.setTagName(tagName);
release.setTargetCommitish(github.getResolvedBranchPush(context.getModel()));
release.setBody(changelog);
if (github.getPrerelease().isEnabledSet()) {
release.setPrerelease(github.getPrerelease().isEnabled());
}
if (github.isDraftSet()) {
release.setDraft(github.isDraft());
}
boolean isDraftBefore = release.isDraft();
release = api.createRelease(github.getOwner(), github.getName(), release);

Do you have access to the trace.log file when the release failed? Would like to find out what were the resolved values for the release section.

@triceo
Copy link
Author

triceo commented Jun 21, 2023

trace.log

I've attached the trace log from that run.

@aalmiray
Copy link
Member

I'm going on a limb here but I think setting the release to draft may be the cause. I have to test this theory. We used to rely on hub4j (external dependency) for interacting with the GitHub REST API. Recently we moved away from it and provided our own implementation. It's possible we missed something during that migration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants