From 67b7aa22c276f79ef351cfc38cd5178341d1acda Mon Sep 17 00:00:00 2001 From: Christopher Fujino Date: Fri, 30 Jun 2023 16:28:00 -0700 Subject: [PATCH] Change pub roller bot to push to flutter-pub-roller-bot/flutter.git (#129844) Fixes https://github.com/flutter/flutter/issues/129744 Part of https://github.com/flutter/flutter/issues/129847 Migrate the packages_autoroller script to push to flutter-pub-roller-bot/flutter.git, rather than fluttergithubbot/flutter.git. --- .ci.yaml | 2 -- dev/conductor/core/bin/packages_autoroller.dart | 12 ++++++------ .../core/lib/src/packages_autoroller.dart | 4 ++-- .../core/test/packages_autoroller_test.dart | 16 ++++++++-------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index cd162a085c..385dbf30e4 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -243,8 +243,6 @@ targets: - name: Linux packages_autoroller presubmit: false - # TODO(fujino): https://github.com/flutter/flutter/issues/129744 - bringup: true recipe: pub_autoroller/pub_autoroller timeout: 30 enabled_branches: diff --git a/dev/conductor/core/bin/packages_autoroller.dart b/dev/conductor/core/bin/packages_autoroller.dart index db9635e73a..6cb35b2cf8 100644 --- a/dev/conductor/core/bin/packages_autoroller.dart +++ b/dev/conductor/core/bin/packages_autoroller.dart @@ -15,8 +15,8 @@ import 'package:process/process.dart'; const String kTokenOption = 'token'; const String kGithubClient = 'github-client'; -const String kMirrorRemote = 'mirror-remote'; const String kUpstreamRemote = 'upstream-remote'; +const String kGithubAccountName = 'flutter-pub-roller-bot'; Future main(List args) { return run(args); @@ -39,11 +39,10 @@ Future run( help: 'Path to GitHub CLI client. If not provided, it is assumed `gh` is ' 'present on the PATH.', ); + // TODO(fujino): delete after recipe has been migrated to stop passing this parser.addOption( - kMirrorRemote, - help: 'The mirror git remote that the feature branch will be pushed to. ' - 'Required', - mandatory: true, + 'mirror-remote', + help: '(Deprecated) this is now a no-op. To change the account, edit this tool.', ); parser.addOption( kUpstreamRemote, @@ -64,7 +63,7 @@ ${parser.usage} rethrow; } - final String mirrorUrl = results[kMirrorRemote]! as String; + const String mirrorUrl = 'https://github.com/flutter-pub-roller-bot/flutter.git'; final String upstreamUrl = results[kUpstreamRemote]! as String; final String tokenPath = results[kTokenOption]! as String; final File tokenFile = fs.file(tokenPath); @@ -92,6 +91,7 @@ ${parser.usage} orgName: _parseOrgName(mirrorUrl), token: token, processManager: processManager, + githubUsername: kGithubAccountName, ).roll(); } diff --git a/dev/conductor/core/lib/src/packages_autoroller.dart b/dev/conductor/core/lib/src/packages_autoroller.dart index 2ab002d51a..b39a15936b 100644 --- a/dev/conductor/core/lib/src/packages_autoroller.dart +++ b/dev/conductor/core/lib/src/packages_autoroller.dart @@ -20,7 +20,7 @@ class PackageAutoroller { required this.framework, required this.orgName, required this.processManager, - this.githubUsername = 'fluttergithubbot', + required this.githubUsername, Stdio? stdio, }) { this.stdio = stdio ?? VerboseStdio.local(); @@ -111,7 +111,7 @@ This PR was generated by the automated Future updatePackages({ bool verbose = true, }) async { - final String author = '$githubUsername <$githubUsername@gmail.com>'; + final String author = '$githubUsername <$githubUsername@google.com>'; await framework.newBranch(await featureBranchName); final io.Process flutterProcess = await framework.streamFlutter([ diff --git a/dev/conductor/core/test/packages_autoroller_test.dart b/dev/conductor/core/test/packages_autoroller_test.dart index 0b1d54d4fe..50e21a1aee 100644 --- a/dev/conductor/core/test/packages_autoroller_test.dart +++ b/dev/conductor/core/test/packages_autoroller_test.dart @@ -63,6 +63,7 @@ void main() { orgName: orgName, processManager: processManager, stdio: stdio, + githubUsername: 'flutter-pub-roller-bot', ); }); @@ -199,7 +200,7 @@ void main() { 'pr', 'list', '--author', - 'fluttergithubbot', + 'flutter-pub-roller-bot', '--repo', 'flutter/flutter', '--state', @@ -216,7 +217,7 @@ void main() { await controller.stream.drain(); await rollFuture; expect(processManager, hasNoRemainingExpectations); - expect(stdio.stdout, contains('fluttergithubbot already has open tool PRs')); + expect(stdio.stdout, contains('flutter-pub-roller-bot already has open tool PRs')); expect(stdio.stdout, contains(r'[{number: 123}]')); }); @@ -239,7 +240,7 @@ void main() { 'pr', 'list', '--author', - 'fluttergithubbot', + 'flutter-pub-roller-bot', '--repo', 'flutter/flutter', '--state', @@ -335,7 +336,7 @@ void main() { 'pr', 'list', '--author', - 'fluttergithubbot', + 'flutter-pub-roller-bot', '--repo', 'flutter/flutter', '--state', @@ -427,7 +428,7 @@ void main() { 'commit', '--message', 'roll packages', - '--author="fluttergithubbot "', + '--author="flutter-pub-roller-bot "', ]), const FakeCommand(command: [ 'git', @@ -475,12 +476,11 @@ void main() { group('command argument validations', () { const String tokenPath = '/path/to/token'; - const String mirrorRemote = 'https://githost.com/org/project'; test('validates that file exists at --token option', () async { await expectLater( () => run( - ['--token', tokenPath, '--mirror-remote', mirrorRemote], + ['--token', tokenPath], fs: fileSystem, processManager: processManager, ), @@ -499,7 +499,7 @@ void main() { ..writeAsStringSync(''); await expectLater( () => run( - ['--token', tokenPath, '--mirror-remote', mirrorRemote], + ['--token', tokenPath], fs: fileSystem, processManager: processManager, ),