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

Task initializeSonatypeStagingRepository fails when using gradle-setup action #347

Open
nsenave opened this issue Jul 19, 2024 · 12 comments

Comments

@nsenave
Copy link

nsenave commented Jul 19, 2024

Hi, thanks for your plugin which helps a lot.

I use the plugin in a GitHub workflow which can be summarized like this:

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-java@v4
        # with: env variables and secrets 
      - uses: gradle/gradle-build-action@v3
      - run: ./gradlew clean publishToSonatype closeAndReleaseSonatypeStagingRepository
        # with: env variables and secrets

Works fine.

I've recently replaced gradle/gradle-build-action@v3 (which is deprecated) with gradle/actions/setup-gradle@v3.

Then, I have this error:

Run ./gradlew clean publishToSonatype closeAndReleaseSonatypeStagingRepository
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :model:clean UP-TO-DATE

> Task :initializeSonatypeStagingRepository FAILED
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':initializeSonatypeStagingRepository'.
2 actionable tasks: 1 executed, 1 up-to-date
> Failed to load staging profiles, server at https://oss.sonatype.org/service/local/ responded with status code 403, body: <html>
    <head>
      <title>403 - Forbidden</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  
      <link rel="icon" type="image/png" href="https://oss.sonatype.org/favicon.png">
      <!--[if IE]>
      <link rel="SHORTCUT ICON" href="https://oss.sonatype.org/favicon.ico"/>
      <![endif]-->
  
      <link rel="stylesheet" href="https://oss.sonatype.org/static/css/Sonatype-content.css?2.15.1-02" type="text/css" media="screen" title="no title" charset="utf-8">
    </head>
    <body>
      <h1>403 - Forbidden</h1>
      <p>Forbidden</p>
    </body>
  </html>

Gradle wrapper version used: 8.6

Actions gradle-build-action and actions/setup-gradle are supposed to be functionally identical, so it might be an issue on their side in the end.

Yet, I thought you might have an idea / ways to reproduce the bug and diagnose why the error happens.

@joffrey-bion
Copy link

joffrey-bion commented Jul 20, 2024

I got the same error, but I think that has to do with Sonatype changing its authentication system. Did you check that you can still login on https://oss.sonatype.org/? Did you try to generate a new user token?

@szpak
Copy link
Contributor

szpak commented Jul 20, 2024

I would also recommend generating the new token. Some other people were reporting the similar problem on the Sonatype mailing list recently.

@nsenave
Copy link
Author

nsenave commented Jul 22, 2024

Thanks for the quick answers. I should have precised that I managed to publish a few minutes after receving the 403 error by using back the "gradle-build-action".

A sonatype login could look coherent indeed, yet it seems that it doesn't match in my case:

  • Jul 12, at morning: the user token was changed
  • Jul 12, afternoon: a publication succeeded (using gradle-build-action@v3 in the workflow)
  • Jul 19: publication fails (using actions/setup-gradle@v3)
  • Jul 19, few minutes after, using gradle-build-action@v3 back: publication succeeded

Seems like something weird happens with caching, but I'm having a hard time understanding what that could be: maybe definitely an issue for the gradle setup action.

@joffrey-bion
Copy link

joffrey-bion commented Aug 19, 2024

I'm getting errors too, but 401s now. Any news on this?

@szpak
Copy link
Contributor

szpak commented Aug 20, 2024

@joffrey-bion Is this still happening after 12-24 hours?

@joffrey-bion
Copy link

joffrey-bion commented Aug 20, 2024

Yes, the first occurrence was about 4 days ago, and I'm still facing the issue in multiple repositories. For example:

https://github.com/joffrey-bion/socketio-kotlin/actions/workflows/release.yml
https://github.com/joffrey-bion/chrome-devtools-kotlin/actions/workflows/release.yml

The latest build scan:
https://gradle.com/s/hu4rt37gjoa2o

@szpak
Copy link
Contributor

szpak commented Aug 20, 2024

Have you re-generated your Nexus token (and updated in in GH)?

@joffrey-bion
Copy link

joffrey-bion commented Aug 20, 2024

Yes, sorry not to have mentioned this more clearly. I generated a new token and updated my repo secrets with it (a while back, a few days ago, and again yesterday), to no avail.

FTR, I'm also using the setup-gradle action (v4 now), but the failure doesn't seem to correlate with the version change, nor the use of setup-gradle for me. I wonder if this could be some kind of caching issue.

@joffrey-bion
Copy link

joffrey-bion commented Aug 20, 2024

It looks like for some repos the failure correlates with the upgrade to Gradle 8.10, but that might be a red herring, because at least one of my repos could publish fine with Gradle 8.10 and setup-gradle v4.

@joffrey-bion
Copy link

joffrey-bion commented Aug 24, 2024

Ok sorry for the noise about this, the 401s were caused because of an unfortunate naming of secrets, and I had swapped the username and password. All good now.

@szpak
Copy link
Contributor

szpak commented Aug 25, 2024

@joffrey-bion Thanks for the update!

@nsenave Have you manager to solve the problem with your repo?

@nsenave
Copy link
Author

nsenave commented Sep 30, 2024

Situation didn't change for me since my last comment, I'll give it another try and keep you informed.

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

No branches or pull requests

3 participants