sbt / sbt-ci-release

sbt plugin to automate Sonatype releases from GitHub Actions
Apache License 2.0
286 stars 76 forks source link

Issue publishing artifacts #216

Closed tomasherman closed 2 years ago

tomasherman commented 2 years ago

Hello, for some reason my builds started failing with following error:

[info]  published datadog4s-jvm_3 to https://oss.sonatype.org/content/repositories/snapshots/com/avast/cloud/datadog4s-jvm_3/0.31.1+0-0b2566ae+20211209-1518-SNAPSHOT/datadog4s-jvm_3-0.31.1+0-0b2566ae+20211209-1518-SNAPSHOT-javadoc.jar.asc
[info]  published datadog4s-jvm_3 to https://oss.sonatype.org/content/repositories/snapshots/com/avast/cloud/datadog4s-jvm_3/0.31.1+0-0b2566ae+20211209-1518-SNAPSHOT/datadog4s-jvm_3-0.31.1+0-0b2566ae+20211209-1518-SNAPSHOT-sources.jar.asc
[info]  published datadog4s-jvm_3 to https://oss.sonatype.org/content/repositories/snapshots/com/avast/cloud/datadog4s-jvm_3/0.31.1+0-0b2566ae+20211209-1518-SNAPSHOT/datadog4s-jvm_3-0.31.1+0-0b2566ae+20211209-1518-SNAPSHOT.jar.asc
[success] Total time: 34 s, completed Dec 9, 2021 3:19:24 PM
[info] Reapplying settings...
[info] set current project to datadog4s (in build file:/home/runner/work/datadog4s/datadog4s/)
2021-12-09 15:19:25.432Z  info [SonatypeService] sonatypeRepository  : https://oss.sonatype.org/service/local  - (SonatypeService.scala:26)
2021-12-09 15:19:25.437Z  info [SonatypeService] sonatypeProfileName : com.avast  - (SonatypeService.scala:27)
[info] Preparing a new staging repository for [sbt-sonatype] datadog4s 0.31.1+0-0b2566ae+20211209-1519-SNAPSHOT
2021-12-09 15:19:25.438Z  info [SonatypeClient] Reading staging repository profiles...  - (SonatypeClient.scala:108)
2021-12-09 15:19:26.922Z  info [SonatypeClient] Reading staging profiles...  - (SonatypeClient.scala:120)
2021-12-09 15:19:27.350Z  info [SonatypeService] No previous staging repository for [sbt-sonatype] datadog4s 0.31.1+0-0b2566ae+20211209-1519-SNAPSHOT was found  - (SonatypeService.scala:99)
2021-12-09 15:19:28.679Z  info [SonatypeClient] Creating a staging repository in profile com.avast with a description key: [sbt-sonatype] datadog4s 0.31.1+0-0b2566ae+20211209-1519-SNAPSHOT  - (SonatypeClient.scala:126)
2021-12-09 15:19:44.547Z  info [SonatypeClient] Created successfully: comavast-1318  - (SonatypeClient.scala:139)
2021-12-09 15:19:44.568Z error [Sonatype] 
java.io.IOException: Supplied file /home/runner/work/datadog4s/datadog4s/target/sonatype-staging/0.31.1+0-0b2566ae+20211209-1519-SNAPSHOT is a not an existing directory!
    at org.sonatype.spice.zapper.fs.AbstractDirectory.<init>(AbstractDirectory.java:32)
    at org.sonatype.spice.zapper.fs.DirectoryIOSource.<init>(DirectoryIOSource.java:68)
    at org.sonatype.spice.zapper.fs.DirectoryIOSource.<init>(DirectoryIOSource.java:59)

As you can see, some snapshots are published, but then for some reason a new staging repository gets created and it's name doesn't really match the name of the artifacts:

Increase of 1518 -> 1519

I don't really understand sonatype but the publishing worked fine for more than a year, now i wanted to do a maintenance release with dependency updates (including sbt-ci-release bumps) and it's not working anymore. Do you have any idea what might be going on?

Thank you!

eed3si9n commented 2 years ago

Is this a transient issue, or it's happening reliably for you now?

tomasherman commented 2 years ago

thanks for an extremely quick reply :) it seems to be happening reliably - 2 out of 2 :) But let me try again: https://github.com/avast/datadog4s/actions

eed3si9n commented 2 years ago

Also note that sbt-ci-release grabs publishing feature from sbt-sonatype 3.9.1. So if there actually is an issue, you might want to report it to https://github.com/xerial/sbt-sonatype as well.

olafurpg commented 2 years ago

Thank you for reporting! I recall hitting on a similar error that got fixed by adding publish / skip := true at the top of build.sbt. I couldn't find this in https://github.com/avast/datadog4s/blob/master/build.sbt and there is no code under the toplevel src/ directory.

The +20211209-1518 suffix in the name indicates that you have dirty git state when running publish in CI. This typically happens from website/documentation generation and you don't reproduce the issue locally because your $HOME/.gitignore file ignores the patterns that are marked as dirty in CI. You can fix this by adding more patterns to the .gitignore file of your codebase.

tomasherman commented 2 years ago

Thanks a lot! I will give it a try. I also reported this sbt-sonatype so we will see if those guys have any ideas aswell

tomasherman commented 2 years ago

ha, i think i found the offender: https://github.com/avast/datadog4s/pull/428/files ... 🤦‍♂️

jbwheatley commented 2 years ago

Hey @eed3si9n, I started seeing the same issue in my most recent release attempts for fs2-rabbit (diff between releases here https://github.com/profunktor/fs2-rabbit/compare/v4.1.0...v4.1.1), and am not sure what to try to fix it. Any advice?