Skip to content

Conversation

@keyonghan
Copy link
Contributor

This PR supports Flutter to be a branch based build, test and release process.

Right now, master, beta, and stable are supported.

Copy link
Contributor

Choose a reason for hiding this comment

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

We're going to be using a release branch scheme, where each dev (x.y.z) release gets its own branch, and testing is done on those branches. Then dev, beta, and stable will just point to hashes that have already been tested as part of the release branch.

So rather than enumerating the branches here, you'll want to query GitHub for the list of branches, then filter that list to include only branches that match a specified list of patterns (e.g. ['master', r'v[0-9]+.[0-9]+.[0-9]+']).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see there are existing branches: vx.x.x-hotfixes in flutter repo. Shall we exclude those, namely only strictly matching vx.x.x pattern?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can exclude them. We'll want a way to update the pattern of the branches we match though, since the proposal for those branch names is still in flux. Maybe a config file that we query so we can update the pattern without needing to update Cocoon?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a top level folder called release to both flutter/flutter and flutter/engine with a file called branch_regs.txt with one regex per line?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put it somewhere in the dev/ folder hierarchy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added.

final List<Commit> newCommits = <Commit>[];
final List<Map<String, Object>> tableDataInsertAllRequestRows =
<Map<String, Object>>[];
final RegExp exp = RegExp(r'v[0-9]+.[0-9]+.[0-9]+');
Copy link
Contributor

@tvolkert tvolkert Mar 2, 2020

Choose a reason for hiding this comment

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

No need to explicitly exclude the existing hotfix branches - just change the regexp to be stricter - r'^v[0-9]+\.[0-9]+\.[0-9]+$'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion.

final PaginationHelper paginationHelper = PaginationHelper(github);

final List<dynamic> commits = <dynamic>[];
await for (Response response in paginationHelper.fetchStreamed(
Copy link
Contributor

Choose a reason for hiding this comment

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

May be worth sending a PR to package:github to add the functionality to query commits on a branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will consider sending that soon.

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

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

Approach LGTM.

This should probably also contain a change to the endpoint that drives the dashboard commit status table, so as to only list commits on a specific branch (defaulting to master).

@keyonghan
Copy link
Contributor Author

Approach LGTM.

This should probably also contain a change to the endpoint that drives the dashboard commit status table, so as to only list commits on a specific branch (defaulting to master).

@tvolkert added issue to track: flutter/flutter#51807

@keyonghan keyonghan changed the title Support branching for flutter repo Backend support branching for flutter repo Mar 3, 2020
@@ -0,0 +1,2 @@
^v[0-9]+.[0-9]+.[0-9]+$
Copy link
Contributor

Choose a reason for hiding this comment

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

This file has to go into the different supported repos, e.g flutter/flutter and flutter/engine

Copy link
Contributor

Choose a reason for hiding this comment

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

That was my first reaction as well, but I couldn't think of a reason why it needs to... @godofredoc is there a reason why?

Copy link
Contributor

Choose a reason for hiding this comment

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

One possibility is to support different branches per repo(not sure this is really necessary) the other one will be give more control to the people working on the different repos on which branches will be tested.

The main reason I added this comment is to be able to load it without a new deployment but it will be ok to keep it here and loading it over http.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah living here and requesting over http sgtm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

String repository;

/// The branch of the commit.
@StringProperty(propertyName: 'Branch', required: true)
Copy link
Contributor

Choose a reason for hiding this comment

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

How does making this required play with the existing entries that don't have it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the safety purpose, removing required. Thanks.

final List<Commit> newCommits = <Commit>[];
final List<Map<String, Object>> tableDataInsertAllRequestRows =
<Map<String, Object>>[];
final File file = File('dev/branch_regexps.txt');
Copy link
Contributor

Choose a reason for hiding this comment

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

This will require a new Cocoon deployment to pick up the new file. I think we'll have to request it from GitHub over http.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Considering moving the file to flutter or engine repo, will change to http request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -0,0 +1,2 @@
^v[0-9]+.[0-9]+.[0-9]+$
Copy link
Contributor

Choose a reason for hiding this comment

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

dots should be preceded by backslashes, or the regexp is saying "any character"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right!

@keyonghan
Copy link
Contributor Author

nit: against.

@godofredoc Fixed. Thanks.

}

await Future<void>.delayed(gitHubBackoffCalculator(attempt));
return <String>['master'];
Copy link
Contributor

Choose a reason for hiding this comment

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

This belongs outside the for loop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved outside. Thank you for pointing this out.

client.close(force: true);
}

log.error('GitHub not responding; giving up');
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unreachable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

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

LGTM

@keyonghan keyonghan deleted the branch_support branch March 13, 2024 20:16
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.

3 participants