Skip to content

fix: add registry does not honor default main/master branch#843

Open
ritesh-harihar wants to merge 2 commits intomainfrom
fix-add-registry-not-honor-main-branch
Open

fix: add registry does not honor default main/master branch#843
ritesh-harihar wants to merge 2 commits intomainfrom
fix-add-registry-not-honor-main-branch

Conversation

@ritesh-harihar
Copy link
Collaborator

@ritesh-harihar ritesh-harihar commented Mar 17, 2026

Description
This occurred because when users do not explicitly pass a --ref string, Nomad Pack assumed the target was "latest". For performance reasons, a previous PR introduced logic that appended ?depth=1 to the Go-Getter URL for "latest" downloads to enforce a shallow clone.

However, forcing depth=1 without specifying a branch name causes the underlying git clone mechanism inside go-getter to eagerly assume the master branch on certain repository schemas. For registries defaulting to main, this throws an error.

Fix:
This PR repairs the broken behavior by removing the hardcoded ?depth=1 parameter injection for latest registries entirely:

  • Refactored the cloneRemoteGitRegistry URL-building logic out into a clean helper function (buildGoGetterGitURL).
  • Removed the else condition that appended ?depth=1 when IsLatest() evaluated to true. Without the depth restriction, Go- Getter and Git are allowed to naturally negotiate the remote's actual default symbolic $HEAD (resolving successfully to main without throwing the "master not found" exception).

JIRA Ticket

Reminders

  • Add CHANGELOG.md entry
  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

@ritesh-harihar ritesh-harihar requested review from a team as code owners March 17, 2026 10:17
@ritesh-harihar ritesh-harihar self-assigned this Mar 17, 2026
@ritesh-harihar ritesh-harihar changed the title fix: add registry does not honer default main/master branch fix: add registry does not honor default main/master branch Mar 17, 2026
@ritesh-harihar ritesh-harihar force-pushed the fix-add-registry-not-honor-main-branch branch from 956701c to fc32eba Compare March 17, 2026 10:44
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.

nomad-pack add registry does not honer default main/master branch

1 participant