yq
yq copied to clipboard
yq write wraps long lines
Describe the bug
yq w -i test.yaml "spec.template.spec.containers[0].image" jupyter/datascience-notebook:1
wraps long line. I expected that it does not touch anything aside from the given path.
Thank you for taking the time to look at my report.
Input Yaml
test.yml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter
spec:
selector:
matchLabels:
app: jupyter
template:
metadata:
labels:
app: jupyter
image: juypter
spec:
securityContext:
fsGroup: 50000
containers:
- name: airflow
image: jupyter/datascience-notebook
args: ["start-notebook.sh", "--ip=0.0.0.0", "--NotebookApp.token=''", "--NotebookApp.password=''", "--NotebookApp.base_url='/jupyter/'"]
out.yml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: jupyter
spec:
selector:
matchLabels:
app: jupyter
template:
metadata:
labels:
app: jupyter
image: juypter
spec:
securityContext:
fsGroup: 50000
containers:
- name: airflow
image: jupyter/datascience-notebook:1
args: ["start-notebook.sh", "--ip=0.0.0.0", "--NotebookApp.token=''", "--NotebookApp.password=''",
"--NotebookApp.base_url='/jupyter/'"]
Command The command you ran:
yq w -i test.yaml "spec.template.spec.containers[0].image" jupyter/datascience-notebook:1
This is an issue with the underlying go-yaml library, it automatically line wraps and does not provide an option to turn it off (https://github.com/go-yaml/yaml/issues/387)
looks like this is fixed in 2.3.0 https://github.com/go-yaml/yaml/pull/571
Ah - I'm using v3 go go-yaml