Skip to content

Commit c16c0c2

Browse files
fmoessbauerjan-kiszka
authored andcommitted
container-entrypoint: add custom git path to safedirs
The git clone path can also be controlled with the GIT_CLONE_PATH environment variable. While this is ignored by kas (as the clone is executed in a cleaned environment), it can happen when cloning the main repository (the one kas then is run from). As the GitLab CI passes the environment variables directly to the container invocation, the GitLab CI cloning of the main repository already uses them, which fails if the path is not added to the safedirs. We now account for this special case. Signed-off-by: Felix Moessbauer <[email protected]> Signed-off-by: Jan Kiszka <[email protected]>
1 parent 4bc876a commit c16c0c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

container-entrypoint

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ if [ -z "$USER_ID" ] && [ -n "$CI_PROJECT_DIR" ]; then
7676
# with our builder user. We handle that internally in kas, but we
7777
# need the exception here as well for git calls outside of kas.
7878
sudo git config --system safe.directory "$CI_PROJECT_DIR"
79+
80+
# Account for externally specified git clone path
81+
if [ -n "$GIT_CLONE_PATH" ]; then
82+
sudo git config --system --add safe.directory "$GIT_CLONE_PATH"
83+
fi
7984
fi
8085
if [ -z "$USER_ID" ] || [ "$USER_ID" = 0 ]; then
8186
# Not a kas-container call, or we shall run everything as root

0 commit comments

Comments
 (0)