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

A merge generator with two git generators does not work #10189

Open
3 tasks done
jmccrumm opened this issue Aug 3, 2022 · 2 comments
Open
3 tasks done

A merge generator with two git generators does not work #10189

jmccrumm opened this issue Aug 3, 2022 · 2 comments
Labels
bug Something isn't working component:application-sets Bulk application management related

Comments

@jmccrumm
Copy link

jmccrumm commented Aug 3, 2022

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

I have values files for my helm application in two different external repositories that I would like to apply to my single application. I tried using a merge generator as pasted below, but it always seems to only use the first entry for git generator.

To Reproduce

Here is my ApplicationSet spec:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: my-app
  namespace: argocd
spec:
  generators:
    - merge:
        generators:
          - git:
              files:
                - path: path/to/first.yaml
              repoURL: 'ssh://git@mybitbucket/myproject/first-repo.git'
              revision: master
          - git:
              files:
                - path: path/to/second.yaml
              repoURL: 'ssh://git@mybitbucket/myproject/second-repo.git'
              revision: master
        mergeKeys:
          - firstValues
          - secondValues
  template:
    metadata:
      name: my-app
    spec:
      destination:
        namespace: default
        server: 'https://kubernetes.default.svc'
      project: default
      source:
        helm:
          valueFiles:
            - some-local-values.yaml
          values: |-
            {{firstValues}}
            {{secondValues}}
        path: path/to/myapp/
        repoURL: 'ssh://git@bitbucket/myotherproject/my-app.git'
        targetRevision: master

My first.yaml values file looks like so:

firstValues: |
  key1: value1
  ...

(and similarly with second.yaml and secondValues)

Expected behavior

The helm values in ArgoCD to resolve to the content under firstValues and secondValues, respectively.

Actual behavior

Instead of resolving both items under values, it only ever resolves firstValues, while secondValues is always just {{secondValues}} unresolved, causing a yaml parsing error of course. If I swap the order of the generators and point to second-repo first, secondValues will get resolved but firstValues will remain unresolved. It seems only the first git generator entry is being applied.

Version

argocd: v2.3.4+ac8b7df
  BuildDate: 2022-05-18T11:41:37Z
  GitCommit: ac8b7df9467ffcc0920b826c62c4b603a7bfed24
  GitTreeState: clean
  GoVersion: go1.17.10
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.3.4+ac8b7df

Logs

N/A
@jmccrumm jmccrumm added the bug Something isn't working label Aug 3, 2022
@jmccrumm jmccrumm changed the title A Merge Generator with two git generators does not work A merge generator with two git generators does not work Aug 3, 2022
@iam-veeramalla iam-veeramalla added the component:application-sets Bulk application management related label Aug 4, 2022
@fe-ax
Copy link

fe-ax commented Oct 26, 2022

I just tested this, and it seems to work for me. I think you interpreted mergeKeys wrong.

Using mergeKeys: [id]

id: one
key1: a
key2: b

and

id: one
key2: c
key3: d

become

id: one
key1: a
key2: c
key3: d

@jmccrumm
Copy link
Author

I see. firstValues and secondValues need to be the same name. I will try this when the situation arises again. Thank you.

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:application-sets Bulk application management related
Projects
None yet
Development

No branches or pull requests

3 participants