GoogleContainerTools / GoogleContainerTools/skaffold

skaffold pre-build hook can't create input

Open
#7,216 7 comments 6 reactions 0 assignees View on GitHub
area/hooks help wanted kind/enhancement kind/starter-project priority/p3
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

My understanding of the before-build hook was that it should be able to create the inputs used for the build.

### Actual behavior

Dependency checking happens before the before-build hook is run and fails as it can't find the data that hasn't been created yet.

### Information

- skaffold v1.35.2
- Operating system: Ubuntu 18.04
- Contents of skaffold.yaml:

```yaml
apiVersion: skaffold/v2beta22
kind: Config
build:
artifacts:
- image: makedataimage
hooks:
before:
- command: ["./makedata.sh"]
```

makedata.sh

```shell
#!/bin/bash

echo "XX" > data
```

Dockerfile
```
FROM busybox

COPY ./data .
```
### Steps to reproduce the behavior

skaffold build

```
Generating tags...
- makedataimage -> makedataimage:latest
Some taggers failed. Rerun with -vdebug for errors.
Checking cache...
- makedataimage: Error checking cache.
getting hash for artifact "makedataimage": getting dependencies for "makedataimage": file pattern [./data] must match at least one file
```

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.