GoogleContainerTools / GoogleContainerTools/skaffold

Gradle Jib task dependencies not respected

Open
#7,083 3 comments 6 reactions 0 assignees View on GitHub
area/artifact-dependencies area/build build/jib kind/bug priority/p3
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### 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`:

```yaml
apiVersion: skaffold/v2beta26
kind: Config
build:
artifacts:
- image: test-service
jib: {}
```

### Steps to reproduce the behavior

1. A `build.gradle` with these 2 task dependencies:
```
tasks.jib.dependsOn test
tasks.jibDockerBuild.dependsOn test
```
2. `skaffold build`
3. `gradle jibDockerBuild`
4. 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
1) The image is not cached _and_
2) There's a _non-empty_ `test` config in `skaffold.yaml`, for example:
```
test:
- image: busybox
```
Perhaps this behavior should be documented? And what about non-`test` tasks?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.