Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix argocd_deploy role templates/argocd-helm-repo.j2 to handle boolean #119

Open
mikej888 opened this issue Oct 24, 2023 · 0 comments
Open

Comments

@mikej888
Copy link
Collaborator

I updated a DARE-SeRP-Dev-Deployment-style teleport-values.yaml file with an OCI-enabled Helm chart:

...
    repos:
      ...
      - name: dareoci
        url: "https://harbor.ukserp.ac.uk/chartrepo/dare"
        type: "helm"
        enableOCI: true

Running the playbook failed:

$ ansible-playbook -i inventories/eidf-tre-teleport-remote.yaml 1-remote-vm-setup-and-deploy-epcc.yaml -v
...
TASK [dare.common.argocd_deploy : make helm repo secret] ***********************
fatal: [single_host]: FAILED! => {"changed": false, "msg": "Failed to create object: b'{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"Secret in version \\\\\"v1\\\\\" cannot be handled as a Secret: json: cannot unmarshal bool into Go struct field Secret.stringData of type string\",\"reason\":\"BadRequest\",\"code\":400}\\n'", "reason": "Bad Request"}

PLAY RECAP *********************************************************************
single_host                : ok=114  changed=49   unreachable=0    failed=1    skipped=42   rescued=0    ignored=1   

Wrapping the true value in quotes - 'true' or "true" - and rerunning the playbook likewise failed. However, using double-quotes - "'true'" - and rerunning the playbook succeeds.

An alternative is to edit ansible/roles/argocd_deploy/templates/argocd-helm-repo.j2 and update

{% if item.enableOCI is defined %}
  enableOCI: {{ item.enableOCI }}
{% endif %}

to

{% if item.enableOCI is defined %}
  enableOCI: '{{ item.enableOCI }}'
{% endif %}

Not wrapping the enableOCI value in quotes in the playbook succeeds if this latter fix is applied.

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

No branches or pull requests

1 participant