Skip to content

fixed fetch git submodules during build checkouts - #874

Open
DrDead0 wants to merge 1 commit into
oblien:mainfrom
DrDead0:issue-835-Git-based-builds
Open

DrDead0 wants to merge 1 commit into
oblien:mainfrom
DrDead0:issue-835-Git-based-builds

Conversation

@DrDead0

@DrDead0 DrDead0 commented Sep 9, 2026

Copy link
Copy Markdown

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 ci inside 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-submodules to the shallow clone strings. Added git submodule update --init --recursive securely for pinned commit checkouts.
  • src/runtime/cloud.ts: Appended --recurse-submodules --shallow-submodules to the Cloud workspace checkout, and passed identical credential.helper properties to ensure relative submodule URLs resolve seamlessly.
  • src/runtime/docker.ts: Added --recurse-submodules --shallow-submodules everywhere to match local behavior.
  • src/runtime/docker.ts: Added a test -f .gitmodules guard in the GitHub Tarball downloader fallback logic. Since GitHub archive tarballs exclude submodules, this accurately triggers a fallback to the native git clone when submodules are required.
  • src/runtime/docker.ts / cloud.ts: Updated the build image .git directory cleaner strings to use find ... -name .git -prune -exec rm -rf {} + instead of static rm -rf, safely removing any nested submodule .git references out of the build context.

Verification

Locally executed tests to confirm packages/adapters passes existing suites and the implementation does not break parent checks:

bun run turbo run test --filter=@repo/adapters

Copilot AI lite review requested due to automatic review settings September 9, 2026 17:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Git-based builds never fetch submodules (no --recurse-submodules / submodule update), so repos with submodule dependencies fail at build

2 participants