carvel-dev / vendir

Easy way to vendor portions of git repos, github releases, helm charts, docker image contents, etc. declaratively
https://carvel.dev/vendir
Apache License 2.0
276 stars 49 forks source link

Sync fails when providing the same secret more than once #238

Closed odinnordico closed 1 year ago

odinnordico commented 1 year ago

What steps did you take: [A clear and concise description steps that can be used to reproduce the problem.]

  1. Create a private git repository with multiple folders to sync
repo
|- app
|--- app.yaml
|- cm
|--- cm.yaml
|- secret
|--- secret.yaml
  1. Create the vendir.yml file with multiple content entries, each to different folder of the same repo, each entry has the secretRef with the same Secret name
apiVersion: vendir.k14s.io/v1alpha1
kind: Config
directories:
- path: "repo"
  contents:
  - path: cm
    git:
      url: git@github.com:odinnordico/kapp-controller-private-test.git
      secretRef:
          name: ssh-key-secret
      ref: origin/main
  - path: secret
    git:
      url: git@github.com:odinnordico/kapp-controller-private-test.git
      secretRef:
          name: ssh-key-secret
      ref: origin/main
---
apiVersion: v1
data:
  ssh-privatekey: LS...o=
kind: Secret
metadata:
  creationTimestamp: null
  name: ssh-key-secret
---
apiVersion: v1
data:
  ssh-privatekey: LS...=
kind: Secret
metadata:
  creationTimestamp: null
  name: ssh-key-secret
---
apiVersion: v1
data:
  ssh-privatekey: LS...o=
kind: Secret
metadata:
  creationTimestamp: null
  name: ssh-key-secret
  1. Run the vendir command
    vendir sync 
  2. Check the output:
Fetching: repo + app (git from git@github.com:odinnordico/kapp-controller-private-test.git@origin/main)

vendir: Error: Syncing directory 'repo':
  Syncing directory 'app' with git contents:
    Fetching git repository:
      Expected to find one secret 'ssh-key-secret', but found multiple

What happened: [A small description of the issue]

When using the same secret to sync folders in the same private repo and providing the secret more than once, vendir fails expecting only one secret and not matter if it is the same

What did you expect: [A description of what was expected]

The directory syncs correctly with the private git repo

Anything else you would like to add: [Additional information that will assist in solving the issue.]

Kapp Controller related issue: 1002

Environment:

PRETTY_NAME="Debian GNU/Linux bookworm/sid" NAME="Debian GNU/Linux" VERSION_CODENAME=bookworm ID=debian


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.