Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows CI does not respect failing exit code #617

Closed
kachick opened this issue May 30, 2024 · 10 comments · Fixed by #806
Closed

Windows CI does not respect failing exit code #617

kachick opened this issue May 30, 2024 · 10 comments · Fixed by #806
Labels
bug Something isn't working

Comments

@kachick
Copy link
Owner

kachick commented May 30, 2024

actions/runner#351

I didn't notice some errors caused on this problem

https://github.com/kachick/dotfiles/actions/runs/9265658345/job/25488151731

C:\Users\runneradmin\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
2024/05/28 08:03:1[7](https://github.com/kachick/dotfiles/actions/runs/9265658345/job/25488151731#step:14:8) config/starship/starship.toml => C:\Users\runneradmin\.config\starship.toml
2024/05/2[8](https://github.com/kachick/dotfiles/actions/runs/9265658345/job/25488151731#step:14:9) 08:03:17 config/wezterm/wezterm.lua => C:\Users\runneradmin\.config\wezterm\wezterm.lua
2024/05/28 08:03:17 Failed to copy file: {FS:{files:0x10f5780} EmbedTree:[config wezterm wezterm.lua] DstTree:[C:\Users\runneradmin .config wezterm wezterm.lua]} open C:\Users\runneradmin\.config\wezterm\wezterm.lua: The system cannot find the path specified.

This error continue the workflow

@kachick kachick added the bug Something isn't working label May 30, 2024
kachick added a commit that referenced this issue May 30, 2024
@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

Microsoft does much simple way 🙄

https://github.com/microsoft/hcsshim/blob/c6e7159431112fe8949824eef4e7e884fe648266/.github/workflows/ci.yml#L322

          if ($LASTEXITCODE -ne 0) {
            Write-Output "::error title=Go Generate::Error running go generate."
            exit $LASTEXITCODE
          }

in all place

It is described in https://stackoverflow.com/a/69616921

@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

Hmm... simply adding does not fix. actions/runner-images#6668

@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

Ah... it requires for each command, not for all run... 🙄

@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

In summary, how to realize set -o errexit in pwsh? 🤔

https://stackoverflow.com/a/57949447

@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.4#psnativecommanderroractionpreference

PSNativeCommandErrorActionPreference

This feature became mainstream in PowerShell 7.4.

@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

Suggestion for that actions/runner-images#8900

@kachick
Copy link
Owner Author

kachick commented Sep 29, 2024

💭 I had a typo, because of confusion against similar names.

  • PSNativeCommandErrorActionPreference is the feature name.
  • $PSNativeCommandUseErrorActionPreference is the variable.
  • $PSNativeCommandErrorActionPreference is my typo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant