GoogleContainerTools / GoogleContainerTools/skaffold
[ko builder] Image digest is not updated when kodata files are changed
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
If configured inputDigest and ko builder, digest is not calculated correctly.
### Expected behavior
When files are present in `cmd/kodata`, changing them should result in a new tag.
### Actual behavior
Tag is not changing.
### Information
- Skaffold version: v2.9.0
- Operating system: Ubuntu 20.04
- Installed via: https://skaffold.dev/docs/install/
- Contents of skaffold.yaml:
```yaml
apiVersion: skaffold/v4beta7
kind: Config
metadata:
name: skaffold-kodata-bug
build:
tagPolicy:
inputDigest: {}
artifacts:
- image: skaffold-kodata-bug
ko:
fromImage: gcr.io/distroless/static-debian12:nonroot
main: ./cmd
```
### Steps to reproduce the behavior
1. `mkdir skaffold-bug`
2. `cd skaffold-bug`
3. `mkdir cmd`
4.
```
cat << EOF > cmd/main.go
package main
func main() {
}
EOF
```
5. `mkdir cmd/kodata`
6.
```
cat << EOF > cmd/kodata/test.txt
test 1
EOF
```
7.
```
cat << EOF > skaffold.yaml
apiVersion: skaffold/v4beta7
kind: Config
metadata:
name: skaffold-kodata-bug
build:
tagPolicy:
inputDigest: {}
artifacts:
- image: skaffold-kodata-bug
ko:
fromImage: gcr.io/distroless/static-debian12:nonroot
main: ./cmd
EOF
```
7. `skaffold build --dry-run` , remember which tag is generated
8.
```
cat << EOF > cmd/kodata/test.txt
test 2
EOF
```
9. `skaffold build --dry-run`
Expected different tag, actual is same.
I understand this can be bypassed by specifying `dependencies`, but that IMO would somewhat defeat the purpose of having inputDigest in the first place (which is supposed to be only changed when actually used sources are changed, but for this to work we would have to manually specify all reachable go packages).
Contributor guide
Assessment
This issue has not been assessed yet.