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

PublishChecks step: The conclusion should be none when status is not completed #82

Merged
merged 5 commits into from
Feb 18, 2021

Conversation

ThusithaDJ
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Feb 10, 2021

Codecov Report

Merging #82 (b3c4522) into master (64dc0a6) will decrease coverage by 0.49%.
The diff coverage is 50.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #82      +/-   ##
============================================
- Coverage     87.31%   86.82%   -0.50%     
- Complexity      139      140       +1     
============================================
  Files            16       16              
  Lines           623      630       +7     
  Branches         47       49       +2     
============================================
+ Hits            544      547       +3     
- Misses           63       65       +2     
- Partials         16       18       +2     
Impacted Files Coverage Δ Complexity Δ
...enkins/plugins/checks/steps/PublishChecksStep.java 87.69% <50.00%> (-1.20%) 17.00 <0.00> (+1.00) ⬇️
.../checks/status/AbstractStatusChecksProperties.java 50.00% <0.00%> (-10.00%) 1.00% <0.00%> (ø%)
...gins/checks/status/BuildStatusChecksPublisher.java 80.26% <0.00%> (-1.93%) 14.00% <0.00%> (ø%)
...s/plugins/checks/status/FlowExecutionAnalyzer.java 80.71% <0.00%> (+0.13%) 44.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64dc0a6...b3c4522. Read the comment docs.

Copy link
Contributor

@XiongKezhi XiongKezhi left a comment

Choose a reason for hiding this comment

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

Thanks for your help!

@@ -169,6 +169,10 @@ private String asDisplayName(final String name) {
PublishChecksStepExecution(final StepContext context, final PublishChecksStep step) {
super(context);
this.step = step;
if ((step.getConclusion() == ChecksConclusion.SUCCESS)
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a rule on Github checks API that if the user is providing the conclusion, then the status should be automatically set as completed. And because most of our users are GitHub users and will most likely refer to this, so it would be strange for them if the conclusion is reset to none (although it's a misuse to set the status not as completed while setting the conclusion to be a success).

So I would move this logic to the setters. If the user calls the methods and sets the status to be queued or in_progress, we just change the conclusion to be none; if the user sets the conclusion, we change the status to be completed again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok sure, @XiongKezhi. But based on your comment, what if the user sets the status as queued or in_progress and provides a conclusion? Conclusion should be whatever the value provided, and status should be completed, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

The implementation should handle that, like GitHub will automatically set the status to be completed if the conclusion is provided. We just need to make the step easier to use IMO: they don't have to explicitly set the conclusion to be none.

@ThusithaDJ
Copy link
Contributor Author

Hi @XiongKezhi, if you don't mind, could you please check and let me know your thoughts about these changes and how can I get rid of these failed statuses.

Copy link
Contributor

@XiongKezhi XiongKezhi left a comment

Choose a reason for hiding this comment

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

just some minor issues; the CPD warnings are good to resolve, but still ok in tests.

step.setDetailsURL("http://ci.jenkins.io");
void shouldPublishCheckWithStatusInProgress() throws IOException, InterruptedException {
PublishChecksStep step = getModifiedPublishChecksStepObject("an in progress build",
ChecksStatus.IN_PROGRESS,null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ChecksStatus.IN_PROGRESS,null);
ChecksStatus.IN_PROGRESS, null);

Same for the next check style warning


@BeforeEach
void setup() throws IOException, InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

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

In this project, if possible, I normally avoid using @BeforeEach and shared variables between tests. I usually just make a private method like getModifiedPublishChecksStepObject that returns what I want.

Copy link
Contributor

@XiongKezhi XiongKezhi left a comment

Choose a reason for hiding this comment

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

thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants