cli icon indicating copy to clipboard operation
cli copied to clipboard

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

Open geoffharcourt opened this issue 1 year ago • 2 comments

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

  • Node version: 20
  • @percy/cli version: @percy/cli 1.28.5

Details

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

geoffharcourt avatar May 06 '24 16:05 geoffharcourt

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

ninadbstack avatar May 16 '24 07:05 ninadbstack

@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.

prklm10 avatar Jul 02 '24 10:07 prklm10