Windows CMD Shell script seems not to be able to find the .git folder
Before anyone asks: Yes it creates the folder hierarchy correctly, including the entire repo content + .git folder.
Manually executing the git commands in question also works in the very same user, so it can't be a permission problem either.
I'd try to use pushd
and popd
instead of cd
(as both commands exist on windows, linux and mac this could be taken into consideration in general), otherwise I'd suggest to use cd /d
to allow cd
to also change the device letter which pushd does without a switch
Gitlab CI Output:
gitlab-ci-multi-runner-beta 0.3.3-31-gc39d8e7 (c39d8e7)
Using Shell executor...
Running on WINDOWS...
Clonning repository...
Cloning into '<censored>'...
Checkouting <censored> as <censored>...
fatal: Not a git repository (or any of the parent directories): .git
Build failed with exit status 128
Debug Output:
time="2015-06-01T15:41:36+02:00" level=info msg="99d4ccfa Checking for builds... received"
time="2015-06-01T15:41:36+02:00" level=debug msg="0 Received new build for 99d4ccfa build 66"
time="2015-06-01T15:41:36+02:00" level=debug msg="1 Added a new build id: 66
projectid: 6
commands: git submodule update --init
repourl: https://gitlab-ci-token:<censored>.git
sha: 0edf7123e2e5dc1f50400aa39917b444f4d9b849
refname: \"<censored>\"
beforesha: 0dc4e595a2bea4ffd9d69a881221439972f854d5
allowgitfetch: false
timeout: 1800
buildstate: \"\"
buildstarted: {}
buildfinished: {}
buildduration: \"0\"
buildmessage: \"\"
runner:
name: <censored>
url: <censored>
token: <censored>
limit: null
executor: shell
buildsdir: <censored>
environment: []
shell: null
disableverbose: null
outputlimit: null
ssh: null
docker: null
parallels: null
globalid: 0
runnerid: 0
projectrunnerid: 0
"
time="2015-06-01T15:41:36+02:00" level=info msg="99d4ccfa 66 gitlab-ci-multi-runner-beta 0.3.3-31-gc39d8e7 (c39d8e7)"
time="2015-06-01T15:41:36+02:00" level=debug msg="99d4ccfa 66 Shell script: environment:
- CI_BUILD_REF=0edf7123e2e5dc1f50400aa39917b444f4d9b849
- CI_BUILD_BEFORE_SHA=0dc4e595a2bea4ffd9d69a881221439972f854d5
- CI_BUILD_REF_NAME=<censored>
- CI_BUILD_ID=66
- CI_BUILD_REPO=https://gitlab-ci-token:<censored>.git
- CI_PROJECT_ID=6
- CI_PROJECT_DIR=<censored>
- CI=true
- CI_SERVER=yes
- CI_SERVER_NAME=GitLab CI
- CI_SERVER_VERSION=
- CI_SERVER_REVISION=
- GITLAB_CI=true
script: \"@echo off
echo.
setlocal enableextensions
echo Running on %COMPUTERNAME%...
echo
Clonning repository...
rd /s /q \\\"<censored>\\\"
2> NUL 1>NUL
IF %errorlevel% NEQ 0 exit /b %errorlevel%
md \\\"<censored>\\\"
IF
%errorlevel% NEQ 0 exit /b
%errorlevel%
git clone \\\"https://gitlab-ci-token:<censored>.git\\\"
\\\"<censored>\\\"
IF
%errorlevel% NEQ 0 exit /b %errorlevel%
cd \\\"<censored>\\\"
IF
%errorlevel% NEQ 0 exit /b %errorlevel%
echo Checkouting <censored> as <censored>...
git
checkout -qf \\\"0edf7123e2e5dc1f50400aa39917b444f4d9b849\\\"
IF %errorlevel% NEQ
0 exit /b %errorlevel%
echo git submodule update --init
git submodule update
--init
IF %errorlevel% NEQ 0 exit /b %errorlevel%
\"
command: cmd
arguments:
- /Q
- /C
passfile: true
extension: cmd
"
time="2015-06-01T15:41:36+02:00" level=info msg="99d4ccfa 66 Using Shell executor..."
time="2015-06-01T15:41:36+02:00" level=debug msg="99d4ccfa 66 Starting shell command..."
time="2015-06-01T15:41:36+02:00" level=debug msg="99d4ccfa 66 Waiting for signals..."