Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the root cause why git remote fetch python fails #685

Open
cmoulliard opened this issue Oct 16, 2024 · 1 comment
Open

Log the root cause why git remote fetch python fails #685

cmoulliard opened this issue Oct 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@cmoulliard
Copy link

Issue

When this code fails then cachi2 reports such a message

step-prefetch-dependencies
INFO: Using mounted CA bundle: /mnt/trusted-ca/ca-bundle.crt
'/mnt/trusted-ca/ca-bundle.crt' -> '/etc/pki/ca-trust/source/anchors/ca-bundle.crt'
2024-10-15 12:49:16,848 DEBUG Testing for go mod file in /var/workdir/source/jam/go.mod
2024-10-15 12:49:16,848 DEBUG Testing for go mod file in /var/workdir/source/create-package/go.mod
2024-10-15 12:49:16,848 DEBUG Testing for go mod file in /var/workdir/source/pack/go.mod
2024-10-15 12:49:17,255 ERROR FetchError: Failed to fetch the tags on the Git repository (GitCommandError) for /var/workdir/source

which is missing why git failed. That will not help the users to figure out what they should do !
The root cause or stack trace should be logged. See hereafter:

Traceback (most recent call last):
  File "/var/workdir/source/.tekton/git-fetch.py", line 23, in fetch_git_tags
    repo.remote().fetch(force=True, tags=True)
  File "/venv/lib64/python3.9/site-packages/git/remote.py", line 1069, in fetch
    res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout)
  File "/venv/lib64/python3.9/site-packages/git/remote.py", line 895, in _get_fetch_info_from_stderr
    proc.wait(stderr=stderr_text)
  File "/venv/lib64/python3.9/site-packages/git/cmd.py", line 834, in wait
    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git fetch -v --force --tags -- origin
  stderr: 'fatal: remote error: upload-pack: not our ref f06ea2185060f86690509c03faa793875bf0e221'
Current commit: 262cc4839eae9a07cd8ed0839ab33a15aad5f056
Failed to fetch the tags on the Git repository (GitCommandError) for /var/workdir/source
@eskultety eskultety added the bug Something isn't working label Oct 16, 2024
@eskultety
Copy link
Member

Thank you for reporting this. This will likely be a problem spanning across multiple process executions, not strictly tied to just git so we need to apply a fix globally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants