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

Support repo change between invocations #499

Merged

Conversation

sed-i
Copy link
Contributor

@sed-i sed-i commented Feb 25, 2022

Following the thick hint offered by @thockin in #497, this PR replaces the hard-coded literal "origin" with the --repo value.
This way cleanup takes place even if --repo value changes between invocations.

Fixes #497

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 25, 2022

CLA Signed

The committers are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Contributor

Welcome @sed-i!

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 size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 25, 2022
@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 Feb 25, 2022
@sed-i sed-i changed the title support repo change between invocations Support repo change between invocations Feb 25, 2022
Replaces the hard-coded literal "origin" with the --repo value.
This way cleanup takes place even if --repo value changes between
invocations.
@sed-i sed-i force-pushed the feature/support_repo_change branch from 62fa46b to 50f6327 Compare February 25, 2022 04:40
@sed-i
Copy link
Contributor Author

sed-i commented Feb 25, 2022

/assign @thockin

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.

Thanks! But no good deed goes unpunished.

I try not to use the global flag vars outside of main() - can you see about passing the repo around as an argument, so we can use it in these places? In the v4 (dev) branch, I made a gitRepo type to carry the repo, branch, etc. Not asking you to port all that, but just so you get the point.

Also, can you add a test to test_e2e.sh?

And finally, if you feel industrious, you can also port to v4 (master) branch. Or I can do that if you prefer.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 25, 2022
@sed-i
Copy link
Contributor Author

sed-i commented Feb 25, 2022

I added a test, but it fails with repo2 does not appear to be a git repository:

"msg"="too many failures, aborting" "error"="Run(git ls-remote -q file:///tmp/git-sync-e2e.1377722101/repo2 refs/heads/e2e-branch): exit status 128: { stdout: "", stderr: "fatal: '/tmp/git-sync-e2e.1377722101/repo2' does not appear to be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n" }" "failCount"=0

When I re-ran manually the test steps, it worked without error. Any idea what could be the reason?

@sed-i
Copy link
Contributor Author

sed-i commented Feb 25, 2022

... missing a volume mount, that's why!

        -v "$ROOT":"$ROOT":rw \
        -v "$REPO":"$REPO":ro \
        -v "$WORK":"$WORK":ro \

Will fix shortly.

@sed-i
Copy link
Contributor Author

sed-i commented Feb 25, 2022

Sure, porting to v4 seems straightforward. I can submit a PR against master after we're happy with this one.

@sed-i
Copy link
Contributor Author

sed-i commented Mar 2, 2022

@thockin Is this ok now?

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.

Thanks!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sed-i, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2022
@k8s-ci-robot k8s-ci-robot merged commit dbbebf2 into kubernetes:release-3.x Mar 11, 2022
@sed-i sed-i deleted the feature/support_repo_change branch March 11, 2022 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cleanup of an existing folder fails when dest is provided (v3.4.0)
3 participants