Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Prevent native packager bin-compat issues #169

Conversation

ignasi35
Copy link
Contributor

@ignasi35 ignasi35 commented Jan 9, 2019

Fixes #168

@ghost ghost assigned ignasi35 Jan 9, 2019
@ghost ghost added the review label Jan 9, 2019
@ignasi35
Copy link
Contributor Author

ignasi35 commented Jan 9, 2019

I copy/pasted the play-endpoints scripted test into play-2.6.21-endpoints new test so we can run two scripted tests with versions of play before 2.6.21 and after. I kept the tests verbatim but we could probably simplify the new one.

@ignasi35
Copy link
Contributor Author

ignasi35 commented Jan 9, 2019

We'll need a release 1.6.1 in order to move on with the release of Lagom 1.4.10 which needs Play 2.6.21.

@ignasi35
Copy link
Contributor Author

ignasi35 commented Jan 9, 2019

thanks @dwijnand for the solution in #168 (comment)

@dwijnand
Copy link
Member

dwijnand commented Jan 9, 2019

The failure mode before this fix is that using the play sbt plugin version 2.6.21 fails to load with current sbt-reactive-app 1.6.0. So I'd simplify the test to just defining those two plugins and then loading the build (e.g test that about succeeds).

@ignasi35
Copy link
Contributor Author

ignasi35 commented Jan 9, 2019

Unfortunately, this PR is incomplete as it is. Trying to run deploy minikube raised some more red flags. I've found that at least DockerAlias breaks the API too.

@dwijnand
Copy link
Member

dwijnand commented Jan 9, 2019

Oh wow...

Copy link
Contributor

@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.

I am marking this "Request changes" based on

Unfortunately, this PR is incomplete as it is.

 * also simplifies the 2.6.21 scripted test to keep it in point.
Copy link
Contributor Author

@ignasi35 ignasi35 left a comment

Choose a reason for hiding this comment

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

Two fixes required. Both caused by sbt-native-packager:

  • docker.DockerKeys bin compat issue
  • DockerAlias


// removed from `sbt-native-packager` (https://github.com/sbt/sbt-native-packager/pull/1138/files#diff-6aa67d5df515952c884df8bad5ff2ac4L12)
def latest(dockerAlias: DockerAlias) = s"${untagged(dockerAlias)}:latest"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the main change in the PR. There's no automated test for it, unfortunately. The issue manifests when running deploy minikube.

Copy link
Contributor

Choose a reason for hiding this comment

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

Given that the part that sbt-native-packager participate in deploy minikube is just image creation, can we reproduce this by calling Docker/stage from the scripted test?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually you probably need Docker/publish to exercise alias.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, good call. We can add that on a separate PR

@@ -92,7 +93,7 @@ object SbtReactiveAppPlugin extends AutoPlugin {
}
}

object localImport extends docker.DockerKeys
val localImport: DockerKeys = docker.DockerPlugin.autoImport
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the original change. The breaking changes in docker.DockerKeys prevents user sbt's from running. This PR adds a scripted test to assert this fix kicks in.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

def index() = Action { _ =>
Ok("Hello, World")
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This scripted test is a copy/paste/trim version of play-endpoints with a specific version of Play. I could have trimmed it more or even created a very small sbt project just mixing sbt-native-packager versions but I wanted to reproduce the issue detected on Play as closely as possible.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe just update play-endpoints to Play 2.6.21 and keep this one minimal to the plugin conflict? Also, maybe rename this test.

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 kept play-endpoints as originally implemented (depending on play's sbt-plugin 2.6.7 on purpose when I upgraded sbt-reactive-app's dependency to sbt-native-packager from 1.3.2 to 1.3.15.
But we could tell Play users that in order to use newer versions of sbt-reactive-app they have to upgrade Play too.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah users should be able to always upgrade to latest bugfix version, in this case of Play and sbt-reactive-app.

Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

I just realised the easiest way to fix this is to just bump the sbt-native-package version and fix the broken API usage.

src/sbt-test/sbt-reactive-app/play-2.6.21-endpoints/test Outdated Show resolved Hide resolved
def index() = Action { _ =>
Ok("Hello, World")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just update play-endpoints to Play 2.6.21 and keep this one minimal to the plugin conflict? Also, maybe rename this test.

@ignasi35
Copy link
Contributor Author

I just realised the easiest way to fix this is to just bump the sbt-native-package version and fix the broken API usage.

I considered that and even had that change locally but I rolled it back to not break other features. My test suite is limited and manual.

@ignasi35
Copy link
Contributor Author

@dwijnand I think the changes in DockerAlias require a few changes in sbt-reative-app so I'd rather bump the version of sbt-native-packager and adapt the code in a separate PR.

@ignasi35
Copy link
Contributor Author

@dwijnand I've made the changes in the tests you suggested:

  • trim down and rename the new test
  • bump play to 2.6.21 in play-endpoints

I like it better, yeah.

Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

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

TBH you could remove the whole build.sbt and Main.scala file too, but I guess this will do.

@eed3si9n eed3si9n merged commit f6f4efd into lightbend:master Jan 10, 2019
@ghost ghost removed the review label Jan 10, 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