Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve multiline for line ending with \ #137

Open
ezh opened this issue Sep 16, 2023 · 4 comments
Open

Preserve multiline for line ending with \ #137

ezh opened this issue Sep 16, 2023 · 4 comments
Labels
yaml_v3_problem A bug in the underlying yaml library. These issues are vastly harder to fix.

Comments

@ezh
Copy link

ezh commented Sep 16, 2023

Hey. I have the next yaml.

What is the best way to preserve multiline for the regex value?

I cannot use > scan_folded_as_literal because there will be spaces between elements.

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMNodeScrape
metadata:
  name: kubelet
spec:
  metricRelabelConfigs:
    - action: labeldrop
      regex: (uid)
    - action: labeldrop
      regex: (id|name)
    - action: keep
      regex: "go_goroutines|\
        kubelet_cgroup_manager_duration_seconds_bucket|\
        kubelet_cgroup_manager_duration_seconds_count|\
        kubelet_node_config_error|\
        kubelet_node_name|\
        node_quantile:kubelet_pleg_relist_duration_seconds:histogram_quantile|\
        kubelet_pleg_relist_duration_seconds_bucket|\
        kubelet_pleg_relist_duration_seconds_count|\
        kubelet_pleg_relist_interval_seconds_bucket|\
        kubelet_certificate_manager_client_ttl_seconds|\
        kubelet_certificate_manager_client_expiration_renew_errors|\
        kubelet_certificate_manager_server_ttl_seconds|\
        kubelet_pod_start_duration_seconds_bucket|\
        kubelet_pod_start_duration_seconds_count|\
        kubelet_pod_worker_duration_seconds_bucket|\
        kubelet_pod_worker_duration_seconds_count|\
        kubelet_server_expiration_renew_errors|\
        kubelet_running_containers|\
        kubelet_running_container_count|\
        kubelet_running_pods|\
        kubelet_running_pod_count|\
        kubelet_runtime_operations_errors_total|\
        kubelet_runtime_operations_total|\
        kubelet_volume_stats_available_bytes|\
        kubelet_volume_stats_capacity_bytes|\
        kubelet_volume_stats_inodes|\
        kubelet_volume_stats_inodes_used|\
        process_cpu_seconds_total|\
        rest_client_request_duration_seconds_bucket|\
        rest_client_requests_total|\
        storage_operation_duration_seconds_count|\
        storage_operation_errors_total|\
        kubernetes_build_info|\
        volume_manager_total_volumes|\
        process_resident_memory_bytes"
@braydonk
Copy link
Collaborator

Hi @ezh thanks for opening an issue.

Do you have retain_line_breaks set with this example? See the docs to see how to set that.

@ezh
Copy link
Author

ezh commented Sep 18, 2023

$ cat $HOME/.config/yamlfmt/.yamlfmt
formatter:
  type: basic
  retain_line_breaks: true
  scan_folded_as_literal: true

@ezh
Copy link
Author

ezh commented Sep 18, 2023

@braydonk You can reproduce it quickly. Copy'n'paste the above YAML to test.yml and run
yamlfmt -conf ~/.config/yamlfmt/.yamlfmt test.yml with retain_line_breaks.

@ezh
Copy link
Author

ezh commented Sep 18, 2023

yamlfmt -version
0.10.0

@braydonk braydonk added the yaml_v3_problem A bug in the underlying yaml library. These issues are vastly harder to fix. label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
yaml_v3_problem A bug in the underlying yaml library. These issues are vastly harder to fix.
Projects
None yet
Development

No branches or pull requests

2 participants