-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Proposal for Java Support (orchestrated by skaffold) #526
Comments
Had a chat with @balopat about this. Exploring punting this whole build tool specific plan for a multistage docker build (via documentation) or a generic builder that can be configured to trigger maven/gradle. |
hey, I'm super-new to the project, but hopefully I can help in adding perspective. From what I gather, currently skaffold supports the multistage Dockerfile setup very nicely. I played around to see what kind of issues I'd run into with that approach:
This works for a single simple project for now and maybe even can be a good enough initial story? I can see some benefits to a bespoke maven builder:
|
@loosebazooka Thanks for starting this thread! For me, a good maven/gradle integration would have those properties:
|
+1 to @dgageot comments. I have some questions about the last bullet though. e.g. 'Builds are triggered on code change..' I think we do want to support that workflow, but I'm not sure that it will be the most productive for Java users. A few things I'd like to better understand are:
I think 3. can probably wait, but @loosebazooka do you have ideas for 1 & 2? |
In AFAIU, for Skaffold builds with Bazel, Skaffold:
Perhaps another way we could implement build tool specific integration is to have the user specify the files to watch (or some command output to parse for the files) and the command to run to do the build. The configuration could look something like: build:
artifacts:
- imageName: gcr.io/k8s-java-skaffold/maven-app
workspace: ./maven-app
dependencies:
- ./maven-app/src
- ./maven-app/pom.xml
command: ./mvnw install -Dimage.name={{.imageName}} This way, it could support any arbitrary command-based build as is. |
I can see both sides of the multi-stage docker file running the maven/gradle versus doing the maven/gradle first before Docker (so you can more easily customise proxies and caches). For doing releases the latter is better; for |
This thread is going to grow large and a lot of questions need to be still answered/decided: e.g. what if the user already has a "source to image" strategy? How are we going to plug that? (I like @coollog's approach of a generic script). What is the default "source to image" strategy, that we recommend? Do we detect that? There are differences building executable slim JARs, fat JARs, WARs deployed to different application servers. Hot-swap, static resources, incremental IDE builds mentioned by @patflynn are an interesting area for optimization as well. And finally @jstrachan's comment about the CI/CD usecase is a very interesting one too and might shift the implementation priorities within that user story. I think I have enough material to compile a proposal soon (tomorrow) in form of a markdown doc - we can continue commenting on that, if that format is okay with everyone. |
Update: I underestimated the write-up - haven't got around to finish this today. I am actively working on it. |
Update: had lots of conversations with people, didn't come to a final conclusion yet and I ran out of time - going to go on a leave today. However I believe @loosebazooka had a catchup with the team and came to a conclusion? |
As discussed, we are all okay with a generic build option, but it's not certain how to configure it. I think there's a conflict between how skaffold is organized and how a contained build that doesn't use Dockerfiles would interface with it. The separation or build-config and builder makes things a little strange (for example: if someone configured a java-jib build and had kaniko set as their builder config, the behavior would not be defined) Anyway, the target for the custom build is to configure everything at the artifact level. And just interface with There are a few things we need to deal with:
build:
artifacts:
- imageName: gcr.io/k8s-java-skaffold/maven-app
workspace: ./maven-app
# here's where the generic build stuff comes in (sits with docker, bazel).
custom:
#skaffoldImageName (or whatever) is imageName:skaffoldInjectedTag
command: ./mvnw install -Dimage.name={{.skaffoldImageName}}
watch:
- ./maven-app/src
- ./maven-app/pom.xml
# the builder here might just be a push only (maven-docker-build/bazel) or no-op (jib)
local: {}
|
+1 on the custom builder. I do recommend supporting multiple commands:
Or, just delegate this through a plugin model. I'm not sure why Bazel got its own build block, but if we were to retrhink how to externalize bazel build, it will help w/ all the other build tools.
|
As the JIB builder is the recommended approach now, I'll close this issue. Please reopen/comment if you have other ideas. |
I have an microservice app with docker image being built by fabric8 maven plugin and I deploy to K8. Will this be supported by Skaffold currently or in the planned roadmap ? This would make the skaffold just a breeze |
This is a proposal for java builds orchestrated by skaffold (this issue is separate from a maven/gradle skaffold plugin which delegate orchestration to the build tool -- instead of skaffold)
It seems like in general skaffold and the build tools have overlapping responsibilities and it's a little hard to decide which tools owns which part of the process.
I'm just opening this issue so we can start a discussion. What follows is one (of many) possible way to connect java build tools with skaffold.
Java Build Tools (gradle/maven) will define a convention for running a build to docker environments. (this is what skaffold calls when it decides a build needs to be done)
The user must use this convention to define the profile (maven) or task (gradle) that triggers the correct configuration and goals/task where the end result is an image on the docker daemon.
Triggering skaffold: There are two options
./pom.xml
,./src
, ..../build.gradle
,./settings.gradle
,./gradle.properties
,./src
, ..../target/*
./build/*
Any ideas, potential problems?
@dgageot @glaforge @coollog @patflynn @r2d4
The text was updated successfully, but these errors were encountered: