In YAML how can I comment a part of a line?

Viewed 27645

In YAML how can I comment a part of a line?

for example:

- name: "JAVA_OPTIONS"
value: "-Dconfig.dir.path=$(CONF_PATH) -Dpoint.dir.path=$(POINT_PATH)-
Xms256m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$(LOG_PATH) 
-DMY_POD_NAME=$(MY_POD_NAME)"

How can I comment a string inside the value line?

Like "-Dpoint.dir.path=$(POINT_PATH)" will be remarked but all the rest will take affect.

2 Answers

In your specific example, you could break individual arguments out to separate lines in a folded scalar. As long as argument order isn't an issue, anything to comment can just be moved to the end. It will work fine as long as you don't stick it in the middle.

- name: "JAVA_OPTIONS"
  value: >
    -XX:+HeapDumpOnOutOfMemoryError 
    -Xms256m
    -Xmx512m 
    -XX:HeapDumpPath="$(LOG_PATH)"
    -DMY_POD_NAME="$(MY_POD_NAME)"
#    -Dconfig.dir.path="$(CONF_PATH)"
#    -Dpoint.dir.path="$(POINT_PATH)"
Related