-
Notifications
You must be signed in to change notification settings - Fork 89
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
Maven plugin implementation #1049
Conversation
core/cloudflow-cr-generator/src/main/scala/cloudflow/cr/Generator.scala
Outdated
Show resolved
Hide resolved
projectId: String, | ||
version: String, | ||
blueprintStr: String, | ||
streamlets: Map[String, com.typesafe.config.Config], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: avoiding fully qualified path name : see last comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
version: String, | ||
blueprintStr: String, | ||
streamlets: Map[String, com.typesafe.config.Config], | ||
dockerImages: Map[String, String]): String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be return a Try[String]
instead of throwing exceptions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error messages are quite nice from Maven in case we directly throw exceptions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what happens if downstream fails to catch those nice exceptions ? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
downstream fails to catch those nice exceptions
I'm expecting downstream to NOT catch those exceptions and to be propagated up to the JVM (which craches), this is the contract, isn't it?
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some minor suggestions
core/cloudflow-cr-generator/src/main/scala/cloudflow/cr/Generator.scala
Outdated
Show resolved
Hide resolved
projectId: String, | ||
version: String, | ||
blueprintStr: String, | ||
streamlets: Map[String, com.typesafe.config.Config], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
version: String, | ||
blueprintStr: String, | ||
streamlets: Map[String, com.typesafe.config.Config], | ||
dockerImages: Map[String, String]): String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error messages are quite nice from Maven in case we directly throw exceptions!
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
...loudflow-maven-plugin/src/main/scala/com/lightbend/cloudflow/maven/CloudflowAggregator.scala
Outdated
Show resolved
Hide resolved
val c = getClass().getClassLoader() | ||
Thread.currentThread().setContextClassLoader(c) | ||
|
||
val k = new KafkaContainer(tcutility.DockerImageName.parse("confluentinc/cp-kafka:5.4.3")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe externalize the image name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the parse
fail / throw exceptions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not with a fixed string, if it succeeds once it succeed always I assume
def getDescriptorsOrFail[T](descriptors: Iterable[(T, Try[RuntimeDescriptor])])( | ||
error: String => Unit): Iterable[(T, RuntimeDescriptor)] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function has no semantics of failure as part of its type signature. Should we name the function getDescriptorsOrFail
or change it simply to getDescriptors
? It throws but usually we don't add that as a semantics in the name of the function. One option would be to change the signature to Try[Iterable[..
and wrap the exception in a Try
..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those functions have been extracted all "as-is" from the sbt plugin.
This is not fresh new code being added to the code-base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also is good to throw the exception to the user in those cases, not much we can do with it.
By handling it gracefully we are going just to mask the original error
localFile | ||
} | ||
|
||
def createDirs(prefix: String): (Path, Path) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
directory creation can fail. Should we do Try[(Path, Path)]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really aggressive defensive programming 😛
If directory creation fails I think is correct to send to the user a stack-trace with the original exception (that is what happens here)
Blocked by the release of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
.gitignore
Outdated
@@ -59,6 +59,7 @@ binaries | |||
.cache/ | |||
docs-source/test-ui-site.yml | |||
output/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is output
dir in gitignore anyway?
* Copyright (C) 2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package com.lightbend.cloudflow.buildtool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not stick with cloudflow
as root package?
import scala.collection.JavaConverters._ | ||
import scala.util.Try | ||
|
||
object CloudflowAggregator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
object CloudflowAggregator { | |
object CloudflowProjectAggregator { |
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
docs/shared-content-source/docs/modules/develop/pages/maven-support.adoc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions for the docs. We should also be a bit more clear about the fact that the user has to write their 'dockerfile in maven xml' at this point, as is shown in the examples, (and we likely need to improve this in the future)
…pport.adoc Co-authored-by: Raymond Roestenburg <[email protected]>
Co-authored-by: Raymond Roestenburg <[email protected]>
This is the first implementation of a Maven plugin to use with Cloudflow applications.
Note: