gitlab-runner returns "Job succeeded" although script failed
Summary
gitlab-runner returns "Job succeeded". However, my PowerShell script failed.
Steps to reproduce
- We remove a directory that we have not permission in PowerShell script.
- Powershell script occurs "PermissionDenied: (db:FileInfo) [Remove-Item], UnauthorizedAccessException"
- However, this job returns "Job succeeded".
.gitlab-ci.yml
variables:
WORKING_DIR: C:\xx\xxxx
stages:
- clean
clean:
stage: clean
tags:
- xxxx
script:
- Remove-Item ${WORKING_DIR} -Recurse -Force
- New-Item ${WORKING_DIR} -ItemType Directory
Actual behavior
- We remove a directory that we have not permission in PowerShell script.
- Powershell script occurs "PermissionDenied: (xx:FileInfo) [Remove-Item], UnauthorizedAccessException"
- However, this job returns "Job succeeded".
Expected behavior
If PowerShell script occurs error, gitlab-runner returns "ERROR: Job failed: exit status x"
Relevant logs and/or screenshots
job log
Running with gitlab-runner 12.1.0 (xxxxx)
on tests xxxxxx
Using Shell executor...
Running on xxxxx...
Fetching changes...
Reinitialized existing Git repository in C:/xxxx/.git/
From https://xxxxxx
xxxxx..xxxxx master -> origin/master
Checking out xxxx as master...
git-lfs/2.7.2 (GitHub; windows amd64; go 1.12.2; git xxxxx)
Skipping Git submodules setup
$ Remove-Item ${WORKING_DIR} -Recurse -Force
Remove-Item : ���� C:\xx\xxxx\xxxx\xxxx ���폜�ł��܂���: �p�X 'xx'
�ւ̃A�N�Z�X�����ۂ����܂����B
�����ꏊ C:\Windows\TEMP\build_script740801162\script.ps1:163 ����:1
+ Remove-Item ${WORKING_DIR} -Recurse -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (xx:FileInfo) [Remove-Item], U
nauthorizedAccessException
+ FullyQualifiedErrorId : RemoveFileSystemItemUnAuthorizedAccess,Microsoft
.PowerShell.Commands.RemoveItemCommand
Job succeeded
Environment description
config.toml contents
concurrent = 2
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "xxxxxx"
url = "https://xxxxxx/"
token = "xxxxx"
executor = "shell"
shell = "powershell"
[runners.custom_build_dir]
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
[runners.custom]
run_exec = ""
Used GitLab Runner version
Running with gitlab-runner 12.1.0 (xxxxx)
on tests My-PC