Jib: No reload with skaffold dev on Kotlin code when using Jib with Java + Kotlin

Created on 14 Sep 2019  路  9Comments  路  Source: GoogleContainerTools/jib

Expected behavior

I am expecting the skaffold dev to reload a new "version" of the app on each modification of a java + kotlin project built with Jib.

Actual behavior

The skaffold dev doesn't detect any changes on the file system when I change code in the Kotlin part.

Information

  • Skaffold version: v0.37.1
  • Operating system: macOS
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1beta13
kind: Config
build:
  artifacts:
    - image: podcastserver/backend
      context: backend
      jibMaven:
        args:
          - liquibase:dropAll
          - liquibase:update
          - jooq-codegen:generate
          - compile
          - -Dmaven.test.skip
deploy:
  kustomize:
    path: backend/src/main/k8s/docker-for-mac/

Extra information:

I've dug a little into the skaffold and jib implementation and found out skaffold execute the following command to define files to watch:

mvn jib:_skaffold-files-v2 -q

And the current result for this command is the following in my project:

{
  "build": [
    "/Users/kevin/Workspace/gitlab.com/davinkevin/Podcast-Server/backend/pom.xml"
  ],
  "inputs": [
    "/Users/kevin/Workspace/gitlab.com/davinkevin/Podcast-Server/backend/src/main/java",
    "/Users/kevin/Workspace/gitlab.com/davinkevin/Podcast-Server/backend/src/main/resources",
    "/Users/kevin/Workspace/gitlab.com/davinkevin/Podcast-Server/backend/src/main/resources",
    "/Users/kevin/Workspace/gitlab.com/davinkevin/Podcast-Server/backend/src/main/jib"
  ],
  "ignore": []
}

So, it seems to only look for files into src/main/java. I don't know if my project follows the "maven state of the art configuration for Java + Kotlin", but I didn't find any information about this use case.

It should be good to be able to configure manually or take some folder if they exist.

PS: I think the title of the issue is very bad, but I didn't find anything better, so I let you change it if you have a better idea !

Steps to reproduce the behavior

  1. git clone [email protected]:davinkevin/Podcast-Server.git (or git clone https://gitlab.com/davinkevin/Podcast-Server.git if it doesn't work)
  2. cd podcast-server
  3. ./dev.sh which trigger some file system init (in /tmp folder) required by the app and then launch a skaffold dev command
  4. Do any modification on a file located inside backend/src/main/kotlin/... and see there is no "reload" from the skaffold dev command.
arejib-gradle-plugin arejib-maven-plugin

Most helpful comment

2010 makes jib:_skaffold-files-v2 to extract path values from <sourceDir> configured on the Kotlin Maven plugin. The next Jib version will support this use case.

Haven't looked into the Gradle side. I'll re-open the issue for tracking.

All 9 comments

cc @GoogleContainerTools/java-tools

@davinkevin thanks for reporting this. We're probably querying the maven system incorrectly here, we'll see what we can do to fix this.

@davinkevin can you describe what your kotlin build setup looks like? Are you defining the sourceDirectory?

I'm currently only on my tablet, it will be hard for me to describe precisely the build setup, but the project is open source and you can download it on gitlab. I've add the repository url inside my first message if you want to look at it.

Thanks for the info, it looks like https://gitlab.com/davinkevin/Podcast-Server/blob/master/backend/pom.xml#L398 is being configured on the kotlin plugin, I think we're going to have to do something kotlin specific in jib files.

2010 makes jib:_skaffold-files-v2 to extract path values from <sourceDir> configured on the Kotlin Maven plugin. The next Jib version will support this use case.

Haven't looked into the Gradle side. I'll re-open the issue for tracking.

I think this is a non-issue for Gradle. For the Ktor example in our repo, the jibSkaffoldFilesV2 tasks includes src/main/kotlin by default.

  "inputs": [
    "/usr/local/google/home/chanseok/workspace4E/jib/examples/ktor/src/main/resources",
    "/usr/local/google/home/chanseok/workspace4E/jib/examples/ktor/src/main/kotlin"
  ],

And if I create an empty directory src/main/java, it is included as well.

  "inputs": [
    "/usr/local/google/home/chanseok/workspace4E/jib/examples/ktor/src/main/resources",
    "/usr/local/google/home/chanseok/workspace4E/jib/examples/ktor/src/main/java",
    "/usr/local/google/home/chanseok/workspace4E/jib/examples/ktor/src/main/kotlin"
  ],

And according to the doc, even when you don't use the convention and mix Java + Kotlin, you will configure sourceSets, so I think this case is also covered automatically.

Closing the issue.

@davinkevin We've released Jib v1.7.0 with this fix; if you upgrade Jib, skaffold should reload the files correctly.

All is working perfectly 馃帀with skaffold 0.41.0 and jib 1.7.0. Thanks to all

Was this page helpful?
0 / 5 - 0 ratings