-
Notifications
You must be signed in to change notification settings - Fork 100
Support branching for cirrus status #688
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this will only apply the flutter-gold status to pre-submit checks that will be landing on master?
When Gold is able to support branching in the future (still TBD), I think we will want the flutter-gold check to work on these branched pre-submit checks. Right now individual pre-submit tests with golden files will not fail since they rely on this flutter-gold check.
Can you add a TODO here to explain that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It will check only master branch based on the above logic.
I see your comment: flutter/flutter#51807 (comment)
Do you mind create corresponding issue, and then I will add a TODO pointing to that issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flutter/flutter#52700 :) Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use a branch passed as a parameter instead of fixing it to master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this logic can be abstracted to a utility function that can be used everywhere(I've seen this logic replicated in several places).
Ideally something like:
List branches = await getSupportedBranches();
for (Branch branch in branches) { ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrite this part as suggested. Now multiple APIs call this shared logic defined in utils.dart. Additionally merged the /request_handler/utils.dart with /foundation/utils.dart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a constant for this limit? it can make it easier to change in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we have too much logic in a single method, can we split the functionality into multiple methods? This will also simplify tests for specific functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added two sub functions: _getStatuses and _getNewTaskStatus to simply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the retries wrapper? everything related with datastore has a high failure rate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. I filed an issue to track retry implementation for all cocoon backend days ago: flutter/flutter#52427.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also tests that used a branch different than master? My assumption is that master is hardcoded everywhere and we may miss some places that need changes if we use master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason we fix master here is that check for waiting pull requests applied to master only. As suggested, I have added one more test to consider the case with a different branch name, for which we will ignore cirrus statues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding a test for a matching branch different than master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
b728edb to
4626cbe
Compare
|
|
||
| final HttpClient client = branchHttpClientProvider(); | ||
| try { | ||
| for (int attempt = 0; attempt < 3; attempt++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify this function removing the for loop and the try..catch by using "retry" with retryIf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a TODO as mentioned in the above issue: flutter/flutter#52427. Since this PR is big already, do you think it would be good to finish this in a separate PR later? I am a little bit concerned about that too many changes in a single shot may make it easy to break and difficult to triage/debug if any issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the TODO here to ensure we don't forget about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added, and pointed to the above issue.
| log.warning( | ||
| 'Attempt to download branch_regexps.txt failed (HTTP $status)'); | ||
| } | ||
| } catch (error, stackTrace) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is possible to use specific errors rather than catching all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
| client.close(force: true); | ||
| } | ||
| log.error('GitHub not responding; giving up'); | ||
| return <String>['master']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can potentially hide errors, I'd suggest throwing an error rather than logging and then defaulting to master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto.
| return Body.empty; | ||
| } | ||
|
|
||
| String _getNewTaskStatus(List<String> statuses, FullTask task) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some docs will be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
| return newTaskStatus; | ||
| } | ||
|
|
||
| List<String> _getStatuses( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some docs will be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
godofredoc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after adding TODO to simplify loadBranchRegExps
Thank you for all the detailed comments! |
This is part of flutter/flutter#51807
Instead of assuming only one branch exists for each commit in cirrus, we here consider all branches. When updating cirrus status in cocoon, we consider the branch property as well.