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

fix git safe directory for library generation #704

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

mikaelarguedas
Copy link
Contributor

Without this the createlibrary script fails with

Traceback (most recent call last):
  File "/tmp/docker_images/ros/./create_dockerlibrary.py", line 50, in <module>
    main()
  File "/tmp/docker_images/ros/./create_dockerlibrary.py", line 37, in main
    manifest = parse_manifest(manifest, repo, repo_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/docker_templates/library.py", line 53, in parse_manifest
    commit_sha = latest_commit_sha(repo, commit_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/docker_templates/library.py", line 22, in latest_commit_sha
    log_message = repo.git.log("-1", path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/git/cmd.py", line 736, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/git/cmd.py", line 1316, in _call_process
    return self.execute(call, **exec_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/git/cmd.py", line 1111, in execute
    raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git log -1 ros/noetic/ubuntu/focal/ros-core
  stderr: 'fatal: detected dubious ownership in repository at '/tmp/docker_images'
To add an exception for this directory, call:

	git config --global --add safe.directory /tmp/docker_images'

Traceback (most recent call last):
  File "/tmp/docker_images/ros/./create_dockerlibrary.py", line 50, in <module>
    main()
  File "/tmp/docker_images/ros/./create_dockerlibrary.py", line 37, in main
    manifest = parse_manifest(manifest, repo, repo_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/docker_templates/library.py", line 53, in parse_manifest
    commit_sha = latest_commit_sha(repo, commit_path)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/docker_templates/library.py", line 22, in latest_commit_sha
    log_message = repo.git.log("-1", path)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/git/cmd.py", line 736, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/git/cmd.py", line 1316, in _call_process
    return self.execute(call, **exec_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/git/cmd.py", line 1111, in execute
    raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git log -1 ros/noetic/ubuntu/focal/ros-core
  stderr: 'fatal: detected dubious ownership in repository at '/tmp/docker_images'
To add an exception for this directory, call:

	git config --global --add safe.directory /tmp/docker_images'

Signed-off-by: Mikael Arguedas <[email protected]>
Copy link
Member

@ruffsl ruffsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes. This has bitten a number of my other older CI configs as well. Is the GitHub actions unaflicted by this newer git security feature?

@mikaelarguedas
Copy link
Contributor Author

🤷

We didnt have failed ci for many months (too old to check logs) and as automated PR generation hasn't worked for 2.5years we may not notice if this cause an issue.

@mikaelarguedas mikaelarguedas merged commit 68c9f87 into master Dec 15, 2023
@mikaelarguedas mikaelarguedas deleted the fix_git_permission branch December 15, 2023 20:36
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.

2 participants