Closed ankushg closed 3 years ago
@guitarrapc I think this should be ok, but would definitely like your feedback on this because there might be other reasons for the -t
flag that I'm missing
This orb currently fetches all tags when run from a tag. This can be problematic when a repo has many tags. For example, we have a repo with almost 3000 tags and the checkout process takes around 3 minutes on a tagged build in CI.
Yes, I understood.
Instead of fetching all tags, we instead fetch and create a reference to the specific tag we are trying to check out. This should also let consumers pass in --no-tags in fetch_options
I do want respect your idea.
@ankushg
I think this should be ok, but would definitely like your feedback on this because there might be other reasons for the -t flag that I'm missing
Why I use -t
is to follow what CircleCI checkout do. CircleCI is checking out tag with following, that's all reason.
echo 'Fetching from remote repository'
if [ -n "$CIRCLE_TAG" ]; then
git fetch --force --tags origin
else
git fetch --force origin '+refs/pull/23/head:refs/remotes/origin/pull/23'
fi
git-shallow-clone-orb's concept is add small spices to faster original checkout
.
I love your idea, so let me think how to offer this functionality.
To achieve consistency of `fetch_options: --no-tags, option2 is better, presumably. Or if only few people is using all tags, Option3 is the choise.
I don't have concrete reason to select Option2 or 3, or others right now.
I'm ok with option 1 with some sort of "tag_fetch_options" that's set to "--tags" to fetch all tags by default so it's not breaking. Then we can change it to "--no-tags" for us
Definitely want to minimize breaking changes for your users!
@guitarrapc I updated this PR to add an additional tag_fetch_options
configuration parameter so it doesn't break anyone's existing configuration!
@ankushg I've released v2.4.0.
https://circleci.com/developer/orbs/orb/guitarrapc/git-shallow-clone?version=2.4.0
There are 2 choice to skip fetch tags.
If you use git-shallow-clone/checkout
, then use no_tags: true
.
- git-shallow-clone/checkout:
no_tags: true
If you use git-shallow-clone/checkout_advanced
, then use tag_fetch_options: '--no-tags'
. Optionally add --no-tags
to fetch_options if needed.
# use --no-tags to fetch single tag on git `TAG`.
- git-shallow-clone/checkout_advanced
fetch_options: '--depth 10 --no-tags' # you can omit this.
tag_fetch_options: '--no-tags'
This orb currently fetches all tags when run from a tag. This can be problematic when a repo has many tags. For example, we have a repo with almost 3000 tags and the checkout process takes around 3 minutes on a tagged build in CI.
This PR adds
tag_fetch_options
toadvanced_checkout
.fetch_options
when fetching tags--tags
to avoid backwards-compatibility issues--no-tags
, overriding default--tags
behavior