I'm using robocopy to copy files during a build step in a Gitlab pipeline. The pipeline tasks are executed in powershell.
The exit status of robocopy results in a failure of my build step. I noticed all statuscodes under 8 are valid. Meaning I should reset the $lastexitcode to $null if the $lastexitcode is < 8
This is what I tried in my powershell script:
robocopy src dest /mir (&{if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }})
The problem here is that the (&{ if... part is executed before robocopy.