sbt-sonatype icon indicating copy to clipboard operation
sbt-sonatype copied to clipboard

Promotion Success / Process Failed

Open darkfrog26 opened this issue 4 years ago • 19 comments

Describe the bug After I get the message "The promote stage is in progress", it starts showing: Execution failed: [404: Not Found] Request failed: {"errors":[{"id":"*","msg":"No activity for repository: comoutr-1003"}]}. Retrying in 15.00 sec. - (SonatypeClient.scala:172)

Perpetually. It would appear as though the promotion was successful, but the plugin never finishes because it just keeps getting the "No activity" response.

How to reproduce the issue It doesn't always happen, but it is frequently happening ever since I migrated to "https://s01.oss.sonatype.org/service/local"

  • sbt version: 1.6.1
  • sbt-sonatype version: 3.9.10
  • Show your build settings:
$ sbt
> sonatypeProfileName
com.outr
> sonatypeRepository
https://s01.oss.sonatype.org/service/local
  • GitHub repository: https://github.com/outr/scribe

Additional context Just released 3.6.6 and it happened with it, but I believe it was successfully released.

darkfrog26 avatar Dec 30 '21 18:12 darkfrog26

More people experienced this: https://github.com/sbt/sbt-ci-release/issues/223

mkurz avatar Jan 04 '22 18:01 mkurz

I think we need to confirm two things:

  • A: Is sbt-sonatype accessing the endpoints in https://s01.oss.sonatype.org? This configuration is extracted here from the project https://github.com/xerial/sbt-sonatype/blob/245cf62923595ae9605d80bc3c5bf8942538799c/src/main/scala/xerial/sbt/Sonatype.scala#L416
  • B: Is there any change in the behavior between s01.oss.sonatype.org and oss.sonatype.org about the closing endpoint?

Unfortunately, I don't have any s01 sonatype account, so help for confirming these two points is appreciated.

xerial avatar Feb 11 '22 16:02 xerial

Got the same issue after upgrading sbt-ci-release 1.5.7 => 1.5.10, https://github.com/CartoDB/analytics-toolbox-databricks/runs/5159176823?check_suite_focus=true

But the relelease went fine: https://repo1.maven.org/maven2/com/carto/analyticstoolbox/core_2.12/0.0.3/

pomadchin avatar Feb 11 '22 17:02 pomadchin

I had a chance to look into it a bit: https://github.com/xerial/sbt-sonatype/compare/3.9.7...3.9.11 The only suspisious PR in this list is #242

There is indeed a regression introduced in terms of #242, which is solved now by having a ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org" defined in the build.sbt file.

TlDR; the per project sonatypeCredentialHost settings gets overrided(?) (or gets wrognly picked up) and is not enough to have, that should be set globally only.

A tiny proof with the green release.

I am not sure if that is a desired behavior.

P.S. snapshots were published fine even with out the globally set sonatypeCredentialHost.

And theoretically that could be not directly #242, but smth around as well.

pomadchin avatar Feb 11 '22 19:02 pomadchin

@pomadchin Thanks.

It seems @darkfrog26 also has this setting, but experiencing the same error occasionally:

ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org"

To identify the cause, adding some info log to see which repository URLs are actually used around here would be the next step: https://github.com/xerial/sbt-sonatype/blob/245cf62923595ae9605d80bc3c5bf8942538799c/src/main/scala/xerial/sbt/Sonatype.scala#L416-L418

xerial avatar Feb 14 '22 19:02 xerial

@xerial hmmm the only difference with my build is that I have it set both per project and globally ._.' what a tricky behavior to debug.

pomadchin avatar Feb 14 '22 19:02 pomadchin

It looks like the issue of configuration scopes. I guess depending on the context within sbt, extracting project settings via Project.extract(state) references unexpected projects. https://github.com/xerial/sbt-sonatype/blob/245cf62923595ae9605d80bc3c5bf8942538799c/src/main/scala/xerial/sbt/Sonatype.scala#L412

An approach would be changing sonatypeXXX commands into an sbt task definition or finding a way to get a consistent reference to the root project when calling Project.extract(state)

xerial avatar Feb 16 '22 22:02 xerial

Probably I've found the cause: https://github.com/xerial/sbt-sonatype/blob/245cf62923595ae9605d80bc3c5bf8942538799c/src/main/scala/xerial/sbt/Sonatype.scala#L68

This setting is not referencing ThisBuild / sonatypeCredentialHost, so the setting might vary depending on the context project. If that's the case, your log might show in the failed deployment:

 info [SonatypeService] sonatypeRepository  : https://oss.sonatype.org/service/local

If s01.oss.sonatype.org is set in sonatypeCredentialHost, the url should be https://s01.oss.sonatype.org/service/local

xerial avatar Feb 17 '22 20:02 xerial

@xerial, awesome! When will this be released?

darkfrog26 avatar Feb 17 '22 21:02 darkfrog26

Released sbt-sonatype 3.9.12 with a fix in #285. I'm not sure this will solve the problem, but let me know if you still experience the issue.

xerial avatar Feb 18 '22 17:02 xerial

@xerial thank you, this is great! I won't be able to check it immediately sadly 🤦 I have only one package that is shipped via the fresh sonatype repo. Until the next release than (will try to do it as soon as its possible to cut one).

pomadchin avatar Feb 18 '22 17:02 pomadchin

All of my open-source projects are now on s01, so I'll drop a message if I see this again. Thanks, @xerial!

darkfrog26 avatar Feb 18 '22 19:02 darkfrog26

Hi, I appreciate all the effort to improve experience for publishing to s01 :)

Unfortunately, the changes in https://github.com/xerial/sbt-sonatype/pull/285 are not backwards compatible and will break all of our existing builds publishing to s01 using sbt-typelevel.

[MISSING_CREDENTIAL] No credential is found for oss.sonatype.org. Prepare ~/.sbt/(sbt_version)/sonatype.sbt file.
	at xerial.sbt.sonatype.SonatypeClient.$anonfun$directCredentials$1(SonatypeClient.scala:45)
	at scala.Option.getOrElse(Option.scala:189)
	at xerial.sbt.sonatype.SonatypeClient.directCredentials$lzycompute(SonatypeClient.scala:43)
	at xerial.sbt.sonatype.SonatypeClient.directCredentials(SonatypeClient.scala:39)
	at xerial.sbt.sonatype.SonatypeClient.<init>(SonatypeClient.scala:52)
	at xerial.sbt.Sonatype$.withSonatypeService(Sonatype.scala:432)
	at xerial.sbt.Sonatype$.$anonfun$sonatypeBundleRelease$1(Sonatype.scala:177)
	at sbt.Command$.$anonfun$command$2(Command.scala:97)
	at sbt.Command$.process(Command.scala:189)
	at org.typelevel.sbt.TypelevelSonatypePlugin$.$anonfun$sonatypeBundleReleaseIfRelevant$1(TypelevelSonatypePlugin.scala:88)
[error] [MISSING_CREDENTIAL] No credential is found for oss.sonatype.org. Prepare ~/.sbt/(sbt_version)/sonatype.sbt file.

armanbilge avatar Feb 19 '22 01:02 armanbilge

For the record, I have also experienced the problem originally reported in this issue (for example in https://github.com/typelevel/sbt-typelevel/issues/84#issuecomment-1018082422). However, I have seen it on the legacy host (not s01) and every time it has happened the release has always completed successfully anyway.

So IMHO I don't think this is related at all to the credential host.

armanbilge avatar Feb 19 '22 01:02 armanbilge

I am getting the same problem since I upgraded to 3.9.12:

[MISSING_CREDENTIAL] No credential is found for oss.sonatype.org. Prepare ~/.sbt/(sbt_version)/sonatype.sbt file.

Thanks

simao avatar Feb 24 '22 12:02 simao

We need to release a new version, which fixes this regression. Use sbt-sonatype 3.9.11 for a while. I'm a bit busy this week

xerial avatar Feb 28 '22 18:02 xerial

I still get the original error of this issue (error after promotion) with v3.9.12. It seems it breaks for legacy users of oss.sonatype.org who don't even have the ssetting in their build? My build configuration: https://github.com/albuch/sbt-dependency-check/blob/main/build.sbt

albuch avatar Mar 09 '22 21:03 albuch

Released sbt-sonatype 3.9.13, which reverted #276.

xerial avatar May 24 '22 19:05 xerial

This issue is related to https://github.com/xerial/sbt-sonatype/issues/309

xerial avatar Feb 04 '23 00:02 xerial