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

feat: support --recurse-submodules in git clone #639

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/build/pipelines/git-checkout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ inputs:
description: |
The expected commit hash

recurse-submodules:
description: |
Indicates whether --recurse-submodules should be passed to git clone.
default: false

pipeline:
- runs: |
if [ -z "${{inputs.branch}}" ] && [ -z "${{inputs.tag}}" ]; then
echo "Warning (git-checkout): you have not specified a branch or tag."
fi

git_clone_flags=""
if [ "${{inputs.recurse-submodules}}" == "true" ]; then
git_clone_flags="--recurse-submodules"
fi

[ -n '${{inputs.branch}}' ] && clone_target='--branch ${{inputs.branch}}'
[ -n '${{inputs.tag}}' ] && clone_target='--branch ${{inputs.tag}}'

Expand All @@ -47,7 +57,7 @@ pipeline:

git config --global --add safe.directory $workdir
git config --global --add safe.directory $clone_fullpath
git clone $clone_target --depth '${{inputs.depth}}' '${{inputs.repository}}' $workdir
git clone $git_clone_flags $clone_target --depth '${{inputs.depth}}' '${{inputs.repository}}' $workdir

cd $workdir
tar -c . | (cd $clone_fullpath && tar -x)
Expand Down