Skip to content

windows gitlab-runner 15.7.2 broke the powershell runner due to missing echo cmdlet

Summary

Upgrading from windows gitlab-runner 15.7.1 to 15.7.2 broke the powershell shell runner due to missing echo cmdlet.

Please note that the pwsh shell runner works fine. It only broke the powershell shell runner.

Steps to reproduce

  1. Add a pipeline that targets a windows powershell shell runner.

Actual behavior

It fails early, even before trying to git clone the repository.

Expected behavior

Expected it to run powershell pipelines without any problem.

Relevant logs and/or screenshots

Preparing environment 00:02
echo : The term 'echo' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path 
is correct and try again.
At line:1 char:1
+ echo "Running on $([Environment]::MachineName)..."
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (echo:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
ERROR: Job failed: prepare environment: exit status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

Environment description

I'm using a local/custom installation.

config.toml contents
concurrent = 3
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "PowerShell / Visual Studio 2022 / Windows ltsc2022"
  url = "https://gitlab.example.com"
  id = 3
  token = "TPaAa2YnN-17EjnxFaFK"
  token_obtained_at = 2023-01-14T15:05:51Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "shell"
  shell = "powershell"
  [runners.custom_build_dir]
  [runners.cache]
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

[[runners]]
  name = "pwsh / Visual Studio 2022 / Windows ltsc2022"
  url = "https://gitlab.example.com"
  id = 4
  token = "vy8-dwghE5YkQfg3X_RS"
  token_obtained_at = 2023-01-14T15:05:51Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "shell"
  shell = "pwsh"
  [runners.custom_build_dir]
  [runners.cache]
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

Used GitLab Runner version

Version:      15.7.2
Git revision: 0e7679e6
Git branch:   15-7-stable
GO version:   go1.18.9
Built:        2023-01-13T23:55:03+0000
OS/Arch:      windows/amd64

Possible fixes