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

The 'repo add' command incorrectly requires upsert flag #2925

Closed
alexmt opened this issue Dec 30, 2019 · 19 comments · Fixed by #2926
Closed

The 'repo add' command incorrectly requires upsert flag #2925

alexmt opened this issue Dec 30, 2019 · 19 comments · Fixed by #2926
Assignees
Labels
bug Something isn't working regression Bug is a regression, should be handled with high priority
Milestone

Comments

@alexmt
Copy link
Collaborator

alexmt commented Dec 30, 2019

Describe the bug

The 'repo add' command incorrectly requires upsert flag even if repo add command does not introduce any changes if repo configuration

To Reproduce

  1. Manually add repository https://github.com/argoproj/argocd-example-apps in argocd-cm config map.
  2. Run argocd repo add https://github.com/argoproj/argocd-example-apps
  3. Command fails with error existing repository spec is different; use upsert flag to force update

Expected behavior

The upsert should not be required in this case

Screenshots

If applicable, add screenshots to help explain your problem.

Version

v1.3.6
@SabySen
Copy link

SabySen commented Aug 24, 2021

@alexmt Face this issue in 2.1.0 again. Unable to add the repo.
Unable to connect HTTPS repository: existing repository spec is different; use upsert flag to force update

@kj187
Copy link

kj187 commented Aug 25, 2021

same here

@alexmt alexmt reopened this Aug 25, 2021
@alexmt alexmt added this to the v2.2 milestone Aug 25, 2021
@alexmt alexmt added the regression Bug is a regression, should be handled with high priority label Aug 25, 2021
@Jaydee94
Copy link

Jaydee94 commented Sep 7, 2021

Experienced the Same Problem with Version 2.1.2.

@matoszz
Copy link

matoszz commented Sep 8, 2021

also experienced the same issue on v2.1.2

@neelk-s1
Copy link

we had luck reverting to v2.0.2

@SabySen
Copy link

SabySen commented Sep 10, 2021

we had luck reverting to v2.0.2

@neelk-s1 2.0.4 is good as well. I am thinking the moment you go to the next minor version the trouble begins.

@pasha-codefresh
Copy link
Member

I can't reproduce this issue with steps as inside description. Could you please share details
@SabySen @kj187 @neelk-s1 @matoszz @Jaydee94

@yogeek
Copy link

yogeek commented Sep 13, 2021

Hi :)
Same problem with 2.1.1
here are the details :

$ argocd  version  --short                                                                          
argocd: v2.1.1+aab9542
argocd-server: v2.1.1+aab9542

$ argocd repocreds list
URL PATTERN                     USERNAME  SSH_CREDS  TLS_CREDS
git@$GIT_URL:  -         false      false

# Same repo, same key
$ argocd repocreds add git@$GIT_URL: --ssh-private-key-path ~/.ssh/argocd.pem
FATA[0002] rpc error: code = InvalidArgument desc = existing repository credentials spec is different; use upsert flag to force update

$ argocd repocreds rm git@$GIT_URL:
Repository credentials for 'git@code.tooling.prod.cdsf.io:' removed

$argocd repocreds add git@$GIT_URL: --ssh-private-key-path ~/.ssh/argocd.pem
Repository credentials for 'git@$GIT_URL:' added

And then any addtionnal argcd repocreds add is ok

@pasha-codefresh
Copy link
Member

Thank you @yogeek , i will check it today

@yogeek
Copy link

yogeek commented Sep 13, 2021

@pasha-codefresh thanks
Side note : maybe the issue is only if argocd has been updated to a new version, not sure about that but I had the issue only on clusters where I did an upgrade, not fresh install

@SabySen
Copy link

SabySen commented Sep 13, 2021

Seems to me that the issue is when you upgrade to the 2.1.x version. you can replicate the same from the UI as well.

@Jaydee94
Copy link

Jaydee94 commented Sep 13, 2021

I've Upgraded from 2.0.1 to 2.1.2. Seems to work with a fresh Installation. When upgrading from a prior version the issue appears.

@SabySen
Copy link

SabySen commented Sep 13, 2021

IDK upgrading from 2.0.1 but 2.0.4 to 2.1.0 gives me this issue.

@pasha-codefresh
Copy link
Member

I have tried

  1. Install argocd v2.0.0
  2. Execute argocd repocreds add git@$GIT_URL: --ssh-private-key-path ~/.ssh/id_rsa
  3. Upgrade to stable kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  4. Execute argocd repocreds add git@$GIT_URL: --ssh-private-key-path ~/.ssh/id_rsa

As result I got: "repository credentials for added" without any error.

Still cant reproduce it :(

@pasha-codefresh
Copy link
Member

I would propose improve this error message, "existing repository spec is different; use upsert flag to force update" with details what actually was changed

@alexisbel1
Copy link

I had the same problem when upgraded from v2.0 to v2.1.4. I had to manually removed the repo-**** secret where the SSH key was already defined.

@siddana123
Copy link

after updating from 2.0.5 to v2.1.3, Unable to add the repo.
Unable to connect HTTPS repository: existing repository spec is different; use upsert flag to force update

@leoluz
Copy link
Collaborator

leoluz commented Nov 5, 2021

@pasha-codefresh I was working on another bug (#7369) which is somehow related to this one.

There was a bug in the argocd repo add command that would return a misleading error message (existing repository spec is different; use upsert flag to force update) if the related secret was found in k8s without the proper label. This was addressed by #7617 and now it will return a proper error message. For example:

FATA[0001] rpc error: code = InvalidArgument desc = secret "repo-412345316" doesn't have the proper "argocd.argoproj.io/secret-type" label: please fix the secret or delete it

@alexmt Do you think we can close this issue?

@leoluz
Copy link
Collaborator

leoluz commented Nov 5, 2021

@siddana123 can you please check if in the secret associated with your repo the following label is defined?

labels:
    argocd.argoproj.io/secret-type: repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression Bug is a regression, should be handled with high priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.