From 5dd4db61ef3c29e48d9dcdbe7a5f89d72fa1a076 Mon Sep 17 00:00:00 2001 From: ewuerger Date: Fri, 22 Sep 2023 08:58:29 +0200 Subject: [PATCH] fix: Fix model validation We run containers with techuser (non-root) but the environment is owned by root. This causes any git command to fail. This commit fixes the problem by adding `safe.directory` to the global git config. --- ci-templates/gitlab/model-validation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-templates/gitlab/model-validation.yml b/ci-templates/gitlab/model-validation.yml index 9d4ab76b..01aa51c6 100644 --- a/ci-templates/gitlab/model-validation.yml +++ b/ci-templates/gitlab/model-validation.yml @@ -6,6 +6,8 @@ model-validation: name: $DOCKER_REGISTRY/capella/base:${CAPELLA_DOCKER_IMAGES_TAG} entrypoint: [""] script: + # As our containers run with techuser (non-root) git commands fail with dubious ownership, see for the solution. + - git config --global --add safe.directory ${CI_PROJECT_DIR} - git fetch - if [ ! -z $CI_COMMIT_BRANCH ]; then git reset --hard origin/$CI_COMMIT_BRANCH; fi - BUILD_DIR=$(pwd)