cisagov/action-lineage

Cannot pull private parent repository due to missing auth in git client

Xerkus opened this issue ยท 2 comments

๐Ÿ› Summary

Private parent repository can not be pulled because git client does not receive the token required for authentication.

To reproduce

Steps to reproduce the behavior:

  1. Setup lineage action as usual and ensure it works
  2. Make parent repository private and make sure PAT has access to the now private repository
  3. Run action

Expected behavior

Parent repository is pulled and merge branch is created

Any helpful log output or screenshots

Paste the results here:

Xerkus/public-lineage-test
  INFO Checking: Xerkus/public-lineage-test
  INFO Lineage configuration found for Xerkus/public-lineage-test
  INFO Cloning repository: https://github.com/Xerkus/public-lineage-test.git
  INFO โœ… success
  INFO Processing lineage: skeleton
  INFO Upstream: https://github.com/Xerkus/private-lineage-parent.git HEAD
  INFO Attempting to switch to branch: lineage/skeleton
  INFO โœ… (error ok) return code: 128
  INFO Branch did not exist.  Creating: lineage/skeleton from local main
  INFO Creating branch lineage/skeleton from main
  INFO โœ… success
  INFO Switching to lineage/skeleton
  INFO โœ… success
  INFO Pull request branch is new: True
  INFO Fetching https://github.com/Xerkus/private-lineage-parent.git HEAD
  Traceback (most recent call last):
  CRITICAL fatal: could not read Username for 'https://github.com': No such device or address
  
  CRITICAL โŒ ERROR! return code: 128
    File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
      exec(code, run_globals)
    File "/src/lineage/__main__.py", line 5, in <module>
      main()
    File "/src/lineage/entrypoint.py", line 431, in main
      fetch(repo, remote_url, remote_branch)
    File "/src/lineage/entrypoint.py", line 149, in fetch
      run([GIT, "fetch", remote_url, remote_branch], cwd=repo.full_name)
    File "/src/lineage/entrypoint.py", line 68, in run
      raise Exception("Subprocess was expected to exit with 0.")
  Exception: Subprocess was expected to exit with 0.

@Xerkus As I mentioned in your other issue would you try the improvement/use_github_api_for_all_access branch and see if things work as you expect?

Git client is missing auth when trying to clone the downstream repo. I assume same is true for cloning the private parent repo as well

  INFO Checking: Xerkus/private-lineage-test
  INFO Lineage configuration found for Xerkus/private-lineage-test
  INFO Cloning repository: https://github.com/Xerkus/private-lineage-test.git
  CRITICAL Cloning into 'Xerkus/private-lineage-test'...
  fatal: could not read Username for 'https://github.com': No such device or address
  
  CRITICAL โŒ ERROR! return code: 128
  ERROR Unable to clone Xerkus/private-lineage-test.
  Traceback (most recent call last):
    File "/src/lineage/entrypoint.py", line 406, in main
      run([GIT, "clone", repo.clone_url, repo.full_name])
    File "/src/lineage/entrypoint.py", line 69, in run
      raise Exception("Subprocess was expected to exit with 0.")
  Exception: Subprocess was expected to exit with 0.

Repo where action runs is not the same repo