It has happened several times already where SonarCloud will say it failed, however the analysis shows no issues found and everything OK.
Normally it is fine after a 2nd or 3rd run, but it gets really annoying that it fails for seemingly no reason, as it is part of our Github actions required for merging a PR.
I could find that the analysis you reported failed with this error message:
Validation of project failed:
o Date of analysis cannot be older than the date of the last known analysis on this project. Value: "2024-01-18T14:46:18+0000". Latest analysis: "2024-01-18T14:46:18+0000". It's only possible to rebuild the past in a chronological order.
Did you know that you can see for yourself this error message in the “Background Tasks” from your project?
I could find other analyses with the same issue showing up from time to time.
This issue is common, and it is the same problem described below. Please check this thread for explanations of what happened:
You mention using GitHub actions to perform the analysis, however I see the project is configured to use Automatic Analysis. Could you please clarify which is the analysis method intended for the project, if you are actually using GitHub actions to submit analyses? Thanks!
Hi Alex! Thanks four your reply, and apologies for not replying sooner.
I wasn’t aware of this Background Tasks view, as I don’t have admin access. But can liaise with the admins in my organisation for further investigation.
Yes, this happens quite frequently for us, and we’ve noticed it tends to happen when using Graphite.dev to manage our PRs, which I think results in some simultaneous PR updates, which could explain the error message seen.
About the analysis method, yes you are right, we have it as an Automatic Analysis. I meant to say that its part of our PR merge-ability requirements (which includes some github actions for other tests/checks), but this SonarCloud analysis is not actually part of the actions itself.
So from reading the post you pointed to, it seems like the problem could be on how Graphite manage their PR updates, where the simultaneous execution of PR updates (and as a consequence the automatic analysis in SonarCloud) can trigger this date conflict and causing the error message seen, right?
Is there any way we could mitigate this from our end? Not sure if possible, but maybe apply a delay to the automatic analysis to execute after the PR hasn’t had changes in the last X minutes?
Hi @jfarre90
I agree with your analysis of the problem: simultaneous PR updates increase the chances of date conflicts. I don’t see how we could mitigate the issue from the SonarCloud side in the current state of the service. I don’t know if there is a way you can mitigate from the Graphite side. Do you know if the issue comes up when one or more PRs get merged, or is it regardless of merging?
We have seen it regardless of merging. The SonarCloud analysis gets run on each PR whenever there is a new commit pushed to it. When we have multiple chained/stacked PRs managed through Graphite, any update to the PR at the top of the stack, pushes a commit to all the other dependant PRs, which appears to be simultaneous at the moment. Probably a better approach would be to make the PR updates more sequential from Graphite’s end to avoid this kind of error states
Either way, at least we’ve managed to understand better the issue. We were just trialling this Graphite to see if it made managing the PRs easier, but it seems to have some kinks to iron out.