HiveBrain v1.2.0
Get Started
← Back to all entries
snippetyamlkubernetesMinor

How to properly escape brackets in ArgoCD?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
properlybracketsargocdhowescape

Problem

I have an ArgoCD + Argo Workfows setup. In my manifests files, I am trying to escape double brackets since I have some helm apps, and if I manually edit the Argo workflow file with the expression below, it works. BUT if I push any changes my app gets degraded, with the following error: cannot validate Workflow: templates.main.steps failed to resolve {{steps.scheduler.outputs.result}} and this is what my config looks like:

templates:
      - name: main
        steps:
        - - name: scheduler
            template: scheduler
          - name: step-1
            templateRef:
              name: step-1
              template: my-templates
            when: '"{{`{{steps.scheduler.outputs.result}}`}}" =~ example'


Any ideas? I think this might be Argocd related, since the error only appears there and I can manually run the workflow from Argo.

Solution

Try this "beauty":

{{ "'{{steps.scheduler.outputs.result}} =~ example'" }}


  • {{ "" }} - instructs go template to consider anything within as a literal



  • ' - is a faint attempt to keep it as a string value in YAML; it should be optional

Code Snippets

{{ "'{{steps.scheduler.outputs.result}} =~ example'" }}

Context

StackExchange DevOps Q#16376, answer score: 1

Revisions (0)

No revisions yet.