Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enables automatic git submodule fetching across all clone sites, resolving build failures for repositories containing submodules by ensuring the build contexts populate those submodule directories correctly.
Motivation
Projects whose repositories use git submodules could not be built by Openship because the source checkout produced empty folders for the submodule directories. Any Dockerfile step that referenced them would fail (e.g.,
npm ciinside a submodule walking up to the root package-lock.json). This change allows submodule fetching by default matching the depth of the parent clones to natively support submodule-dependent projects without requiring user configuration.Related issue
Closes #835
Changes
packages/adapters:
src/runtime/build-pipeline.ts: Appended--recurse-submodules --shallow-submodulesto the shallow clone strings. Addedgit submodule update --init --recursivesecurely for pinned commit checkouts.src/runtime/cloud.ts: Appended--recurse-submodules --shallow-submodulesto the Cloud workspace checkout, and passed identicalcredential.helperproperties to ensure relative submodule URLs resolve seamlessly.src/runtime/docker.ts: Added--recurse-submodules --shallow-submoduleseverywhere to match local behavior.src/runtime/docker.ts: Added atest -f .gitmodulesguard in the GitHub Tarball downloader fallback logic. Since GitHub archive tarballs exclude submodules, this accurately triggers a fallback to the nativegit clonewhen submodules are required.src/runtime/docker.ts/cloud.ts: Updated the build image.gitdirectory cleaner strings to usefind ... -name .git -prune -exec rm -rf {} +instead of staticrm -rf, safely removing any nested submodule.gitreferences out of the build context.Verification
Locally executed tests to confirm
packages/adapterspasses existing suites and the implementation does not break parent checks:bun run turbo run test --filter=@repo/adapters