ship icon indicating copy to clipboard operation
ship copied to clipboard

Bug: in base file \n after helm render

Open zendril opened this issue 5 years ago • 2 comments

Expected behavior

I am using inline to add a helm template into the ./templates dir of a helm chart. This is a ConfigMap that contains xml inside. This works and the file ends up in the templates dir successfully and looks fine.

After render I expect that the file that ends up in base looks like a normal xml inside of the data section.

Actual behavior

After render it ends up with \n for all of the line endings of the xml inside the data section of the ConfigMap.

Information

  • Ship version: 0.40.0 Windows
  • Docker version: N/A
  • Command line run: ship init ship.yaml

Steps to reproduce the behavior

  1. Create ship.yaml with something like this:
assets:
  v1:
    - github:
          repo: jfrog/charts
          path: stable/artifactory-ha
          strip_path: true
          dest: chart
          ref: master
    - inline:
        dest: chart/templates/artifactory-binarystore.yaml
        contents: |+
          kind: ConfigMap
          apiVersion: v1
          metadata:
            name: {{ template "artifactory-ha.fullname" . }}-bs
            labels:
              app: {{ template "artifactory-ha.name" . }}
              chart: {{ template "artifactory-ha.chart" . }}
              heritage: {{ .Release.Service }}
              release: {{ .Release.Name }}
          data:
            binarystore.xml: |-
              <config version="4">
                  <chain>
                       lots of XMLy goodness in here
                  </chain>
               </config>
config:
  v1: []
lifecycle:
  v1:
    - message:
        contents: |
          Prepping for Artifactory-HA...
    - render:
        root: .
    - helmIntro: {}
    - helmValues:
        path: chart/values.yaml
    - render:
        root: .
        assets:
          v1:
            - helm:
                dest: base/artifactory-ha
                helm_opts:
                  - --name=test-artifactory
                local:
                  chart_root: ./chart
                values_from:
                  # hack, helmValues still needs a configurable dest path for us to store the output
                  path: .ship/tmp
    - kustomizeIntro: {}
    - kustomize:
        base: base
        overlay: overlays/ship
        dest: artifactory-ha-all.yaml
    - message:
        contents: |
          ## All set
          You can deploy Artifactory to your cluster with:
              kubectl apply -f artifactory-ha-all.yaml
  1. ship init ship.yaml

zendril avatar Apr 19 '19 18:04 zendril

@zendril this is interesting. I just ran through your ship.yaml and was unable to reproduce this one.

apiVersion: v1
data:
  binarystore.xml: |-
    <config version="4">
        <chain>
             lots of XMLy goodness in here
        </chain>
     </config>
kind: ConfigMap
metadata:
  labels:
    app: artifactory-ha
    release: test-artifactory
  name: test-artifactory-artifactory-ha-bs

I haven't done a ton of cross-platform work, but I'm wondering if this is potentially a windows-related issue where the newlines show up in an editor as just \n instead of actual newlines because they don't have \n\r.

Screen Shot 2019-04-30 at 9 28 42 AM

dexhorthy avatar Apr 30 '19 14:04 dexhorthy

@zendril, I've been unable to reproduce on Windows 10 1809 so far. The file is generated with 'LF' line endings (instead of 'CRLF') but all of the editors I've opened things with interpret that properly. (including notepad.exe - apparently Microsoft updated that)

artifactory-binarystore.yaml:

kind: ConfigMap
apiVersion: v1
metadata:
  name: {{ template "artifactory-ha.fullname" . }}-bs
  labels:
    app: {{ template "artifactory-ha.name" . }}
    chart: {{ template "artifactory-ha.chart" . }}
    heritage: {{ .Release.Service }}
    release: {{ .Release.Name }}
data:
  binarystore.xml: |-
    <config version="4">
        <chain>
             lots of XMLy goodness in here
        </chain>
     </config>

The relevant part of artifactory-ha-all.yaml:

---
apiVersion: v1
data:
  binarystore.xml: |-
    <config version="4">
        <chain>
             lots of XMLy goodness in here
        </chain>
     </config>
kind: ConfigMap
metadata:
  labels:
    app: artifactory-ha
    release: test-artifactory
  name: test-artifactory-artifactory-ha-bs
---

Would you mind providing some additional information about your environment so we can work to reproduce this?

laverya avatar May 02 '19 17:05 laverya