I have this in my gitlab-ci.yml:
variables:
  DOCKER_DRIVER: overlay2
  DOCKER_TLS_CERTDIR: "/certs"
  DOCKER_HOST: "tcp://docker:2375"
determine version:
  stage: preparation
  tags: 
    - docker
  image: gittools/gitversion
  script:
    - pwd
    - echo $(pwd)
    - gitversion /output json /showvariable FullSemVer > version.txt
    - cat version.txt
  artifacts:
    paths:
      - version.txt
    expire_in: 1 hr
When this runs on my runner, I get this:
1 Running with gitlab-runner 12.6.0 (ac8e767a)
2   on gitlab-runner-01 efEDOrEf
3
Using Docker executor with image gittools/gitversion ...
4 Pulling docker image gittools/gitversion ...
5 Using docker image sha256:2d1d36c0807eaeedc8d4a81b72ae3ee16f7c6a1d25bdce22c8e1983ac6c98dcb for gittools/gitversion ...
7
Running on runner-efEDOrEf-project-475-concurrent-0 via gitlab-runner-01...
9
Fetching changes...
10 Reinitialized existing Git repository in /builds/applications/myapplicationname/.git/
11 From https://path/to/my/git
12  * [new ref]         refs/pipelines/10548 -> refs/pipelines/10548
13    638ed79..9c57f34  feature/3442   -> origin/feature/3442
14 Checking out 9c57f347 as feature/3442...
15 Skipping Git submodules setup
19
INFO [01/10/20 16:05:44:94] Applicable build agent found: 'GitLabCi'.WARN [01/10/20 16:05:44:95] The working directory 'sh' does not exist.INFO [01/10/20 16:05:44:95] IsDynamicGitRepository: FalseERROR [01/10/20 16:05:44:97] An unexpected error occurred:
20 System.IO.DirectoryNotFoundException: Can't find the .git directory in 
21    at GitVersion.GitPreparer.GetProjectRootDirectoryInternal() in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 92
22    at GitVersion.GitPreparer.GetProjectRootDirectory() in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 27
23    at GitVersion.Configuration.ConfigFileLocator.Verify(IGitPreparer gitPreparer) in D:\a\1\s\src\GitVersionCore\Configuration\ConfigFileLocator.cs:line 61
24    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in D:\a\1\s\src\GitVersionExe\GitVersionExecutor.cs:line 105INFO [01/10/20 16:05:44:97] INFO [01/10/20 16:05:44:97] Attempting to show the current git graph (please include in issue): INFO [01/10/20 16:05:44:97] Showing max of 100 commits
26
INFO [01/10/20 16:05:46:26] Applicable build agent found: 'GitLabCi'.WARN [01/10/20 16:05:46:26] The working directory 'sh' does not exist.INFO [01/10/20 16:05:46:26] IsDynamicGitRepository: FalseERROR [01/10/20 16:05:46:28] An unexpected error occurred:
27 System.IO.DirectoryNotFoundException: Can't find the .git directory in 
28    at GitVersion.GitPreparer.GetProjectRootDirectoryInternal() in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 92
29    at GitVersion.GitPreparer.GetProjectRootDirectory() in D:\a\1\s\src\GitVersionCore\GitPreparer.cs:line 27
30    at GitVersion.Configuration.ConfigFileLocator.Verify(IGitPreparer gitPreparer) in D:\a\1\s\src\GitVersionCore\Configuration\ConfigFileLocator.cs:line 61
31    at GitVersion.GitVersionExecutor.VerifyArgumentsAndRun(Arguments arguments) in D:\a\1\s\src\GitVersionExe\GitVersionExecutor.cs:line 105INFO [01/10/20 16:05:46:28] INFO [01/10/20 16:05:46:28] Attempting to show the current git graph (please include in issue): INFO [01/10/20 16:05:46:28] Showing max of 100 commits
34
Uploading artifacts...
35 WARNING: version.txt: no matching files            
36 ERROR: No files to upload                          
38 Job succeeded
How can I get Gitversion to determine the version for my build? I use it for all code that's not built using Docker and I could use that, but I feel it should work in a container as well.
Also, both pwd and echo $(pwd) do not show up in the output, how can I get something in the output?