spinnaker / roer

A thin Spinnaker CLI
Apache License 2.0
45 stars 45 forks source link

pipeline-template publish is removing double quotas around some variable #48

Closed oguzdag closed 5 years ago

oguzdag commented 5 years ago

I have a strange problem that I couldn't figure out why. when using roer pipeline-template publish for publishing a template, it is removing some of double quotas from variables (boolean and integer), and because of this behaviour, deployment fails. let me explain with an example

This is the part of the template file

            containers:
              - image: "wurstmeister/kafka:1.1.0"
                name: kafka
                env:
                - name: "KAFKA_AUTO_CREATE_TOPICS_ENABLE"
                  value: "true"
                - name: "KAFKA_BROKER_ID"
                  value: "1"
                - name: "KAFKA_MESSAGE_MAX_BYTES"
                  value: "20000000"
                - name: "KAFKA_ADVERTISED_HOST_NAME"
                  value: "kafka"
                - name: "KAFKA_CREATE_TOPICS"
                  value: "event:1:1"
                - name: "KAFKA_ZOOKEEPER_CONNECT"
                  value: "zookeeper:2181/kafka"

This is the publish method

roer pipeline-template publish deploy-template.yml
INFO[0000] Publishing template
INFO[0000] Waiting for task to complete...               refURL=/tasks/****
INFO[0002] Pipeline has completed
INFO[0002] Task completed                                status=SUCCEEDED

This is the pipeline configuration after publish

        containers:
          - env:
              - name: KAFKA_AUTO_CREATE_TOPICS_ENABLE
                value: true
              - name: KAFKA_BROKER_ID
                value: 1
              - name: KAFKA_MESSAGE_MAX_BYTES
                value: 20000000
              - name: KAFKA_ADVERTISED_HOST_NAME
                value: kafka
              - name: KAFKA_CREATE_TOPICS
                value: 'event:1:1'
              - name: KAFKA_ZOOKEEPER_CONNECT
                value: 'zookeeper:2181/kafka'
            image: 'wurstmeister/kafka:1.1.0'

deployment fails, because publish removes double quotas aroound true,1 and 20000000

Is there a workaround for publish not to remove double quotas or replace it with single quotas like it does to other variables?

karlskewes commented 5 years ago

We use roer but we have manifests fetched from our Gitlab repo rather than defined as text in the Deploy Manifest stage. The Spinnaker pipeline templates have variables for the manifest name and git location. The Spinnaker pipeline template app configs set values for these variables.

Secondly, the below excerpt is from one of the manifests (k8s yaml) that defines an environment variable that includes a Spinnaker parameter which is defined in the pipeline templates app config. This uses the inherit parameters functionality. Took me a while to work out the encapsulation for this and figure might be useful for you.

        env:
        - name: SPRING_APPLICATION_JSON
          value: '{"key":"value", "external-application-url":"https://${ parameters.fqdn_prefix }.example.com"}'
oguzdag commented 5 years ago

For numbers; below syntax creating the string in double quotas in deployed manifest

'${ "1" }'