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 submodules remote tracking #266

Closed

Conversation

neutronth
Copy link

@neutronth neutronth commented Sep 1, 2020

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.

    • Use case:
      Update the latest registered configurations submodule from remote repository
    • git-sync parameter:
      ./git-sync ... --submodules-remote-tracking="deployment-configs,app-configs"
  • Fixes Add Git submodules remote tracking #265

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Sep 1, 2020
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Sep 1, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @neutronth!

It looks like this is your first PR to kubernetes/git-sync 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/git-sync has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 1, 2020
@neutronth neutronth force-pushed the git-submodules-remote-tracking branch from 55fe793 to bec0339 Compare September 1, 2020 09:40
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Sep 1, 2020
@neutronth
Copy link
Author

/check-cla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 1, 2020
Copy link
Member

@thockin thockin left a 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:

  1. I merge this to master and manually reimplement it in the new structure
  2. I ask you to make this work in v4 (either only in v4 or in both)

How do you feel about that?

@@ -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.")
Copy link
Member

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

Copy link
Author

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.

}

// Update submodules with remote tracking enabled
if *flSubmodulesRemoteTracking != "" {
Copy link
Member

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 :)

Copy link
Author

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

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 5, 2020
@neutronth neutronth force-pushed the git-submodules-remote-tracking branch from bec0339 to dcf07c1 Compare September 7, 2020 13:02
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 7, 2020
@neutronth
Copy link
Author

Thank you so much for your review.

This patch is complex enough that I one of two things happens:

1. I merge this to master and manually reimplement it in the new structure

I have re-based the branch with current master to keep in sync with the current code-base and propose another
refactor codes, sorry about that if it makes more complexity.
however, I think, the long arguments passing seems to be a bit of mess.

2. I ask you to make this work in v4 (either only in v4 or in both)

I'll checkout the v4 branch and try to apply my patches on top of it. It may takes times but I'll update the status periodically.

How do you feel about that?

It's very OK, I'll handle the 2. and keep in touch here.

@thockin
Copy link
Member

thockin commented Sep 8, 2020

The branch to track is https://github.com/thockin/git-sync/tree/use-git-mirror

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 8, 2020
@thockin
Copy link
Member

thockin commented Sep 8, 2020

But I should add that I have been running open-loop. so some of it will need to be adjusted after review.

@neutronth neutronth force-pushed the git-submodules-remote-tracking branch from dcf07c1 to 92857d5 Compare September 8, 2020 13:37
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 8, 2020
@neutronth
Copy link
Author

@jonathonbattista
Copy link

jonathonbattista commented Oct 28, 2020

Any update on this?

We want to use the --remote flag

@jonathonbattista
Copy link

@neutronth You are a god-send!

Just tested your PR and it is working as expected!

Thanks!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 2, 2020
@thockin
Copy link
Member

thockin commented Dec 4, 2020 via email

@neutronth
Copy link
Author

neutronth commented Dec 5, 2020

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 webhook invocation that splits the go-routine task and separates the code base into the new file from main. Therefore, the main file has been touched in only a few points of code hook.
Just introduced a new file which included all the logic that handle the Git submodules remote tracking synchronization.
Hopefully, it may help the reviewers to walk through the code more easily.

For the status,
I just saw the new release-3.x default branch, please give me some times to prepare the patch based on this branch.

Thanks for your all feedbacks.


[1] https://github.com/neutronth/git-sync/tree/based-thockin-use-git-mirror/git-submodules-remote-tracking
[2] https://github.com/thockin/git-sync/tree/use-git-mirror

@jonathonbattista
Copy link

jonathonbattista commented Dec 11, 2020

@neutronth

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:

"msg"="too many failures, aborting" "error"="Run(git submodule update --remote --recursive --depth 5 xxx): exit status 1: { stdout: \"\", stderr: \"fatal: Needed a single revision\\nUnable to find current origin/xxx revision in submodule path 'xxx'\\n\" }"  "failCount"=0

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"
@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 16, 2021
@thockin thockin added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 16, 2021
@k8s-triage-robot
Copy link

The lifecycle/frozen label can not be applied to PRs.

This bot removes lifecycle/frozen from PRs because:

  • Commenting /lifecycle frozen on a PR has not worked since March 2021
  • PRs that remain open for >150 days are unlikely to be easily rebased

You can:

  • Rebase this PR and attempt to get it merged
  • Close this PR with /close

Please send feedback to sig-contributor-experience at kubernetes/community.

/remove-lifecycle frozen

@k8s-ci-robot k8s-ci-robot removed the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Aug 17, 2021
@k8s-ci-robot
Copy link
Contributor

@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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 19, 2021
@thockin
Copy link
Member

thockin commented Aug 19, 2021

I have not forgotten this PR!

@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 17, 2021
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 17, 2021
@thockin thockin removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Dec 17, 2021
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 17, 2022
@thockin thockin removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 17, 2022
@thockin thockin self-assigned this Mar 17, 2022
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 15, 2022
@thockin thockin removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 18, 2022
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 16, 2022
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 16, 2022
@thockin thockin removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Oct 17, 2022
@nirutgupta
Copy link

Let's test and merge this.

@thockin
Copy link
Member

thockin commented Jan 21, 2023

This PR won't fly as-is. Discussion in #265

@thockin thockin closed this Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Git submodules remote tracking
7 participants