3

I am trying to build web application with gitlab-CI. I created runner with this configuration:

name = "REDACTED"
  url = "REDACTED"
  token = REDACTED
  executor = "docker-windows"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "mcr.microsoft.com/powershell"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["c:\\cache"]
    shm_size = 0

Then my .gitlab-ci.yml looks like this

image: microsoft/dotnet:latest
stages:
  - build
  - test
  
before_script:
  - "dotnet restore"
  
node_build: 
  stage: build
  only: 
    - master
  script: 
    - "echo Stage - Build started"
    - "cd ./WebApplication"
    - dir
    - dotnet build

node_test: 
  stage: test
  only: 
    - master
  script: 
    - "echo Stage - Test started"
    - "cd ./WebApplication"
    - dir
    - dotnet build

When the pipeline is ran, output looks like this

Running with gitlab-runner 13.11.0 (7f7a4bb0)
  on REDACTED  REDACTED 
Preparing the "docker-windows" executor
Using Docker executor with image microsoft/dotnet:latest ...
Pulling docker image microsoft/dotnet:latest ...
Using docker image sha256:34f6f2295334d34567c67059f7c28836c79e014d0c4fadf54de3978798640003 for microsoft/dotnet:latest with digest microsoft/dotnet@sha256:61d86fc52893087df54b0579fcd9c33e144a4b3d34c543a94e6a6b376c74285d ...
Preparing environment
Running on REDACTED via 
REDACTED ...
Getting source from Git repository
Fetching changes with git depth set to 50...

Reinitialized existing Git repository in C:/builds/REDACTED /c-sharp-ci-test/.git/
Checking out bbb22919 as master...

git-lfs/2.11.0 (GitHub; windows amd64; go 1.14.2; git 48b28d97)

Skipping Git submodules setup

Executing "step_script" stage of the job script
Using docker image sha256:34f6f2295334d34567c67059f7c28836c79e014d0c4fadf54de3978798640003 for microsoft/dotnet:latest with digest microsoft/dotnet@sha256:61d86fc52893087df54b0579fcd9c33e144a4b3d34c543a94e6a6b376c74285d ...
Cleaning up file based variables
ERROR: Job failed (system failure): Error response from daemon: container e144f05bdd00b4e744554345666afbc008ee2437c7d56bf4a98fbd949a88b1b2 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail:  Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(173)\vmcomputeagent.exe!00007FF7D970B1D7: (caller: 00007FF7D96BE70B) Exception(6) tid(37c) 80070002 The system cannot find the file specified.
    CallContext:[\Bridge_ProcessMessage\VmHostedContainer_ExecuteProcess] 
 Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"powershell -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -","User":"ContainerUser","WorkingDirectory":"C:\\","Environment"

When I look into log, it says it tried to run step_script stage of the job, which I never specified and it tries to run powershell. Why is that happening and how can I get rid of it ? I supose dotnet:latest does not have powershell in it as it is not needed for building.

Hynek Bernard
  • 744
  • 1
  • 11
  • 30

1 Answers1

0

First, it is always best to use a fixed tag instead of the shifting "latest": from one build to the next, "latest" can reference a new image version.

Second try a specific dotnet image like mcr.microsoft.com/dotnet/core/sdk:3. instead of microsoft/dotnet:xxx: note though they are likely to use Powershell, as seen in their Dockerfile

Try one of the .Dotnet Samples outside of GitLab to see if you can make it work manually, then include it in your gitlab-ci.yml.

Note: from gitlab-org/gitlab-runner issue 26418, step_script would be equivalent to build_script.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250