Skip to content

fixed fetch git submodules during build checkouts - #874

Merged
Hydralerne merged 1 commit into
oblien:feat/bugfix-integration-2026-09-15from
DrDead0:issue-835-Git-based-builds
Sep 15, 2026
Merged

Hydralerne merged 1 commit into
oblien:feat/bugfix-integration-2026-09-15from
DrDead0:issue-835-Git-based-builds

Conversation

@DrDead0

@DrDead0 DrDead0 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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.

@Hydralerne

Hydralerne commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Incorporated this PR into feat/bugfix-integration-2026-09-15 via 4470767d, preserving the original commits and adapting the fix to the current architecture.

Git-based builds now materialize recursive submodules at the requested parent commit across server Docker, orchestrator Docker, shared build pipelines, and cloud contexts/source inspection. GitHub archives containing .gitmodules fall back to Git.

GitHub now records this contributor PR as merged into the integration branch. The integrated changes are tested and awaiting merge to main.

Validation:

  • All 3,681 adapter tests passed; adapter TypeScript check passed.
  • 85 focused tests passed, including 11 tests executing real Git commands against recursive/relative submodule fixtures, branch heads, pinned rollbacks, and unavailable dependencies.
  • Seven real Git fixture tests fail against the original PR, covering missing architecture paths and rollback ordering.
  • Real Git configuration matching verifies that the relay header is excluded from other repositories, lookalike paths, hosts, and HTTP downgrades.

@Hydralerne Hydralerne closed this Sep 15, 2026
@Hydralerne Hydralerne reopened this Sep 15, 2026
@Hydralerne
Hydralerne changed the base branch from main to feat/bugfix-integration-2026-09-15 September 15, 2026 18:26
@Hydralerne
Hydralerne merged commit 4470767 into oblien:feat/bugfix-integration-2026-09-15 Sep 15, 2026
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

3 participants