mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-09-19 23:19:52 +00:00
234471af33
When Jenkins Jobs have been modified, they should get deployed in the Jenkins environment. This seems to fail with the following error: ``` Initialized empty Git repository in /opt/build/.git/ fatal: detected dubious ownership in repository at '/opt/build' To add an exception for this directory, call: git config --global --add safe.directory /opt/build ``` By marking /opt/build as a safe directory in the global git configuration file, this problem should not occur anymore. Signed-off-by: Niels de Vos <ndevos@redhat.com>
19 lines
383 B
Bash
Executable File
19 lines
383 B
Bash
Executable File
#!/bin/sh
|
|
|
|
fail() {
|
|
echo "${@}" > /dev/stderr
|
|
exit 1
|
|
}
|
|
|
|
[ -n "${GIT_REPO}" ] || fail 'GIT_REPO environment variable not set'
|
|
[ -n "${GIT_REF}" ] || fail 'GIT_REF environment variable not set'
|
|
|
|
# exit in case a command fails
|
|
set -e
|
|
|
|
git config --global --add safe.directory ${PWD}
|
|
git init .
|
|
git remote add origin "${GIT_REPO}"
|
|
git fetch origin "${GIT_REF}"
|
|
git checkout FETCH_HEAD
|