Skip to content

Fail AppVeyor Build if MSI does not build - #5755

Merged
Travis Plunk (TravisEz13) merged 8 commits into
PowerShell:masterfrom
bergmeister:failBuildIfMsiCannotBuild
Jan 2, 2018
Merged

Fail AppVeyor Build if MSI does not build#5755
Travis Plunk (TravisEz13) merged 8 commits into
PowerShell:masterfrom
bergmeister:failBuildIfMsiCannotBuild

Conversation

@bergmeister

@bergmeister Christoph Bergmeister (bergmeister) commented Dec 29, 2017

Copy link
Copy Markdown
Contributor

PR Summary

Before this PR, when a WiX compilation error occurs then an error is thrown, which appears in the log with details but the AppVeyor build itself is still marked as green.
This PR makes the console host also return an exit code of -1 when being run on AppVeyor so that it can then interpret it as a build failure and mark the build as red. It uses the fact that AppVeyor defines an environment variable named CI. Exiting is OK since the MSI build is the last step in CI and nothing happens after that.
The git history shows a test build that proves that this works if the installer was broken.

PR Checklist

Note: Please mark anything not applicable to this PR NA.

@iSazonov

Copy link
Copy Markdown
Collaborator

I restarted Travis CI Linux job.

@markekraus

Copy link
Copy Markdown
Contributor

Christoph Bergmeister (@bergmeister) this is where you tested it, correct? https://ci.appveyor.com/project/bergmeister/powershell/build/v6.1.0-preview.204

@markekraus Mark Kraus (markekraus) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bergmeister

Christoph Bergmeister (bergmeister) commented Dec 29, 2017

Copy link
Copy Markdown
Contributor Author

Mark Kraus (@markekraus) Yes, sorry, it seems my link was broken, it is fixed now in the PR description. If you look at the commit history, the first commit contained also a syntax error to test that AppVeyor would actually fail and the 2nd commit reverted the syntax error. Maybe not clean in terms of git history but the PR commit gets squashed anyway.
Thanks Ilya (@iSazonov) but the travis CI build is not affected anyway due to MSI being Windows only.

@bergmeister Christoph Bergmeister (bergmeister) changed the title Fail AppVeyor Build if MSI does not build WIP Fail AppVeyor Build if MSI does not build Dec 29, 2017
@bergmeister Christoph Bergmeister (bergmeister) changed the title WIP Fail AppVeyor Build if MSI does not build Fail AppVeyor Build if MSI does not build Dec 29, 2017
Comment thread build.psm1 Outdated
$WiXLightLog | Out-String | Write-Verbose -Verbose
if ($null -ne $env:CI)
{
$host.SetShouldExit(-1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having the CmdLet alter the host behavior, AppVeyor.psm1 should detect this error and fail the CI. This might become unreliable if we attempt this is multiple places.

Another option, is detect we are in AppVeyor, and Add a compilation message

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied your suggestion but the error message from Appveyor is very obscure then: https://ci.appveyor.com/project/PowerShell/powershell/build/1.0.7407

@TravisEz13
Travis Plunk (TravisEz13) merged commit 5f17196 into PowerShell:master Jan 2, 2018
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Before this PR, when a WiX compilation error occurs then an error is thrown, which appears in the log with details but the AppVeyor build itself is still marked as green.
This PR makes the console host also return an exit code of -1 when being run on AppVeyor so that it can then interpret it as a build failure and mark the build as red. It uses the fact that AppVeyor defines an environment variable named CI. Exiting is OK since the MSI build is the last step in CI and nothing happens after that.
The git history shows a test build that proves that this works if the installer was broken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants