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

Git submodule needs origin #5131

Closed
jakedt opened this issue Apr 13, 2023 · 12 comments · Fixed by #5353
Closed

Git submodule needs origin #5131

jakedt opened this issue Apr 13, 2023 · 12 comments · Fixed by #5353
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@jakedt
Copy link

jakedt commented Apr 13, 2023

What happened?

We've got an overlay system that uses remote git resources like so:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://github.com/etc/etc/etc?ref=deadbeefdeafbeef

That git repository itself has submodules in it. When we upgraded to the latest kustomize, we started getting errors like the following:

Error: accumulating resources: accumulation err='accumulating resources from 'https://github.cometc/etc/etc?ref=deadbeefdeafbeef&timeout=90s': URL is a git repository': failed to run '/usr/bin/git submodule update --init --recursive': warning: could not look up configuration 'remote.origin.url'. Assuming this repository is its own authoritative upstream.

This applies whether we use kustomize build directly or the kustomize that's bundled with kubectl.

What did you expect to happen?

I expected to see the rendered resources on the command line.

How can we reproduce it (as minimally and precisely as possible)?

Expected output

Actual output

Kustomize version

v5.0.1

Operating system

None

@jakedt jakedt added the kind/bug Categorizes issue or PR as related to a bug. label Apr 13, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 13, 2023
@natasha41575
Copy link
Contributor

reassigning to @annasong20 for reproduction and triage

/assign @annasong20

@annasong20
Copy link
Contributor

annasong20 commented May 19, 2023

Hi @jakedt, thanks for your patience and all the details you provided (the bit about submodules, error message, and kustomize version were very helpful).

Can you confirm that your target repo refers to a submodule via a relative url?

After playing around with submodules and looking at the source code, I suspect the issue is that #4783 removed the lines that set the repo clone origin in kustomize v5.0.0. This isn't a problem for repos that

  • don't have submodules or
  • reference their submodules via absolute urls

but I was able to reproduce the error on a repo that refers to its submodule via a relative url. Git needs the origin url to pinpoint the url of the submodule.

@jakedt if you're able to confirm that

  1. your repo contains a relative url in the .gitmodules file and that
  2. changing it to an absolute url evades the error

I can accept this issue!

/triage needs-more-information

@k8s-ci-robot
Copy link
Contributor

@annasong20: The label(s) triage/needs-more-information cannot be applied, because the repository doesn't have them.

In response to this:

Hi @jakedt, thanks for your patience and all the details you provided (the bit about submodules, error message, and kustomize version were very helpful).

Can you confirm that your target repo refers to a submodule via a relative url?

After playing around with submodules and looking at the source code, I suspect the issue is that #4783 removed the lines that set the repo clone origin in kustomize v5.0.0. This isn't a problem for repos that

  • don't have submodules or
  • reference their submodules via absolute urls
    but I was able to reproduce the error on a repo that refers to its submodule via a relative url. Git needs the origin url to pinpoint the url of the submodule.

@jakedt if you're able to confirm that

  1. your repo contains a relative url in the .gitmodules file and that
  2. changing it to an absolute url evades the error
    I can accept this issue!

/triage needs-more-information

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@annasong20
Copy link
Contributor

/triage needs-information

@k8s-ci-robot k8s-ci-robot added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 19, 2023
@annasong20
Copy link
Contributor

Actually, though it'd be helpful for @jakedt to confirm, since I've found a bug in the code base, I'll accept this issue.

This should be a relatively straightforward issue to fix! You should only have to restore the lines that set origin: e62480d#diff-e99b726db03e3af485f735ddbed834000807909eb5d51c49082e4a08f48f0651L25-L28

/triage accepted
/unassign
/label good first issue
/retitle Git submodule needs origin

@k8s-ci-robot k8s-ci-robot changed the title Git submodule problems with Kustomize v5.0.1 Git submodule needs origin May 19, 2023
@k8s-ci-robot k8s-ci-robot added the triage/accepted Indicates an issue or PR is ready to be actively worked on. label May 19, 2023
@annasong20
Copy link
Contributor

/help
/label "good first issue"
/remove-triage needs-information

@k8s-ci-robot
Copy link
Contributor

@annasong20:
This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

/help
/label "good first issue"
/remove-triage needs-information

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels May 19, 2023
@annasong20
Copy link
Contributor

/good-first-issue

@k8s-ci-robot
Copy link
Contributor

@annasong20:
This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label May 19, 2023
@Rishi2309
Copy link

@annasong20 @natasha41575 This is my first contribution in project. So I would like to start my contribution with this issue's fix.

@Rishi2309
Copy link

/assign

annasong20 added a commit to annasong20/kustomize that referenced this issue Jun 4, 2023
annasong20 added a commit to annasong20/kustomize that referenced this issue Jun 7, 2023
annasong20 added a commit to annasong20/kustomize that referenced this issue Jun 14, 2023
k8s-ci-robot added a commit that referenced this issue Jul 12, 2023
@charles-chenzz
Copy link
Member

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
6 participants