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

tempalte function 'Helm.GetParameterValueByName()' doesn't return image.tag value expressed in '.argocd-source-myapp.yaml' #13132

Closed
3 tasks done
jeffreymlewis opened this issue Apr 5, 2023 · 4 comments · Fixed by #17472
Labels
bug Something isn't working component:config-management Tools specific issues (helm, kustomize etc)

Comments

@jeffreymlewis
Copy link

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

Method Helm.GetParameterValueByName() inside a notification template is returning incorrect values. The default value in values.yaml is getting returned, rather then the override value specified in .argocd-source-myapp.yaml.

{{(call .repo.GetAppDetails).Helm.GetParameterValueByName "subchart.image.tag"}}

To Reproduce

  • Deploy ArgoCD v2.6.7 with a notification template like the following
apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-notifications-cm
  namespace: argocd
data:
  service.slack: |
    token: $slack-token
  template.app-sync-succeeded: |
    email:
      subject: Application {{.app.metadata.name}} has been successfully synced.
    message: |
      *Tag:* {{(call .repo.GetAppDetails).Helm.GetParameterValueByName "subchart.image.tag"}}
  trigger.on-sync-succeeded: |
    - description: Application syncing has succeeded
      send:
      - app-sync-succeeded
      when: app.status.operationState.phase in ['Succeeded']
  • Deploy a "helm" app using ArgoCD
    (Chart.yaml)
apiVersion: v2
name: myapp
description: A Helm chart
type: application
version: 2.6.11

dependencies:
- name: subchart
  version: 2.6.11
  repository: https://raw.githubusercontent.com/myorg/subchart/main

(values.yaml)

subchart:
  image:
    tag: notspecified
    repository: nginx
  • Add an .argocd-source-myapp.yaml override file

(.argocd-source-myapp.yaml)

helm:
  parameters:
  - name: subchart.image.repository
    value: nginx
    forcestring: true
  - name: subchart.image.tag
    value: stable-alpine
    forcestring: true
  • Observe ArgoCD correctly deploying tag stable-alpine
  • Observe the notification template saying the deployed tag is notspecified

Expected behavior

I expected the notification to show tag stable-alpine

Screenshots

N/A

Version

argocd@argo-cd-argocd-server-5fd8775f84-lzxm2:~$ argocd version
argocd: v2.6.7+5bcd846
  BuildDate: 2023-03-23T14:57:27Z
  GitCommit: 5bcd846fa16e4b19d8f477de7da50ec0aef320e5
  GitTreeState: clean
  GoVersion: go1.18.10
  Compiler: gc
  Platform: linux/amd64
FATA[0000] Argo CD server address unspecified

Logs

N/A

@jeffreymlewis jeffreymlewis added the bug Something isn't working label Apr 5, 2023
@jeffreymlewis
Copy link
Author

This might be related to #9213

@jgwest jgwest added the component:config-management Tools specific issues (helm, kustomize etc) label Apr 6, 2023
@tinaenriquez
Copy link

tinaenriquez commented Apr 21, 2023

We have the same issue above! Not able to get the parameter values from the argo-source files created when using git write-back. Would have been helpful in our notifications!

@pasha-codefresh
Copy link
Member

In the UI you can see proper values because it returns from get application API call, but when this expression is resolving it executes /appdetails api call, which return original values only without overrides,

Behavior should be same as in UI, first check overrides and after check from chart itself. I am starting work on solution for it

@yahel2410
Copy link

Hi, which version contain the fix for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:config-management Tools specific issues (helm, kustomize etc)
Projects
None yet
5 participants