Skip to content

fix(ci): add safe.directory for git in CI containers#8

Merged
maxamillion merged 1 commit into
mainfrom
rpm
Mar 29, 2026
Merged

fix(ci): add safe.directory for git in CI containers#8
maxamillion merged 1 commit into
mainfrom
rpm

Conversation

@maxamillion

@maxamillion maxamillion commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix build-srpm.sh failing with "Not in a git repository" in CI containers
  • Root cause: git refuses to operate on directories owned by a different user when running as root in containers
  • Adds git config --global --add safe.directory before the git repo check

This fixes all RPM Repository workflow runs which have been failing since the workflow was introduced.

Test plan

  • Verify RPM Repository workflow passes the "Build SRPMs" step
  • Verify full workflow completes including aarch64 builds

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved build script robustness to work reliably in environments with Git safety restrictions, ensuring the packaging build process succeeds across different system configurations.

The build-srpm.sh script fails in CI containers with "Not in a git
repository" because git refuses to operate on directories owned by a
different user. Add git safe.directory config to fix ownership mismatch
when running as root in containerized CI jobs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 29, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c052c4b8-0f7f-4e39-a748-46b72c2e0833

📥 Commits

Reviewing files that changed from the base of the PR and between fcdea4a and f1e4b9c.

📒 Files selected for processing (1)
  • packaging/build-srpm.sh

📝 Walkthrough

Walkthrough

The build script adds a Git configuration command to mark the repository root as a trusted "safe directory" before executing subsequent git operations. This suppresses ownership/safety errors and allows the script to run in restricted environments where Git enforces ownership checks.

Changes

Cohort / File(s) Summary
Git Safe Directory Configuration
packaging/build-srpm.sh
Added git config --global --add safe.directory pre-check to suppress Git ownership/safety restrictions, enabling git commands to proceed in restricted environments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hop-hop, git channels we align,
Marking repos as safe and fine,
No ownership errors to fight,
Safe directories shine so bright,
Scripts now build through the night!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rpm

Comment @coderabbitai help to get the list of available commands and usage tips.

@maxamillion maxamillion merged commit a802cc6 into main Mar 29, 2026
5 of 7 checks passed
maxamillion added a commit that referenced this pull request Mar 30, 2026
The build-srpm.sh script fails in CI containers with "Not in a git
repository" because git refuses to operate on directories owned by a
different user. Add git safe.directory config to fix ownership mismatch
when running as root in containerized CI jobs.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Adam Miller <admiller@redhat.com>
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.

1 participant