OpenShift deployment: stop building rhpkg images, fix git safe.directory, set agent identity - #458
Conversation
we're building them internally Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
There was a problem hiding this comment.
Code Review
This pull request updates Git configurations in several Containerfiles to resolve ownership issues by adding directories to the safe.directory setting. Feedback highlights that Git's safe.directory does not support shell-style wildcards and recommends using * instead. Additionally, it was noted that the PR description mentions CI changes that are not present in the code.
| # we tell git that all repos in /git-repos/* and .../applicability/* are safe to fetch into | ||
| # because this is a volume that has different owner than our container process | ||
| RUN mkdir /git-repos && chmod -R o+rwX /git-repos && \ | ||
| git config --system --add safe.directory '/git-repos/*' && \ | ||
| git config --system --add safe.directory '/git-repos/applicability/*' |
There was a problem hiding this comment.
Git's safe.directory configuration does not support shell-style wildcards like /git-repos/*. It only accepts literal paths or the special value * to trust all directories. Since /git-repos is a volume containing multiple repositories, you should use * to trust all directories within this container environment.
# we tell git that all repos are safe to fetch into because this is a volume
# that has a different owner than our container process.
RUN mkdir /git-repos && chmod -R o+rwX /git-repos && \
git config --system --add safe.directory '*'
There was a problem hiding this comment.
You are incorrect, this absolutely works:
sh-5.2$ cat ~/.gitconfig
[safe]
directory = /git-repos
directory = /git-repos/*
sh-5.2$ cd /git-repos/
sh-5.2$ ls -lha
total 16K
drwxrwxr-x 5 1005040000 99 4.0K May 7 06:36 .
dr-xr-xr-x. 1 root root 51 May 4 15:09 ..
drwxr-xr-x 2 1005040000 99 4.0K May 4 15:12 applicability
drwxr-xr-x 3 1005040000 99 4.0K May 7 06:30 foobar
drwxr-xr-x 3 99 99 4.0K May 7 06:37 foobar2
sh-5.2$ cd foobar2
sh-5.2$ git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
sh-5.2$ mv ~/.gitconfig{,.nope}
sh-5.2$ git status
fatal: detected dubious ownership in repository at '/git-repos/foobar2'
To add an exception for this directory, call:
git config --global --add safe.directory /git-repos/foobar2
|
|
||
| # so that we can start working with gitlab.com immediately | ||
| RUN git config --global user.email "jotnar@redhat.com" \ | ||
| RUN git config --global user.email "redhat-ymir-agent@redhat.com" \ |
There was a problem hiding this comment.
The pull request title and description mention stopping the building and pushing of images that require rhpkg, but there are no changes to CI workflows or build scripts in this pull request. If this was intended to be part of this PR, please ensure the relevant configuration files (e.g., GitHub Actions or GitLab CI) are included.
Summary
Three deployment fixes for the OpenShift setup:
Stop building/pushing images that require
rhpkg— these images dependon Red Hat internal tooling and cannot be built in CI. They are now excluded
from the build-and-push workflow.
Set git identity in agent containers — configure
user.emailanduser.nameinContainerfile.c9sandContainerfile.c10sso agents cancommit without needing runtime git config.
Fix "dubious ownership" on
/git-reposvolume — the shared git-reposvolume is owned by a different UID than the container process. Added
safe.directoryentries for/git-repos/*and/git-repos/applicability/*to all three Containerfiles (c9s, c10s: via
--globalafter the userswitch; mcp: via
--systemsince git config runs beforeUSER mcp).🤖 Generated with Claude Code