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

Syncing sources in multi-source application depends on order of sources in spec. #20791

Open
3 tasks done
mteodor opened this issue Nov 13, 2024 · 4 comments
Open
3 tasks done
Labels
bug Something isn't working component:helm component:multi-source-apps version:2.12 Latest confirmed affected version is 2.12

Comments

@mteodor
Copy link

mteodor commented Nov 13, 2024

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
Getting errors when trying to sync multi source application depending on the order of sources specifed.

To Reproduce
Hi All,
I have a question regarding sync for multi source application, i have app defined as follows:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: mirko-app1
spec:
  destination:
    namespace: mirko-app1
    server: https://kubernetes.default.svc/
  project: default
  sources:
  - ref: values
    repoURL: https://github.com/mteodor/argocd-example-apps
    targetRevision: multi-source
  - chart: nginx
    helm:
      valueFiles:
      - $values/helm-values/nginx-values.yaml
    repoURL: https://charts.bitnami.com/bitnami
    targetRevision: 18.2.0
  syncPolicy:
    syncOptions:
    - PrunePropagationPolicy=undefined
    - CreateNamespace=true
    - Validate=true
argocd app sync mirko-app1 --revisions multi-source --source-positions 1                                                                                          
FATA[0002] rpc error: code = FailedPrecondition desc = error resolving repo revision: rpc error: code = Unknown desc = invalid revision 'multi-source': improper constraint: multi-source  

For position 2 it works

argocd app sync mirko-app1 --revisions 18.1.2 --source-positions 2
TIMESTAMP                  GROUP                    KIND            NAMESPACE                  NAME    STATUS    HEALTH            HOOK  MESSAGE
2024-11-13T18:07:54+01:00  networking.k8s.io  NetworkPolicy        mirko-app1      mirko-app1-nginx  OutOfSync                           
2024-11-13T18:07:54+01:00  policy             PodDisruptionBudget  mirko-app1      mirko-app1-nginx  OutOfSync                           
2024-11-13T18:07:54+01:00                         Secret           mirko-app1  mirko-app1-nginx-tls  OutOfSync                           
2024-11-13T18:07:54+01:00                        Service           mirko-app1      mirko-app1-nginx  OutOfSync  Progressing              
2024-11-13T18:07:54+01:00                     ServiceAccount       mirko-app1      mirko-app1-nginx  OutOfSync   
.....

Now if i define application mirko-app2 with sources in reverse order, where helm is now on 1st pos again I'm getting an error when trying to sync on 1st position

argocd app sync mirko-app2 --revisions 18.1.2 --source-positions 1
FATA[0003] rpc error: code = FailedPrecondition desc = error resolving repo revision: rpc error: code = Unknown desc = Unable to resolve '18.1.2' to a commit SHA

Expected behavior

Screenshots

Version

argocd version
argocd: v2.12.4+27d1e64
  BuildDate: 2024-09-26T09:31:42Z
  GitCommit: 27d1e641b6ea99d9f4bf788c032aeaeefd782910
  GitTreeState: clean
  GoVersion: go1.23.1
  Compiler: gc
  Platform: darwin/arm64
argocd-server: v2.12.3+6b9cd82
  BuildDate: 2024-08-27T11:57:48Z
  GitCommit: 6b9cd828c6e9807398869ad5ac44efd2c28422d6
  GitTreeState: clean
  GoVersion: go1.22.4
  Compiler: gc
  Platform: linux/arm64
  Kustomize Version: v5.4.2 2024-05-22T15:19:38Z
  Helm Version: v3.15.2+g1a500d5
  Kubectl Version: v0.29.6
  Jsonnet Version: v0.20.0

Logs

Paste any relevant application logs here.
@mteodor mteodor added the bug Something isn't working label Nov 13, 2024
@andrii-korotkov-verkada andrii-korotkov-verkada added the version:2.12 Latest confirmed affected version is 2.12 label Nov 14, 2024
@andrii-korotkov-verkada
Copy link
Contributor

In the application, you specify targetRevision: 18.2.0, but in the cli you specify 18.1.2

@andrii-korotkov-verkada
Copy link
Contributor

However, I'm not sure, maybe it's supposed to override.

@mteodor
Copy link
Author

mteodor commented Nov 14, 2024

@andrii-korotkov-verkada it should override
when looking in the history it clearly shows it synced to revision used in sync command

argocd app sync mirko-app1 --revisions 18.1.3 --source-positions 2
image

while source is in spec is set to 18.2.0
image

@guillaume-roland-sre
Copy link

guillaume-roland-sre commented Nov 14, 2024

Hi there,

I have the exact same issue. I don't think the order matter, I think it's more that ArgoCD is validating the first targetRevision in each of the sources.
So it will try to validate that multi-source exist in https://charts.bitnami.com/bitnami.

When you do that:

argocd app sync mirko-app1 --revisions multi-source --source-positions 1

ArgoCD will try to find multi-source in both repo and that's failing.

When do you that:

argocd app sync mirko-app1 --revisions 18.1.2 --source-positions 2

It seems it force ArgoCD to look for the correct revision in the source 2 (without the override, it would look for multi-source)

When you do:

argocd app sync mirko-app2 --revisions 18.1.2 --source-positions 1

It override 18.2.0 with 18.1.2, but ArgoCD is still looking for 18.1.2 in https://github.com/mteodor/argocd-example-apps, so it's failing.

The workaround here is the second command you ran, to force the revision on the source position 2, but it's not possible in the UI, so it's still a blocker.

Thanks.

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:helm component:multi-source-apps version:2.12 Latest confirmed affected version is 2.12
Projects
None yet
Development

No branches or pull requests

3 participants