percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 41 forks source link

Add `percy exec` flag to avoid failure for Percy-related issues #1590

Open geoffharcourt opened 2 months ago

geoffharcourt commented 2 months ago

The problem

Sometimes if we have some infrastructure failures that result in certain kinds of retries we end up with an issue where we get one of these errors:

[percy] Error: Can only finalize pending builds, current state: finished

We tried the approach of closing our builds with percy build:finalize and it seemed like it created more problems in our builds than before.

Could there be a flag for percy exec so that if there's a Percy-related issue (like an already finalized build) that the wrapped process would continue? We don't want our whole CI pipeline to fail over an issue related to snapshots (but we'd still like the error output so that we could look into the problem).

I was envisioning something like:

percy exec --proceed-on-failure -- bundle exec rake specs

This way we'd see the errors/warnings about issues in the build, but issues with retried parallel jobs (or situations where Percy's API is out of service) would be less likely to cause the spec portion of our builds to fail.

Environment

Details

If necessary, describe the problem you have been experiencing in more detail.

ninadbstack commented 2 months ago

We will be taking this as a feature request. Thanks for raising this.

prklm10 commented 3 weeks ago

@geoffharcourt We have released CLI version v1.28.9-beta.1. You can set the environment variable PERCY_EXIT_WITH_ZERO_ON_ERROR=true. This will exit with code 0 on any Percy-related errors, and the error logs will be present.

Additionally, if the command passed in exec -- fails, it will not exit with code 0.

We will release a stable version of this soon.