name = "docker-windows executor"
url = "https://techdirectarchive.com"
token = "xxxxxxxxxxxxxx"
executor = "docker-windows"
shell = "pwsh" -------------------------------------> This was the reason for the error
[runners.custom_build_dir]
To resolve this issue, ensure the
config.toml
file is edited with notepad++ which is one of my preferred editors. To do this, ensure notepad++ is installed on your device and then right-click on the
config.toml
file and select Notepad++. It should look like this below if you are running the docker-window executor without having to specify the
shell = "pwsh"
.
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "docker-windows executor"
url = "https://techdirectarchive.com"
token = "xxxxxxxxxxxxxx"
executor = "docker-windows"
[runners.custom_build_dir]
Now that you have modified the
config.toml
file, you will have to restart the GitLab-runner service and the Docker-Desktop service and proceed to run the job again. If everything is fine, the job will run and status showing the job has succeeded.
Running with gitlab-runner 14.7.0 (xxxx)
on Windows runner with docker-windows executor XXXXXXXX
Preparing the "docker-windows" executor
00:01
Using Docker executor with image mcr.microsoft.com/windows:xxxx ...
Pulling docker image mcr.microsoft.com/windows:xxxx ...
Using docker image xxxxxx for mcr.microsoft.com/windows:xxxx with digest mcr.microsoft.com/windows@xxxxxxx ...
Preparing environment
00:04
Running on RUNNER-XXXXXXXXX via
device-Niemand...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in ----
$ dir
Directory: C:-------------
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2/6/20XX 1:57 PM 182 .gitlab-ci.yml
$ echo %PATH%
%PATH%
Cleaning up project directory and file based variables
00:04
Job succeeded
Note: Since
pwsh
entry for the
shell
attribute in GitLab-runner
config.toml
does not work in Windows 10 devices correctly, instead of taking the
shell = "pwsh"
off, you can simply replace the “
pwsh
” with “
PowerShell
” and this would work as well. Therefore edit the
confg.toml
as discussed below.
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "docker-windows executor"
url = "https://techdirectarchive.com"
token = "xxxxxxxxxxxxxx"
executor = "docker-windows"
shell = "powershell" -------------------------------------> This will also have the issue resolved
[runners.custom_build_dir]
And then restarting
GitLab-runner
and the
Docker-Desktop
services will have this issue fixed. Kindly refer to these similar errors:
Install Git on Windows: The term “git” was not used as the name of a cmdlet, function, script file, or executable Program recognized
, how to resolve “
Failed to remove network for build: Error during connect in the default daemon configuration on Windows, the Docker client must be run with elevated privileges
“, and how to resolve
“failed to remove network for the build, Job failed error: Invalid volume specification: “/cache”
.
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.
Thank you for reading this post. Kindly share it with others.
Related
Published by
Christian
My name is Christian and I am the Founder and Editor of TechDirectArchive. My blog posts cover instruction guides, how-to-guides, troubleshooting tips, and tricks on Windows, Linux, Mac, Databases, hardware, Cloud, Network Devices, and Information security.
View all posts by Christian
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
Disagree
Agree