Skip to content
This repository has been archived by the owner on Feb 28, 2021. It is now read-only.

Skip unpublish on projects marked skip on publish #168

Merged
merged 2 commits into from
May 11, 2019

Conversation

seglo
Copy link
Contributor

@seglo seglo commented May 10, 2019

When a project defines skip in publish := true then we should skip it while unpublishing artifacts as well. Currently, sbt-bintray will throw an error for discard request which return a 404 from bintray. This occurs when a project that does not exist to be unpublished, as described in #167.

An alternative would be to ignore artifacts that can't be unpublished and raise a warning log message instead of fatal error.

@@ -80,7 +80,8 @@ case class BintrayRepo(credential: BintrayCredentials, org: Option[String], repo
/** unpublish (delete) a version of a package */
def unpublish(packageName: String, vers: String, log: Logger): Unit =
await.result(repo.get(packageName).version(vers).delete(asStatusAndBody)) match {
case (200, _) => log.info(s"$owner/$packageName@$vers was discarded")
case (200, _) => log.info(s"$owner/$packageName@$vers was discarded")
//case (404, _) => log.warn(s"$owner/$packageName@$vers was not found")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative implementation. Warn when artifacts don't exist, but don't fail the build.

Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @seglo!

@@ -80,7 +80,8 @@ case class BintrayRepo(credential: BintrayCredentials, org: Option[String], repo
/** unpublish (delete) a version of a package */
def unpublish(packageName: String, vers: String, log: Logger): Unit =
await.result(repo.get(packageName).version(vers).delete(asStatusAndBody)) match {
case (200, _) => log.info(s"$owner/$packageName@$vers was discarded")
case (200, _) => log.info(s"$owner/$packageName@$vers was discarded")
case (404, _) => log.warn(s"$owner/$packageName@$vers was not found")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll include this anyway. Seems reasonable to just warn the user when an arifact is not found.

@seglo
Copy link
Contributor Author

seglo commented May 11, 2019

No problem!

@eed3si9n eed3si9n merged commit bfe0265 into sbt:master May 11, 2019
@2m 2m added this to the 0.5.5 milestone May 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants