-
Notifications
You must be signed in to change notification settings - Fork 42
feat: support shallow git clones #660
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
base: main
Are you sure you want to change the base?
Conversation
@ahal Can you take a look at this change? |
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.
Thanks for the PR!
This looks like a good start, but the git_checkout
function is internal to run-task
, so there's no way for a user to request a shallow clone here. You'll need to trace backwards, forwarding the argument all the way until the main
function, where you'll need to create a new command line argument for this.
It would also be much appreciated if you could update a test to cover this new flag somewhere in test/test_scripts_run_task.py
:)
Oh yeah, good point—I didn’t think about that. |
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.
Thanks! This is close, have a few more minor requests though.
Prevents potential backward compatibility issues.
I've addressed the comments, please review again. |
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.
Apologies for the delayed review!
@@ -1061,6 +1069,9 @@ def main(args): | |||
parser.add_argument("--user", default="worker", help="user to run as") | |||
parser.add_argument("--group", default="worker", help="group to run as") | |||
parser.add_argument("--task-cwd", help="directory to run the provided command in") | |||
parser.add_argument("--shallow", action="store_true", | |||
default=False, help="perform a shallow clone (default: false)", | |||
) |
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.
I'm really sorry, I told you to add an argument here. But on closer look, I was wrong and instead we should add this in collect_vcs_options
using an environment variable like most of the other vcs arguments. You should add something like:
shallow = os.environ.get("%s_SHALLOW_CLONE" % env_prefix)
and make sure to return it (like you already are).
Support the git shallow clones using --depth=1 flag.
This PR fixes #503