GoogleContainerTools / GoogleContainerTools/skaffold

Profile patch with invalid `op` reports "invalid path" instead of "invalid op"

Open
#5,259 2 comments 0 reactions 0 assignees View on GitHub
area/errors area/yaml-docs kind/friction needs-actionable-error priority/p2
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

### Expected behavior

An invalid `op` in the `profile.patches` list should complain that the op is invalid, i.e.,

```
> skaffold dev -p NodePort
applying profiles: applying profile "NodePort": invalid op: delete
```

### Actual behavior

An invalid `op` in the `profile.patches` list complains that the *path* is invalid, i.e.

```
> skaffold dev -p NodePort
applying profiles: applying profile "NodePort": invalid path: /deploy/helm/releases/0/setValues/service.port
```

It wasn't until I went to look at the spec after about a half-hour of trying to rewrite, rephrase, or simply respell the path, and then hunting through Skaffold bug reports, that I went to look at [the JSON Patch](http://jsonpatch.com/) site, and discovered that the op is `remove`, not `delete`.

The path is not invalid.

### Information

- Skaffold version: `v1.17.2`
- Operating system: `Microsoft Windows [Version 10.0.19041.685]`
- Contents of skaffold.yaml:

```yaml
apiVersion: skaffold/v2beta10
kind: Config
metadata:
name: my-server
build:
artifacts:
- image: my-server
docker: {}
deploy:
helm:
releases:
- name: my-server
chartPath: charts/my-server
artifactOverrides:
image: my-server
setValues:
service.type: LoadBalancer
service.port: 8000
profiles:
- name: NodePort
patches:
- op: replace
path: /deploy/helm/releases/0/setValues/service.type
value: NodePort
- op: delete
path: /deploy/helm/releases/0/setValues/service.port
```

### Steps to reproduce the behavior

1. an empty directory containing only the skaffold.yaml above.
2. `skaffold dev -p NodePort`
3. Profit

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.