helm override list values with --set in Azure DevOps

11/22/2019

How do you override values in a Helm list with --set param in Azure DevOps?

Simple use case in values.yaml:

environment:
  - name: foo
    value: override_me
  - name: bar
    value: override_me
  - name: baz
    value: override_me

In the deployment.yaml file I use it like so:

        env:      
{{ toYaml .Values.environment | indent 10}}

One thing that kind of works, but not really, is:

environment[0].name=foo,environment[0].value=hello,{...}

The problem with this override is that it will override the entire list, even if I only want to replace value [0], not [1] and [2]. Also I get parsing errors when I pass url:s or int's (not on localhost, only AZ DevOps) - to overcome that paring error, you can escape it with \" - but then the chart is messed up - even though it passes the validation.

DevOps pipe

So, is it possible to override the env list in my case in Azure DevOps helm deployment? Or do I need to restructure the list to individual key=value pairs?

-- Henkolicious
azure-devops
azure-pipelines
kubernetes-helm

2 Answers

4/7/2020

Get yourself some variables defined in the task:

enter image description here

Use a standard set:

enter image description here

I was using a bash task in a release pipeline pointed at a deploy.sh file which existed as a published artifact. You need to chmod +x the file for this to work properly.

enter image description here

-- David Crook
Source: StackOverflow

11/22/2019

I've got weird experience when doing this, in 2 similar cases in one case it replaces them, in one overrides the whole array. so in the second case what I had to do is this:

environment:
- name: v1
  value: keep_me
- name: v2
  value: keep_me
- name: v3
  value: keep_me
- name: foo
  value: override_me
- name: bar
  value: override_me

and I was doing this in the Azure Devops:

--set environment[3].name=foo,environment[03.value=xxx

for the other one I didnt have to do that, it would gladly overwrite only the values I've input. no idea why it did that.

-- 4c74356b41
Source: StackOverflow