Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Bug: in base file \n after helm render #917

Open
zendril opened this issue Apr 19, 2019 · 2 comments
Open

Bug: in base file \n after helm render #917

zendril opened this issue Apr 19, 2019 · 2 comments

Comments

@zendril
Copy link

zendril commented Apr 19, 2019

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
@dexhorthy
Copy link
Member

dexhorthy commented Apr 30, 2019

@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

@laverya
Copy link
Member

laverya commented May 2, 2019

@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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants