-
Notifications
You must be signed in to change notification settings - Fork 418
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 submodules remote tracking #266
Git submodules remote tracking #266
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Welcome @neutronth! |
55fe793
to
bec0339
Compare
/check-cla |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thanks for this PR.
There's a lot going on in here that I don't quite understand, and I will have to patch this in and play with it to understand better. I may have feedback when I get to that. Any additional context you can specify here (comments or just in the PR or commit descriptions) would help a ton. If I am being honest, it may be a few weeks before I get a chance to do this work.
I have a bigger problem, though. I've been working on a v4 branch (not published yet!) which does a MASSIVE overhaul of the internals, cleans up flags, logs, etc. This includes some breaking changes.
This patch is complex enough that I one of two things happens:
- I merge this to master and manually reimplement it in the new structure
- I ask you to make this work in v4 (either only in v4 or in both)
How do you feel about that?
cmd/git-sync/main.go
Outdated
@@ -56,6 +57,9 @@ var flDepth = flag.Int("depth", envInt("GIT_SYNC_DEPTH", 0), | |||
"use a shallow clone with a history truncated to the specified number of commits") | |||
var flSubmodules = flag.String("submodules", envString("GIT_SYNC_SUBMODULES", "recursive"), | |||
"Configure submodule behavior - options are 'recursive', 'shallow' and 'off'.") | |||
var flSubmodulesRemoteTracking = flag.String("submodules-remote-tracking", | |||
envString("GIT_SYNC_SUBMODULES_REMOTE_TRACKING", ""), | |||
"Configure submodules list for remote tracking.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to explain the syntax and meaning a little
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try my best to explain in this commit c508129
Please advise.
cmd/git-sync/main.go
Outdated
} | ||
|
||
// Update submodules with remote tracking enabled | ||
if *flSubmodulesRemoteTracking != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please pass this in as an arg - I know it is a bit tedious, but only main() should use raw flags (and yes I know that is not always true already :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propose the submoduleOptions type
which encapsulates the options and passing around with this variable instead of the direct access to the flSubmodules*
which should be only handled in the main()
as your suggestion.
Proposed patch in this commit dcf07c1
bec0339
to
dcf07c1
Compare
Thank you so much for your review.
I have re-based the branch with current master to keep in sync with the current code-base and propose another
I'll checkout the
It's very OK, I'll handle the |
The branch to track is https://github.com/thockin/git-sync/tree/use-git-mirror |
But I should add that I have been running open-loop. so some of it will need to be adjusted after review. |
dcf07c1
to
92857d5
Compare
Work in progress is https://github.com/neutronth/git-sync/tree/based-thockin-use-git-mirror/git-submodules-remote-tracking |
Any update on this? We want to use the --remote flag |
@neutronth You are a god-send! Just tested your PR and it is working as expected! Thanks! |
Hi, I apologize - it's still in my queue
…On Wed, Dec 2, 2020 at 3:57 PM Kubernetes Prow Robot < ***@***.***> wrote:
@neutronth <https://github.com/neutronth>: PR needs rebase.
Instructions for interacting with me using PR comments are available here
<https://git.k8s.io/community/contributors/guide/pull-requests.md>. If
you have questions or suggestions related to my behavior, please file an
issue against the kubernetes/test-infra
<https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:>
repository.
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#266 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWAVCMTSE6GPNOB4S6PDDSS3IABANCNFSM4QRP4E6Q>
.
|
Hi, sorry that I reply late. The proposed work in progress [1] that based [2] has a major change from the initial patch in this PR. I clone the concept from the For the status, Thanks for your all feedbacks. [1] https://github.com/neutronth/git-sync/tree/based-thockin-use-git-mirror/git-submodules-remote-tracking |
Looks like it is not properly tracking the submodule branch as we originally suspected. While git submodule update --init should be the one-liner to init and update the submodule to track the remote branch, it hardly ever succeeds on anything other than the default branch. You need to run git submodule init first, then git submodule update, then git submodule update --remote --recursive --depth 5 xxx . Otherwise, you can run into errors like this:
I have tested adding these changes and it properly/consistently sets up a submodule to track a remote branch (particularly a branch other than the default branch). |
* Always update the registered submodules using the remote-tracking branch instead of the superproject's recorded SHA-1. Only apply to the submodules' name that listed in the `--submodules-remote-tracking` parameter, otherwise default behavior will be applied. - Use case: Update the latest registered configurations submodule from remote repository - git-sync parameter: ./git-sync ... --submodules-remote-tracking="deployment-configs,app-configs"
The This bot removes
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /remove-lifecycle frozen |
@neutronth: PR needs rebase. 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. |
I have not forgotten this PR! |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
Let's test and merge this. |
This PR won't fly as-is. Discussion in #265 |
Add Git submodules remote tracking
Always update the registered submodules using the remote-tracking branch
instead of the superproject's recorded SHA-1.
Only apply to the submodules' name that listed in the
--submodules-remote-tracking
parameter, otherwise default behavior will be applied.Update the latest registered configurations submodule from remote repository
./git-sync ... --submodules-remote-tracking="deployment-configs,app-configs"
Fixes Add Git submodules remote tracking #265