jvican / sbt-release-early

Opinionated sbt plugin to release your artifacts early, both on merge and via git tag.
Mozilla Public License 2.0
91 stars 9 forks source link

Multiple staging profiles in Sonatype releases (one per artifact) #34

Closed JanBessai closed 4 years ago

JanBessai commented 5 years ago

Using sbt-release-early with sbt 1.3.0 and Sonatype creates one staging profile per artifact instead of propagating them to the same profile. Here is an example failing with 1.3.0 and proof that things work with 1.2.8. Here is the relevant section of the build log:

[info] Main Scala API documentation successful.
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1-javadoc.jar
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1.jar
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1-sources.jar
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1-javadoc.jar.asc
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1-sources.jar.asc
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1.pom.asc
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1.jar.asc
[info]  published templating_2.11 to https://oss.sonatype.org/service/local/staging/deploy/maven2/org/combinators/templating_2.11/1.0.0+10-2c2a11f1/templating_2.11-1.0.0+10-2c2a11f1.pom
[success] Total time: 103 s (01:43), completed Sep 20, 2019, 6:20:23 PM
[info] Nexus repository URL: https://oss.sonatype.org/service/local
[info] sonatypeProfileName = org.combinators
[info] Reading staging repository profiles...
[error] Multiple repositories are found:
[error] [orgcombinators-1098] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] [orgcombinators-1099] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] [orgcombinators-1100] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] [orgcombinators-1101] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] [orgcombinators-1102] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] [orgcombinators-1103] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] [orgcombinators-1104] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] [orgcombinators-1105] status:open, profile:org.combinators(1003943c9bbbfd) description: Implicitly created (auto staging).
[error] Specify one of the repository ids in the command line
[error] java.lang.IllegalStateException: Found multiple staging repositories
[error]     at xerial.sbt.Sonatype$NexusRESTService.$anonfun$findTargetRepository$8(Sonatype.scala:479)
[error]     at scala.Option.getOrElse(Option.scala:138)
[error]     at xerial.sbt.Sonatype$NexusRESTService.findTargetRepository(Sonatype.scala:476)
[error]     at xerial.sbt.Sonatype$SonatypeCommand$.$anonfun$sonatypeRelease$1(Sonatype.scala:202)
[error]     at sbt.Command$.$anonfun$applyEffect$4(Command.scala:149)
[error]     at sbt.Command$.$anonfun$applyEffect$2(Command.scala:144)
[error]     at ch.epfl.scala.sbt.release.Helper.runCommand$1(ReleaseEarlyPlugin.scala:524)
[error]     at ch.epfl.scala.sbt.release.Helper.$anonfun$runCommandAndRemaining$1(ReleaseEarlyPlugin.scala:533)
[error]     at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1(ReleaseEarlyPlugin.scala:267)
[error]     at ch.epfl.scala.sbt.release.ReleaseEarly$Defaults$.$anonfun$sonatypeRelease$1$adapted(ReleaseEarlyPlugin.scala:259)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:280)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error]     at sbt.Execute.work(Execute.scala:289)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:280)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]     at java.base/java.lang.Thread.run(Thread.java:834)
[error] (releaseEarlyPublish) java.lang.IllegalStateException: Found multiple staging repositories

In the failing example, you can see that there are 8 artifacts and 8 options for staging repositories.

I'd guess that something is running in parallel in 1.3.0, which was sequentially previously. I did not test against 1.3.2 (yet), because its changelog seemed to be unrelated.

This is unrelated to #30 because there is only one project. It is also different from #32, because there are 3 Scala versions in my project and 8 (number of things to upload) staging repositories.

JanBessai commented 4 years ago

Any news on this?

jvican commented 4 years ago

I believe this is an issue that I fixed in master but didn't advertise. You could use it by depending on 2.1.1+4-9d76569a. Then, doing releaseEarly followed by sonatypeBundleRelease should release the project successfully with the new sbt-sonatpye bundled upload, which is much faster.

JanBessai commented 4 years ago

With version 2.1.1+4-9d76569a and sbt +releaseEarly +sonatypeBundleRelease I get

java.lang.RuntimeException: Missing bintray credentials. Either create a credentials file with the bintrayChangeCredentials task, set the BINTRAY_USER and BINTRAY_PASS environment variables or pass bintray.user and bintray.pass properties to sbt.

even though my build.sbt specifies to publish using sonatype.

The full travis log is also available.

jvican commented 4 years ago

Yes, this is a bug that needs to be fixed, you can work around that by passing the empty system properties for now when you need to release. Otherwise if you could fix this bug, I would be grateful

JanBessai commented 4 years ago

It worked! I had to make some minor adjustments to my CI-config, but overall the issue seems to be gone. Specifically:

jvican commented 4 years ago

Thanks for that thorough comment @JanBessai If you could update the wiki (which has open access) with that information when you have some time I'd appreciate it.