argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.55k stars 5.35k forks source link

Plugin parameters + sources then error in the UI: "Cannot read properties of undefined (reading 'plugin')" #13989

Open guido-1 opened 1 year ago

guido-1 commented 1 year ago

Checklist:

Describe the bug

Plugin parameters displayed even with multiple sources.

To Reproduce

  1. define parameters in plugin.yaml.
  2. create ArgoCd application with source not sources and which uses the plugin.
  3. display parameters in user interface -> parameters are displayed as expected.
  4. swap source for sources in the application description.
  5. display parameters in user interface -> argocd shows TypeError: Cannot read properties of undefined (reading 'plugin').

Expected behavior

Instead of the type error the parameters are displayed also with multiple sources. Or if it is not possible because of the multiple sources a hint that it is not possible.

Version

argocd: v2.7.4+a33baa3.dirty
  BuildDate: 2023-06-05T19:00:34Z
  GitCommit: a33baa301fe61b899dc8bbad9e554efbc77e0991
  GitTreeState: dirty
  GoVersion: go1.19.6
  Compiler: gc
  Platform: linux/amd64

logs

Stacktrace:

TypeError: Cannot read properties of undefined (reading 'plugin')
    at Df (https://argocd-.../main.016255609a68d98fc5bc.js:2:1707820)
    at Jr (https://argocd-...main.016255609a68d98fc5bc.js:2:808335)
    at ya (https://argocd-.../main.016255609a68d98fc5bc.js:2:854240)
    at pl (https://argocd-.../main.016255609a68d98fc5bc.js:2:847016)
    at ul (https://argocd-.../main.016255609a68d98fc5bc.js:2:846941)
    at il (https://argocd-.../main.016255609a68d98fc5bc.js:2:843971)
    at https://argocd-.../main.016255609a68d98fc5bc.js:2:795750
    at t.unstable_runWithPriority (https://argocd-.../main.016255609a68d98fc5bc.js:2:870798)
    at Uo (https://argocd-.../main.016255609a68d98fc5bc.js:2:795459)
    at qo (https://argocd-.../main.016255609a68d98fc5bc.js:2:795695)
guido-1 commented 1 year ago

https://cloud-native.slack.com/archives/C01TSERG0KZ/p1686671755664219?thread_ts=1686667891.272329&cid=C01TSERG0KZ

Same problem with kustomize + multi-source

Diliz commented 1 year ago

Same problem with env variables as well, it seems some build env variables are not there too, currently in argocd 2.7.2, here an example:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  labels:
    argocd.argoproj.io/managed-by: argocd
  name: hello-world-multiple-sources
  namespace: argocd
spec:
  destination:
    namespace: hello-world-plugin-multiple-sources
    server: 'https://kubernetes.default.svc'
  project: hello-world
  sources:
    - path: .
      plugin:
        env:
          - name: ARGOCD_APP_TOTO
            value: customtoto
          - name: ARGOCD_APP_REGISTRY
            value: myregistry
          - name: ARGOCD_APP_CLUSTER_NAME
            value: ocpv4lab
          - name: ARGOCD_APP_TECHNOLOGY
            value: helm
          - name: ARGOCD_APP_PROVIDER
            value: argo
          - name: ARGOCD_APP_TEAM
            value: memyselfandi
          - name: ARGOCD_APP_VALUES
            value: ''
        valueFiles:
          - $values/values.yaml
          - $values/values-2.yaml
        name: helm
      repoURL: 'ssh://git@git/myorg/myrepo/hello-world.git'
      targetRevision: master
    - repoURL: 'ssh://git@git/myorg/myrepo/hello-world.git'
      targetRevision: sometag
      ref: values
  syncPolicy:
    syncOptions:
      - CreateNamespace=true
      - ApplyOutOfSyncOnly=true

The error is that the env variables I setted are not there, nor the parameters as shown by others.

crenshaw-dev commented 1 year ago

The UI doesn't currently fully support multi-source apps. For example, it doesn't show the parameters for all the sources.

But it also shouldn't throw an error. That's a bug.

Ruby-rc commented 4 days ago

The UI now has a multi-source panel(see PR:https://github.com/argoproj/argo-cd/pull/17275 ),

so should this issue & #15038 be considered resolved?