GoogleContainerTools / GoogleContainerTools/skaffold

My schema'd dockerfile fails parsing

Open
#5,907 4 comments 0 reactions 0 assignees View on GitHub
area/build build/docker kind/design discussion kind/feature-request priority/p2
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

Arbitrary syntax should be valid when the `# syntax` directive is enabled.

### Actual behavior

Given a `Cargo.toml` like this:

```toml
# syntax = denzp/cargo-wharf-frontend:v0.1.0-alpha.2

[package]
name = "testpkg"
version = "0.1.0"

[package.metadata.wharf.output]
env = { RUST_LOG = "info" }
```

And this `skaffold.yaml`:

```yaml
---
apiVersion: skaffold/v1beta16
kind: Config
metadata:
name: myconfig
build:
artifacts:
- image: myimg
context: .
docker:
dockerfile: Cargo.toml
local:
useBuildkit: true
```

You get this error:

```bash
$ skaffold dev
Listing files to watch...
- myimg
listing files: unable to evaluate build args: removing unused default args: parsing dockerfile: Syntax error - can't find = in "{". Must be of the form: name=value
```

If you comment out `env = { RUST_LOG = "info" }` from `Cargo.toml` then run `skaffold run` then the build will work.

I believe this test case was missed by #5441.

I'm not familiar with the code at all, but it seems like some actual parsing of the file contents is being done prior to the syntax directive being checked.

### Information

- Skaffold version: v1.24.1
- Operating system: Ubuntu 20.04
- Installed via: skaffold.dev

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.