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

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

Closed
JanBessai opened this issue Sep 21, 2019 · 6 comments
Closed

Comments

@JanBessai
Copy link
Contributor

JanBessai commented Sep 21, 2019

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 JanBessai changed the title Multiple staging profiles in Sonatype Releases (one per artifact) Multiple staging profiles in Sonatype releases (one per artifact) Sep 21, 2019
@JanBessai
Copy link
Contributor Author

Any news on this?

@jvican
Copy link
Owner

jvican commented Feb 12, 2020

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

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

jvican commented Feb 12, 2020

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

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

  • The updated gpg plugin needs
    echo $PGP_PASS | gpg --passphrase-fd 0 --batch --yes --import travis/local.secring.asc
    
    as a step before the sbt call.
    It imports the private key into the system's native gpg client, which was previously handled by Java's BouncyCastle implementation. A minor pitfall is that the environment variable name PGP_PASS is taken from the sbt-release-early tutorial and different from the sbt-pgp tutorial.
  • Scala version cross builds require
    sbt +releaseEarly sonatypeBundleRelease
    
    with +releaseEarly and no plus for sonatypeBundleRelease.
    Otherwise sonatypeBundleRelease fails because it tries to re-upload the cross build versions which already exist. The failure message for this is not the most helpful:
    Failed: RepositoryWritePolicy, failureMessage:Artifact updating: Repository ='releases:Releases' does not allow updating artifact='/org/combinators/shapeless-feat_2.13/0.2.3+37-1cecf7fe/shapeless-feat_2.13-0.2.3+37-1cecf7fe-javadoc.jar'
    
  • Sonatype recently has Hiccups (probably related to load) where you get a SAXParseException. There is an open issue with sbt-sonatype for this. I had this issue when I tried to make a release on Friday evening (Central European Time, UTC+01:00), which might be a high-traffic time for automated releases.

@jvican
Copy link
Owner

jvican commented Feb 20, 2020

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.

ccmtaylor added a commit to soundcloud/twinagle that referenced this issue Apr 1, 2020
The latest tagged release is >2y old. Use the latest release from
master instead.

Requires some more workarounds, see a [comment][]
on jvican/sbt-release-early#34 for details.

[comment]: jvican/sbt-release-early#34 (comment)
ccmtaylor added a commit to soundcloud/twinagle that referenced this issue Apr 1, 2020
The latest tagged release is >2y old. Use the latest release from
master instead.

Requires some more workarounds, see a [comment][]
on jvican/sbt-release-early#34 for details.

[comment]: jvican/sbt-release-early#34 (comment)
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

2 participants