Skip to content

Job log hides all lines containing a carriage return when using the pwsh shell

Summary

Any line containing a carriage return, 0x0d, character is hidden in the job log when using the pwsh shell.

Steps to reproduce

.gitlab-ci.yml
stages:
  - reproduce

reproducer:
  stage: reproduce
  script:
    - |
      python -c 'print("Hello")'
      python -c 'print("Cruel\x0d")'
      python -c 'print("World")'

Actual behavior

The job log shows the following.

Hello
World

Note that the missing line can be found in the raw log.

Expected behavior

The job log should show the following.

Hello
Cruel
World

Relevant logs and/or screenshots

job log
Running with gitlab-runner 17.3.1 (66269445)
  on Windows Server EzxnumVt, system ID: s_da40948d32f0
  feature flags: FF_USE_POWERSHELL_PATH_RESOLVER:true
Resolving secrets
Preparing the "docker-windows" executor 00:00
Preparing environment 00:08
Getting source from Git repository 00:13
Executing "step_script" stage of the job script 00:13
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.11.3
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
$ python -c 'print("Hello")' # collapsed multi-line command
Hello
World
Cleaning up project directory and file based variables 00:07
Job succeeded

Environment description

docker info output
Client:
 Version:    24.0.5
 Context:    default
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 57
 Server Version: 24.0.5
 Storage Driver: windowsfilter
  Windows:
 Logging Driver: json-file
 Plugins:
  Volume: local
  Network: ics internal l2bridge l2tunnel nat null overlay private transparent
  Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
 Swarm: inactive
 Default Isolation: process
 Kernel Version: 10.0 20348 (20348.1.amd64fre.fe_release.210507-1500)
 Operating System: Microsoft Windows Server Version 21H2 (OS Build 20348.2655)
 OSType: windows
 Architecture: x86_64
 CPUs: 64
 Total Memory: 127.6GiB
 Name: EXAMPLE
 ID: <REDACTED>
 Docker Root Dir: D:\docker-data
 Debug Mode: false
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
config.toml contents
concurrent = 5
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "Windows Server"
  request_concurrency = 4
  url = "http://gitlab.example.com/"
  id = 0
  token = "<REDACTED>"
  token_obtained_at = 0001-01-01T00:00:00Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker-windows"
  shell = "pwsh"
  environment = ["FF_USE_POWERSHELL_PATH_RESOLVER=1"]
  [runners.cache]
    MaxUploadedArchiveSize = 0
  [runners.docker]
    pull_policy = ["always", "if-not-present"]
    tls_verify = false
    image = "<REDACTED>"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["c:\\cache", "d:\\ccache:c:\\ccache"]
    shm_size = 0
    memory = "64g"

Used GitLab Runner version

Version:      17.3.1
Git revision: 66269445
Git branch:   17-3-stable
GO version:   go1.22.5
Built:        2024-08-21T15:24:27+0000
OS/Arch:      windows/amd64

Possible fixes