GoogleContainerTools / GoogleContainerTools/skaffold
Hash/dependency check of multi-stage `Dockerfile` fails if unused stage references files/folders that do not exist
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
### Expected behavior
Unreferenced Dockerfile stages to be excluded from hash/dependency check.
### Actual behavior
Skaffold appears to do some check against the whole `Dockerfile` despite a stage not being built.
### Information
- Skaffold version: 2.2.0
- Operating system: macOS 12.6.1
- Installed via: Homebrew
### Steps to reproduce the behavior
Create a `Dockerfile` with a stage that is not built by Skaffold, pseudo code:
```
FROM ubuntu as base
FROM base as dev
# should be skipped over by build
COPY ./local_dir_that_does_not_exist ./
FROM base
# What skaffold should build without a `target` specified
```
Reference the `Dockerfile` in skaffold `build` section without specifying `target`:
```
build:
local:
push: false
useDockerCLI: true
useBuildkit: true
concurrency: 2
artifacts:
- image: ghcr.io/
context:
docker:
dockerfile: Dockerfile
```
Run `skaffold dev` and you should see output like so:
```
$ skaffold dev
Generating tags...
- ghcr.io/ -> ghcr.io/:ef6b868
Checking cache...
- ghcr.io/: Error checking cache.
Cleaning up...
Error: uninstall: Release not loaded: : release: not found
Cleaning up resources encountered an error, will continue to clean up other resources.
getting hash for artifact "ghcr.io/": getting dependencies for "ghcr.io/": file pattern [./local_dir_that_does_not_exist] must match at least one file
```
Contributor guide
Assessment
This issue has not been assessed yet.