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

Fail if any checks were failures #46

Merged
merged 6 commits into from
Sep 22, 2019
Merged

Conversation

MichalZalecki
Copy link
Collaborator

This one is intended to finally fix #22. I consider this a breaking change (duh!).

@MichalZalecki MichalZalecki self-assigned this Aug 29, 2019
@krzkaczor
Copy link
Member

krzkaczor commented Aug 30, 2019

Thanks for this! I just had a really quick look at this PR.

This behavior HAS to be controlled via a command-line flag. Based on my experience, on CI you never want the whole CLI to fail. Often CC can be run as a single step in a bigger job. I get that sometimes it might be useful (especially for running checks locally) to return non-zero exit code but I don't believe that it should be the default behavior. Also then it won't be a breaking change ;)

@MichalZalecki
Copy link
Collaborator Author

MichalZalecki commented Aug 30, 2019

@krzkaczor I thought about it and I'm not so sure it should be behind a feature flag. When I run my tests and a test fails I want CI to fail (and maybe not deploy if that's part of the pipeline). Why would I like it to work differently in case of codechecks? I think this would be the users' expectation and it's better to be safe than sorry (and fail the CI).

Often CC can be run as a single step in a bigger job.

Yes, and then you can manage dependencies on different steps in your CI of choice.

I'm happy to make a new flag but I would personally prefer that using it returns 0 when there're failures than return non-0 code on failure. In other words, I believe it should be the default behavior, not an opt-in.

Also, you have a complex CI? You can figure out the flag.
Do you have something simple? You probably skipped on reading docs.

Copy link
Member

@krzkaczor krzkaczor left a comment

Choose a reason for hiding this comment

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

1 comment. WDYT?

logger.log(`${bold("Checks:")} ${result}`);
logger.log(`${bold("Time:")} ${ms(deltaTime)}`);

if (sharedExecutionCtx.isWithExitStatus && failureCodechecks > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

I believe here we could access isWithExitStatus directly from args.

Copy link
Collaborator Author

@MichalZalecki MichalZalecki Sep 1, 2019

Choose a reason for hiding this comment

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

I'm hesitant to use this directly from args. I don't want to use it directly to avoid refactorings when the same information can, not only be set via process args, but also configured in codechecks.yml or using an environment variable. These are fairly plausible ways to influence the way CC can be run (in the future).

I can come up with the abstraction layer for config instead.

Copy link
Member

Choose a reason for hiding this comment

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

I can come up with the abstraction layer for config instead.

yes this seems like a way to go 👍

@krzkaczor
Copy link
Member

krzkaczor commented Sep 1, 2019

@MichalZalecki I hear you. As I said, this was how I always imagined it to work, but it's not necessarily the right view 😆

I would put it as another input for 0.2.0 release and have hopefully more people wage into this.

I feel like it's a much larger discussion - should CC be just a suggestion for a reviewers or should it really block CI pipeline.

@MichalZalecki
Copy link
Collaborator Author

@krzkaczor It's only a thin abstraction but allows runner-only options can be kept as part of RunnerConfig and not mix it with a shared context.

@krzkaczor
Copy link
Member

Thanks for this! Merging!

@krzkaczor krzkaczor merged commit 73f9a5c into master Sep 22, 2019
@krzkaczor krzkaczor deleted the feature/fail-exit-code branch September 22, 2019 22:32
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.

Fail if any check has been failures
2 participants