Skip to content

Commit

Permalink
gh-gl-sync: fetch at max depth rather than unshallow
Browse files Browse the repository at this point in the history
While setting up a new copy of the sync script for Kokkos I encountered
into the following error:

fatal: --unshallow on a complete repository does not make sense

I'm not 100% sure why git decided to do a full (rather than shallow)
clone for this repository, but fetching at maximum depth instead seems
to solve the issue.

https://stackoverflow.com/a/46477285
  • Loading branch information
zackgalbreath committed Oct 15, 2024
1 parent 0e7ae86 commit 6629a7e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/custom_docker_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
matrix:
include:
- docker-image: ./images/gh-gl-sync
image-tags: ghcr.io/spack/ci-bridge:0.0.42
image-tags: ghcr.io/spack/ci-bridge:0.0.43
- docker-image: ./images/ci-key-clear
image-tags: ghcr.io/spack/ci-key-clear:0.0.2
- docker-image: ./images/gitlab-stuckpods
Expand Down
8 changes: 4 additions & 4 deletions images/gh-gl-sync/SpackCIBridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def list_github_prs(self):
# Check if we should defer pushing/testing this PR because it is based on "too new" of a commit
# of the main branch.
tmp_pr_branch = f"temporary_{pr_string}"
_durable_subprocess_run(["git", "fetch", "--unshallow", "github",
_durable_subprocess_run(["git", "fetch", "--depth=2147483647", "github",
f"refs/pull/{pull.number}/head:{tmp_pr_branch}"])
# Get the merge base between this PR and the main branch.
try:
Expand Down Expand Up @@ -263,7 +263,7 @@ def list_github_prs(self):
# then we will push the merge commit that was automatically created by GitHub to GitLab
# where it will kick off a CI pipeline.
try:
_durable_subprocess_run(["git", "fetch", "--unshallow", "github",
_durable_subprocess_run(["git", "fetch", "--depth=2147483647", "github",
f"{pull.merge_commit_sha}:{pr_string}"])
except subprocess.CalledProcessError:
print("Failed to locally checkout PR {0} ({1}). Skipping"
Expand Down Expand Up @@ -343,7 +343,7 @@ def setup_git_repo(self):
self.gitlab_shallow_fetch()

if self.main_branch:
_durable_subprocess_run(["git", "fetch", "--unshallow", "github", self.main_branch])
_durable_subprocess_run(["git", "fetch", "--depth=2147483647", "github", self.main_branch])

def get_gitlab_pr_branches(self):
"""Query GitLab for branches that have already been copied over from GitHub PRs.
Expand Down Expand Up @@ -387,7 +387,7 @@ def update_refspecs_for_tags(self, tags, open_refspecs, fetch_refspecs):
def fetch_github_branches(self, fetch_refspecs):
"""Perform `git fetch` for a given list of refspecs."""
print("Fetching GitHub refs for open PRs")
fetch_args = ["git", "fetch", "-q", "--unshallow", "github"] + fetch_refspecs
fetch_args = ["git", "fetch", "-q", "--depth=2147483647", "github"] + fetch_refspecs
_durable_subprocess_run(fetch_args)

def build_local_branches(self, protected_branches):
Expand Down
2 changes: 1 addition & 1 deletion k8s/production/custom/gh-gl-sync/cron-jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
restartPolicy: Never
containers:
- name: sync
image: ghcr.io/spack/ci-bridge:0.0.42
image: ghcr.io/spack/ci-bridge:0.0.43
imagePullPolicy: IfNotPresent
resources:
requests:
Expand Down

0 comments on commit 6629a7e

Please sign in to comment.