skaffold
skaffold copied to clipboard
Gradle Jib task dependencies not respected
Expected behavior
Jib should respect task dependencies specified in build.gradle
.
Actual behavior
Jib appears to be using a "raw" jibDockerBuild
task, without relying on its possible task dependencies (if those are defined in build.gradle
).
Information
- Skaffold version:
v1.35.1
- Operating system:
Ubuntu 20.04.3 LTS
- Installed via:
google-cloud-sdk-skaffold
Debian package - Contents of
skaffold.yaml
:
apiVersion: skaffold/v2beta26
kind: Config
build:
artifacts:
- image: test-service
jib: {}
Steps to reproduce the behavior
- A
build.gradle
with these 2 task dependencies:
tasks.jib.dependsOn test
tasks.jibDockerBuild.dependsOn test
-
skaffold build
-
gradle jibDockerBuild
- Observe that
test
task is only triggered by (3), but not by (2).
Workaround:
It seems that test
task in particular does get triggered sometimes, but only if
- The image is not cached and
- There's a non-empty
test
config inskaffold.yaml
, for example:test: - image: busybox
Perhaps this behavior should be documented? And what about non-test
tasks?
It seems to be somehow related to issue I just logged #7086.
I've observed that when adding tasks.jibDockerBuild.dependsOn test
skaffold
was not picking up on those changes. Went through gradle clean
cycles and it helped, so it seems that there's some sort of caching involved.
Also I don't think skaffold
could bypass what's in build.gradle
even if it wanted to. Skaffold runs a task, that task depends on another one as per build.gradle
and I don't know how could that be ignored.... but then again I am no gradle expert.
@related to #7086 Thanks you for the issue. We would appreciate any help from the community on this issue.