GoogleContainerTools / GoogleContainerTools/skaffold
Skaffold does not rebuild derived artifact after base artifact changes
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
### Expected behavior
If a base artifact rebuilds, all the artifacts that depends on it should rebuild.
### Actual behavior
The base artifact is rebuild but the derived artifacts do not.
For this skaffold yaml
```
apiVersion: skaffold/v2beta26
kind: Config
metadata:
name: skaffold
build:
artifacts:
- image: docker.io/laurentiusoica/artifact1
context: artifact1
docker:
dockerfile: Dockerfile
- image: docker.io/laurentiusoica/artifact2
context: artifact2
requires:
- image: docker.io/laurentiusoica/artifact1
alias: BASE
docker:
dockerfile: Dockerfile
local:
useDockerCLI: false
useBuildkit: true
tryImportMissing: true
```
Dockerfile for base
```
FROM alpine
LABEL NAME=base
```
Dockerfile for derived image
```
ARG BASE
FROM $BASE
LABEL NAME=derived
```
Changing the base image does not trigger a rebuild on the derived image
```
$ skaffold build
Generating tags...
- docker.io/laurentiusoica/artifact1 -> docker.io/laurentiusoica/artifact1:0.0.4-3-g40d3b3e
- docker.io/laurentiusoica/artifact2 -> docker.io/laurentiusoica/artifact2:0.0.4-3-g40d3b3e
Checking cache...
- docker.io/laurentiusoica/artifact1: Found Remotely
- docker.io/laurentiusoica/artifact2: Found Remotely
$ skaffold build
Generating tags...
- docker.io/laurentiusoica/artifact1 -> docker.io/laurentiusoica/artifact1:0.0.4-3-g40d3b3e-dirty
- docker.io/laurentiusoica/artifact2 -> docker.io/laurentiusoica/artifact2:0.0.4-3-g40d3b3e
Checking cache...
- docker.io/laurentiusoica/artifact1: Not found. Building
- docker.io/laurentiusoica/artifact2: Found Remotely
Starting build...
Building [docker.io/laurentiusoica/artifact1]...
[+] Building 1.3s (5/5) FINISHED
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 70B 0.0s
=> [internal] load metadata for docker.io/library/alpine:latest 1.1s
=> CACHED [1/1] FROM docker.io/library/alpine@sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:a82631728b0233e22e3977e1806b6ab6a1c5aebe7a9a431aa17041e29d8576e7 0.0s
=> => naming to docker.io/laurentiusoica/artifact1:0.0.4-3-g40d3b3e-dirty 0.0s
The push refers to repository [docker.io/laurentiusoica/artifact1]
8d3ac3489996: Preparing
8d3ac3489996: Layer already exists
0.0.4-3-g40d3b3e-dirty: digest: sha256:bc063d968486d8f722d57eafb5a6f2748dce39092145a50ebd3e596def2e12aa size: 527
```
### Information
- Skaffold version: v1.35.2
Contributor guide
Assessment
This issue has not been assessed yet.