2

I'm currently setting up GitLab CI/CD. The Runner is installed on a Windows Server 2019 VM which has Docker Engine running. My gitlab-ci.yml looks something like this:

variables:
  GIT_STRATEGY: clone
  GIT_DEPTH: 0

stages:
  - export

export:
  stage: export
  image: mcr.microsoft.com/dotnet/core/sdk:3.1
  tags:
    - myrunner
  script:
    - COPY . ./
    - 'curl --location --output artifacts.zip --header "JOB-TOKEN: $CI_JOB_TOKEN" "https://git.myinstance.de/api/v4/projects/1234/jobs/artifacts/master/download?job=backend"'
    - tar -xf artifacts.zip
    - publish.bat

But before the script even starts getting executed, the following error message gets displayed:

ERROR: Job failed (system failure): Error response from daemon: container abc123 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified.

It also prints out a ton of extra info, the most useful of which is probably this:

"CommandLine":"powershell -NoProfile -NoLogo -InputFormat text -OutputFormat text -NonInteractive -ExecutionPolicy Bypass -Command -"

What I'm getting from this is that the Runner tries to start a Powershell inside the container but fails. This is no surprise, as in the .Net Core 3.1-Image, Powershell has to be startet with the command pwsh. I looked at the yaml-reference for the gitlab-ci.yml file, but couldn't find a way to change the shell which the script gets executed with. What's even more confusing: When I replicate the script in a Dockerfile and build it manually on Runner, it works perfectly, as it is using CMD instead of Powershell to run the instructions.

I really don't know from which angle to take this. I'm not trying to start a Powershell from my script, I'm not using Powershell-exclusive commands and I can't tell the Runner to not use Powershell.

Note: I'm not quite sure if this question would belong to Server Fault or Super User, as I'm using free software in a professional environment. But it seems as the relevant tags have more questions and watchers on this site, so I'm trying my luck here.

0

You must log in to answer this question.

Browse other questions tagged .