Unverified Commit 21d3c3f2 authored by Kevin Chisholm's avatar Kevin Chisholm Committed by GitHub

replace engine and framework mirror args with github username arg (#109239)

parent f04a5464
...@@ -39,8 +39,7 @@ Releases are initialized with the `start` sub-command, like: ...@@ -39,8 +39,7 @@ Releases are initialized with the `start` sub-command, like:
conductor start \ conductor start \
--candidate-branch=flutter-2.2-candidate.10 \ --candidate-branch=flutter-2.2-candidate.10 \
--release-channel=beta \ --release-channel=beta \
--framework-mirror=git@github.com:username/flutter.git \ --github-username=kingOfDevelopers \
--engine-mirror=git@github.com:username/engine.git \
--engine-cherrypicks=72114dafe28c8700f1d5d629c6ae9d34172ba395 \ --engine-cherrypicks=72114dafe28c8700f1d5d629c6ae9d34172ba395 \
--framework-cherrypicks=a3e66b396746f6581b2b7efd1b0d0f0074215128,d8d853436206e86f416236b930e97779b143a100 \ --framework-cherrypicks=a3e66b396746f6581b2b7efd1b0d0f0074215128,d8d853436206e86f416236b930e97779b143a100 \
--dart-revision=4511eb2a779a612d9d6b2012123575013e0aef12 \ --dart-revision=4511eb2a779a612d9d6b2012123575013e0aef12 \
......
...@@ -31,6 +31,7 @@ const String kEngineMirrorOption = 'engine-mirror'; ...@@ -31,6 +31,7 @@ const String kEngineMirrorOption = 'engine-mirror';
const String kReleaseOption = 'release-channel'; const String kReleaseOption = 'release-channel';
const String kStateOption = 'state-file'; const String kStateOption = 'state-file';
const String kVersionOverrideOption = 'version-override'; const String kVersionOverrideOption = 'version-override';
const String kGithubUsernameOption = 'github-username';
/// Command to print the status of the current Flutter release. /// Command to print the status of the current Flutter release.
class StartCommand extends Command<void> { class StartCommand extends Command<void> {
...@@ -54,7 +55,8 @@ class StartCommand extends Command<void> { ...@@ -54,7 +55,8 @@ class StartCommand extends Command<void> {
argParser.addOption( argParser.addOption(
kFrameworkUpstreamOption, kFrameworkUpstreamOption,
defaultsTo: FrameworkRepository.defaultUpstream, defaultsTo: FrameworkRepository.defaultUpstream,
help: 'Configurable Framework repo upstream remote. Primarily for testing.', help:
'Configurable Framework repo upstream remote. Primarily for testing.',
hide: true, hide: true,
); );
argParser.addOption( argParser.addOption(
...@@ -63,14 +65,6 @@ class StartCommand extends Command<void> { ...@@ -63,14 +65,6 @@ class StartCommand extends Command<void> {
help: 'Configurable Engine repo upstream remote. Primarily for testing.', help: 'Configurable Engine repo upstream remote. Primarily for testing.',
hide: true, hide: true,
); );
argParser.addOption(
kFrameworkMirrorOption,
help: 'Framework repo mirror remote.',
);
argParser.addOption(
kEngineMirrorOption,
help: 'Engine repo mirror remote.',
);
argParser.addOption( argParser.addOption(
kStateOption, kStateOption,
defaultsTo: defaultPath, defaultsTo: defaultPath,
...@@ -100,6 +94,10 @@ class StartCommand extends Command<void> { ...@@ -100,6 +94,10 @@ class StartCommand extends Command<void> {
help: 'Explicitly set the desired version. This should only be used if ' help: 'Explicitly set the desired version. This should only be used if '
'the version computed by the tool is not correct.', 'the version computed by the tool is not correct.',
); );
argParser.addOption(
kGithubUsernameOption,
help: 'Github username',
);
} }
final Checkouts checkouts; final Checkouts checkouts;
...@@ -130,21 +128,19 @@ class StartCommand extends Command<void> { ...@@ -130,21 +128,19 @@ class StartCommand extends Command<void> {
argumentResults, argumentResults,
platform.environment, platform.environment,
)!; )!;
final String frameworkMirror = getValueFromEnvOrArgs( final String githubUsername = getValueFromEnvOrArgs(
kFrameworkMirrorOption, kGithubUsernameOption,
argumentResults, argumentResults,
platform.environment, platform.environment,
)!; )!;
final String frameworkMirror =
'https://github.com/$githubUsername/flutter.git';
final String engineUpstream = getValueFromEnvOrArgs( final String engineUpstream = getValueFromEnvOrArgs(
kEngineUpstreamOption, kEngineUpstreamOption,
argumentResults, argumentResults,
platform.environment, platform.environment,
)!; )!;
final String engineMirror = getValueFromEnvOrArgs( final String engineMirror = 'https://github.com/$githubUsername/engine.git';
kEngineMirrorOption,
argumentResults,
platform.environment,
)!;
final String candidateBranch = getValueFromEnvOrArgs( final String candidateBranch = getValueFromEnvOrArgs(
kCandidateOption, kCandidateOption,
argumentResults, argumentResults,
...@@ -177,7 +173,8 @@ class StartCommand extends Command<void> { ...@@ -177,7 +173,8 @@ class StartCommand extends Command<void> {
platform.environment, platform.environment,
); );
final File stateFile = checkouts.fileSystem.file( final File stateFile = checkouts.fileSystem.file(
getValueFromEnvOrArgs(kStateOption, argumentResults, platform.environment), getValueFromEnvOrArgs(
kStateOption, argumentResults, platform.environment),
); );
final String? versionOverrideString = getValueFromEnvOrArgs( final String? versionOverrideString = getValueFromEnvOrArgs(
kVersionOverrideOption, kVersionOverrideOption,
...@@ -206,6 +203,7 @@ class StartCommand extends Command<void> { ...@@ -206,6 +203,7 @@ class StartCommand extends Command<void> {
stateFile: stateFile, stateFile: stateFile,
force: force, force: force,
versionOverride: versionOverride, versionOverride: versionOverride,
githubUsername: githubUsername,
); );
return context.run(); return context.run();
} }
...@@ -227,6 +225,7 @@ class StartContext extends Context { ...@@ -227,6 +225,7 @@ class StartContext extends Context {
required this.conductorVersion, required this.conductorVersion,
required this.processManager, required this.processManager,
required this.releaseChannel, required this.releaseChannel,
required this.githubUsername,
required super.checkouts, required super.checkouts,
required super.stateFile, required super.stateFile,
this.force = false, this.force = false,
...@@ -243,7 +242,8 @@ class StartContext extends Context { ...@@ -243,7 +242,8 @@ class StartContext extends Context {
name: RemoteName.mirror, name: RemoteName.mirror,
url: engineMirror, url: engineMirror,
), ),
), framework = FrameworkRepository( ),
framework = FrameworkRepository(
checkouts, checkouts,
initialRef: 'upstream/$candidateBranch', initialRef: 'upstream/$candidateBranch',
upstreamRemote: Remote( upstreamRemote: Remote(
...@@ -269,6 +269,7 @@ class StartContext extends Context { ...@@ -269,6 +269,7 @@ class StartContext extends Context {
final ProcessManager processManager; final ProcessManager processManager;
final String releaseChannel; final String releaseChannel;
final Version? versionOverride; final Version? versionOverride;
final String githubUsername;
/// If validations should be overridden. /// If validations should be overridden.
final bool force; final bool force;
...@@ -298,7 +299,8 @@ class StartContext extends Context { ...@@ -298,7 +299,8 @@ class StartContext extends Context {
Future<void> run() async { Future<void> run() async {
if (stateFile.existsSync()) { if (stateFile.existsSync()) {
throw ConductorException('Error! A persistent state file already found at ${stateFile.path}.\n\n' throw ConductorException(
'Error! A persistent state file already found at ${stateFile.path}.\n\n'
'Run `conductor clean` to cancel a previous release.'); 'Run `conductor clean` to cancel a previous release.');
} }
if (!releaseCandidateBranchRegex.hasMatch(candidateBranch)) { if (!releaseCandidateBranchRegex.hasMatch(candidateBranch)) {
...@@ -329,10 +331,12 @@ class StartContext extends Context { ...@@ -329,10 +331,12 @@ class StartContext extends Context {
cherrypicks: engineCherrypickRevisions, cherrypicks: engineCherrypickRevisions,
upstreamRef: EngineRepository.defaultBranch, upstreamRef: EngineRepository.defaultBranch,
releaseRef: candidateBranch, releaseRef: candidateBranch,
)).map((String revision) => pb.Cherrypick( ))
.map((String revision) => pb.Cherrypick(
trunkRevision: revision, trunkRevision: revision,
state: pb.CherrypickState.PENDING, state: pb.CherrypickState.PENDING,
)).toList(); ))
.toList();
for (final pb.Cherrypick cherrypick in engineCherrypicks) { for (final pb.Cherrypick cherrypick in engineCherrypicks) {
final String revision = cherrypick.trunkRevision; final String revision = cherrypick.trunkRevision;
...@@ -366,10 +370,12 @@ class StartContext extends Context { ...@@ -366,10 +370,12 @@ class StartContext extends Context {
cherrypicks: frameworkCherrypickRevisions, cherrypicks: frameworkCherrypickRevisions,
upstreamRef: FrameworkRepository.defaultBranch, upstreamRef: FrameworkRepository.defaultBranch,
releaseRef: candidateBranch, releaseRef: candidateBranch,
)).map((String revision) => pb.Cherrypick( ))
.map((String revision) => pb.Cherrypick(
trunkRevision: revision, trunkRevision: revision,
state: pb.CherrypickState.PENDING, state: pb.CherrypickState.PENDING,
)).toList(); ))
.toList();
for (final pb.Cherrypick cherrypick in frameworkCherrypicks) { for (final pb.Cherrypick cherrypick in frameworkCherrypicks) {
final String revision = cherrypick.trunkRevision; final String revision = cherrypick.trunkRevision;
...@@ -399,7 +405,8 @@ class StartContext extends Context { ...@@ -399,7 +405,8 @@ class StartContext extends Context {
); );
final bool atBranchPoint = branchPoint == frameworkHead; final bool atBranchPoint = branchPoint == frameworkHead;
final ReleaseType releaseType = computeReleaseType(lastVersion, atBranchPoint); final ReleaseType releaseType =
computeReleaseType(lastVersion, atBranchPoint);
state.releaseType = releaseType; state.releaseType = releaseType;
try { try {
...@@ -501,7 +508,8 @@ class StartContext extends Context { ...@@ -501,7 +508,8 @@ class StartContext extends Context {
throw ConductorException('Aborting command.'); throw ConductorException('Aborting command.');
} }
stdio.printStatus('Applying the tag $requestedVersion at the branch point $branchPoint'); stdio.printStatus(
'Applying the tag $requestedVersion at the branch point $branchPoint');
await framework.tag( await framework.tag(
branchPoint, branchPoint,
...@@ -549,10 +557,13 @@ class StartContext extends Context { ...@@ -549,10 +557,13 @@ class StartContext extends Context {
final List<String> upstreamRevlist = (await repository.revList(<String>[ final List<String> upstreamRevlist = (await repository.revList(<String>[
'--ancestry-path', '--ancestry-path',
'$branchPoint..$upstreamRef', '$branchPoint..$upstreamRef',
])).reversed.toList(); ]))
.reversed
.toList();
stdio.printStatus('upstreamRevList:\n${upstreamRevlist.join('\n')}\n'); stdio.printStatus('upstreamRevList:\n${upstreamRevlist.join('\n')}\n');
stdio.printStatus('validatedCherrypicks:\n${validatedCherrypicks.join('\n')}\n'); stdio.printStatus(
'validatedCherrypicks:\n${validatedCherrypicks.join('\n')}\n');
for (final String upstreamRevision in upstreamRevlist) { for (final String upstreamRevision in upstreamRevlist) {
if (validatedCherrypicks.contains(upstreamRevision)) { if (validatedCherrypicks.contains(upstreamRevision)) {
validatedCherrypicks.remove(upstreamRevision); validatedCherrypicks.remove(upstreamRevision);
...@@ -569,7 +580,10 @@ class StartContext extends Context { ...@@ -569,7 +580,10 @@ class StartContext extends Context {
'The following ${repository.name} cherrypicks were not found in the ' 'The following ${repository.name} cherrypicks were not found in the '
'upstream $upstreamRef branch:', 'upstream $upstreamRef branch:',
); );
for (final String cp in <String>[...validatedCherrypicks, ...unknownCherrypicks]) { for (final String cp in <String>[
...validatedCherrypicks,
...unknownCherrypicks
]) {
stdio.printError('\t$cp'); stdio.printError('\t$cp');
} }
throw ConductorException( throw ConductorException(
......
...@@ -18,11 +18,14 @@ import './common.dart'; ...@@ -18,11 +18,14 @@ import './common.dart';
void main() { void main() {
group('start command', () { group('start command', () {
const String branchPointRevision = '5131a6e5e0c50b8b7b2906cd58dab8746d6450be'; const String branchPointRevision =
'5131a6e5e0c50b8b7b2906cd58dab8746d6450be';
const String flutterRoot = '/flutter'; const String flutterRoot = '/flutter';
const String checkoutsParentDirectory = '$flutterRoot/dev/tools/'; const String checkoutsParentDirectory = '$flutterRoot/dev/tools/';
const String frameworkMirror = 'https://github.com/user/flutter.git'; const String githubUsername = 'user';
const String engineMirror = 'https://github.com/user/engine.git'; const String frameworkMirror =
'https://github.com/$githubUsername/flutter.git';
const String engineMirror = 'https://github.com/$githubUsername/engine.git';
const String candidateBranch = 'flutter-1.2-candidate.3'; const String candidateBranch = 'flutter-1.2-candidate.3';
const String releaseChannel = 'beta'; const String releaseChannel = 'beta';
const String revision = 'abcd1234'; const String revision = 'abcd1234';
...@@ -86,10 +89,6 @@ void main() { ...@@ -86,10 +89,6 @@ void main() {
await expectLater( await expectLater(
() async => runner.run(<String>[ () async => runner.run(<String>[
'start', 'start',
'--$kFrameworkMirrorOption',
frameworkMirror,
'--$kEngineMirrorOption',
engineMirror,
'--$kCandidateOption', '--$kCandidateOption',
candidateBranch, candidateBranch,
'--$kReleaseOption', '--$kReleaseOption',
...@@ -103,24 +102,6 @@ void main() { ...@@ -103,24 +102,6 @@ void main() {
); );
}); });
test('throws if --$kFrameworkMirrorOption not provided', () async {
final CommandRunner<void> runner = createRunner(
commands: <FakeCommand>[
const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'],
stdout: revision,
),
],
);
await expectLater(
() async => runner.run(<String>['start']),
throwsExceptionWith(
'Expected either the CLI arg --$kFrameworkMirrorOption or the environment variable FRAMEWORK_MIRROR to be provided',
),
);
});
test('throws if provided an invalid --$kVersionOverrideOption', () async { test('throws if provided an invalid --$kVersionOverrideOption', () async {
final CommandRunner<void> runner = createRunner(); final CommandRunner<void> runner = createRunner();
...@@ -132,10 +113,6 @@ void main() { ...@@ -132,10 +113,6 @@ void main() {
await expectLater( await expectLater(
() async => runner.run(<String>[ () async => runner.run(<String>[
'start', 'start',
'--$kFrameworkMirrorOption',
frameworkMirror,
'--$kEngineMirrorOption',
engineMirror,
'--$kCandidateOption', '--$kCandidateOption',
candidateBranch, candidateBranch,
'--$kReleaseOption', '--$kReleaseOption',
...@@ -144,6 +121,8 @@ void main() { ...@@ -144,6 +121,8 @@ void main() {
stateFilePath, stateFilePath,
'--$kVersionOverrideOption', '--$kVersionOverrideOption',
'an invalid version string', 'an invalid version string',
'--$kGithubUsernameOption',
githubUsername,
]), ]),
throwsExceptionWith('an invalid version string cannot be parsed'), throwsExceptionWith('an invalid version string cannot be parsed'),
); );
...@@ -153,8 +132,10 @@ void main() { ...@@ -153,8 +132,10 @@ void main() {
stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged() stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged()
const String revision2 = 'def789'; const String revision2 = 'def789';
const String revision3 = '123abc'; const String revision3 = '123abc';
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String previousDartRevision =
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
const String nextDartRevision =
'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
const String previousVersion = '1.2.0-1.0.pre'; const String previousVersion = '1.2.0-1.0.pre';
// This is what this release will be // This is what this release will be
const String nextVersion = '1.2.0-1.1.pre'; const String nextVersion = '1.2.0-1.1.pre';
...@@ -181,7 +162,8 @@ void main() { ...@@ -181,7 +162,8 @@ void main() {
onRun: () { onRun: () {
// Create the DEPS file which the tool will update // Create the DEPS file which the tool will update
engine.createSync(recursive: true); engine.createSync(recursive: true);
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision)); depsFile
.writeAsStringSync(generateMockDeps(previousDartRevision));
}), }),
const FakeCommand( const FakeCommand(
command: <String>['git', 'remote', 'add', 'mirror', engineMirror], command: <String>['git', 'remote', 'add', 'mirror', engineMirror],
...@@ -212,7 +194,12 @@ void main() { ...@@ -212,7 +194,12 @@ void main() {
command: <String>['git', 'add', '--all'], command: <String>['git', 'add', '--all'],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision'], command: <String>[
'git',
'commit',
'--message',
'Update Dart SDK to $nextDartRevision',
],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'], command: <String>['git', 'rev-parse', 'HEAD'],
...@@ -277,12 +264,23 @@ void main() { ...@@ -277,12 +264,23 @@ void main() {
stdout: revision3, stdout: revision3,
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master'], command: <String>[
'git',
'merge-base',
'upstream/$candidateBranch',
'upstream/master',
],
stdout: branchPointRevision, stdout: branchPointRevision,
), ),
// check if commit is tagged, zero exit code means it is tagged // check if commit is tagged, zero exit code means it is tagged
const FakeCommand( const FakeCommand(
command: <String>['git', 'describe', '--exact-match', '--tags', branchPointRevision], command: <String>[
'git',
'describe',
'--exact-match',
'--tags',
branchPointRevision,
],
), ),
]; ];
...@@ -300,10 +298,6 @@ void main() { ...@@ -300,10 +298,6 @@ void main() {
await runner.run(<String>[ await runner.run(<String>[
'start', 'start',
'--$kFrameworkMirrorOption',
frameworkMirror,
'--$kEngineMirrorOption',
engineMirror,
'--$kCandidateOption', '--$kCandidateOption',
candidateBranch, candidateBranch,
'--$kReleaseOption', '--$kReleaseOption',
...@@ -312,6 +306,8 @@ void main() { ...@@ -312,6 +306,8 @@ void main() {
stateFilePath, stateFilePath,
'--$kDartRevisionOption', '--$kDartRevisionOption',
nextDartRevision, nextDartRevision,
'--$kGithubUsernameOption',
githubUsername,
]); ]);
final File stateFile = fileSystem.file(stateFilePath); final File stateFile = fileSystem.file(stateFilePath);
...@@ -322,7 +318,10 @@ void main() { ...@@ -322,7 +318,10 @@ void main() {
); );
expect(state.releaseType, ReleaseType.BETA_HOTFIX); expect(state.releaseType, ReleaseType.BETA_HOTFIX);
expect(stdio.error, isNot(contains('Tried to tag the branch point, however the target version'))); expect(
stdio.error,
isNot(contains(
'Tried to tag the branch point, however the target version')));
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
expect(state.isInitialized(), true); expect(state.isInitialized(), true);
expect(state.releaseChannel, releaseChannel); expect(state.releaseChannel, releaseChannel);
...@@ -333,7 +332,8 @@ void main() { ...@@ -333,7 +332,8 @@ void main() {
expect(state.engine.upstream.url, 'git@github.com:flutter/engine.git'); expect(state.engine.upstream.url, 'git@github.com:flutter/engine.git');
expect(state.framework.candidateBranch, candidateBranch); expect(state.framework.candidateBranch, candidateBranch);
expect(state.framework.startingGitHead, revision3); expect(state.framework.startingGitHead, revision3);
expect(state.framework.upstream.url, 'git@github.com:flutter/flutter.git'); expect(
state.framework.upstream.url, 'git@github.com:flutter/flutter.git');
expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS); expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS);
expect(state.conductorVersion, conductorVersion); expect(state.conductorVersion, conductorVersion);
}); });
...@@ -342,8 +342,10 @@ void main() { ...@@ -342,8 +342,10 @@ void main() {
stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged() stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged()
const String revision2 = 'def789'; const String revision2 = 'def789';
const String revision3 = '123abc'; const String revision3 = '123abc';
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String previousDartRevision =
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
const String nextDartRevision =
'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
const String previousVersion = '1.2.0-1.0.pre'; const String previousVersion = '1.2.0-1.0.pre';
const String candidateBranch = 'flutter-1.2-candidate.1'; const String candidateBranch = 'flutter-1.2-candidate.1';
const String versionOverride = '42.0.0-42.0.pre'; const String versionOverride = '42.0.0-42.0.pre';
...@@ -369,7 +371,8 @@ void main() { ...@@ -369,7 +371,8 @@ void main() {
onRun: () { onRun: () {
// Create the DEPS file which the tool will update // Create the DEPS file which the tool will update
engine.createSync(recursive: true); engine.createSync(recursive: true);
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision)); depsFile
.writeAsStringSync(generateMockDeps(previousDartRevision));
}), }),
const FakeCommand( const FakeCommand(
command: <String>['git', 'remote', 'add', 'mirror', engineMirror], command: <String>['git', 'remote', 'add', 'mirror', engineMirror],
...@@ -400,7 +403,12 @@ void main() { ...@@ -400,7 +403,12 @@ void main() {
command: <String>['git', 'add', '--all'], command: <String>['git', 'add', '--all'],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision'], command: <String>[
'git',
'commit',
'--message',
'Update Dart SDK to $nextDartRevision'
],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'], command: <String>['git', 'rev-parse', 'HEAD'],
...@@ -465,7 +473,12 @@ void main() { ...@@ -465,7 +473,12 @@ void main() {
stdout: revision3, stdout: revision3,
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master'], command: <String>[
'git',
'merge-base',
'upstream/$candidateBranch',
'upstream/master'
],
stdout: branchPointRevision, stdout: branchPointRevision,
), ),
]; ];
...@@ -484,10 +497,6 @@ void main() { ...@@ -484,10 +497,6 @@ void main() {
await runner.run(<String>[ await runner.run(<String>[
'start', 'start',
'--$kFrameworkMirrorOption',
frameworkMirror,
'--$kEngineMirrorOption',
engineMirror,
'--$kCandidateOption', '--$kCandidateOption',
candidateBranch, candidateBranch,
'--$kReleaseOption', '--$kReleaseOption',
...@@ -498,6 +507,8 @@ void main() { ...@@ -498,6 +507,8 @@ void main() {
nextDartRevision, nextDartRevision,
'--$kVersionOverrideOption', '--$kVersionOverrideOption',
versionOverride, versionOverride,
'--$kGithubUsernameOption',
githubUsername,
]); ]);
final File stateFile = fileSystem.file(stateFilePath); final File stateFile = fileSystem.file(stateFilePath);
...@@ -511,12 +522,15 @@ void main() { ...@@ -511,12 +522,15 @@ void main() {
expect(state.releaseVersion, versionOverride); expect(state.releaseVersion, versionOverride);
}); });
test('logs to STDERR but does not fail on an unexpected candidate branch', () async { test('logs to STDERR but does not fail on an unexpected candidate branch',
() async {
stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged() stdio.stdin.add('y'); // accept prompt from ensureBranchPointTagged()
const String revision2 = 'def789'; const String revision2 = 'def789';
const String revision3 = '123abc'; const String revision3 = '123abc';
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String previousDartRevision =
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
const String nextDartRevision =
'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
// note that this significantly behind the candidate branch name // note that this significantly behind the candidate branch name
const String previousVersion = '0.9.0-1.0.pre'; const String previousVersion = '0.9.0-1.0.pre';
// This is what this release will be // This is what this release will be
...@@ -543,7 +557,8 @@ void main() { ...@@ -543,7 +557,8 @@ void main() {
onRun: () { onRun: () {
// Create the DEPS file which the tool will update // Create the DEPS file which the tool will update
engine.createSync(recursive: true); engine.createSync(recursive: true);
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision)); depsFile
.writeAsStringSync(generateMockDeps(previousDartRevision));
}), }),
const FakeCommand( const FakeCommand(
command: <String>['git', 'remote', 'add', 'mirror', engineMirror], command: <String>['git', 'remote', 'add', 'mirror', engineMirror],
...@@ -574,7 +589,12 @@ void main() { ...@@ -574,7 +589,12 @@ void main() {
command: <String>['git', 'add', '--all'], command: <String>['git', 'add', '--all'],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision'], command: <String>[
'git',
'commit',
'--message',
'Update Dart SDK to $nextDartRevision',
],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'], command: <String>['git', 'rev-parse', 'HEAD'],
...@@ -639,12 +659,23 @@ void main() { ...@@ -639,12 +659,23 @@ void main() {
stdout: revision3, stdout: revision3,
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master'], command: <String>[
'git',
'merge-base',
'upstream/$candidateBranch',
'upstream/master',
],
stdout: branchPointRevision, stdout: branchPointRevision,
), ),
// check if commit is tagged, 0 exit code means it is tagged // check if commit is tagged, 0 exit code means it is tagged
const FakeCommand( const FakeCommand(
command: <String>['git', 'describe', '--exact-match', '--tags', branchPointRevision], command: <String>[
'git',
'describe',
'--exact-match',
'--tags',
branchPointRevision,
],
), ),
]; ];
...@@ -662,10 +693,6 @@ void main() { ...@@ -662,10 +693,6 @@ void main() {
await runner.run(<String>[ await runner.run(<String>[
'start', 'start',
'--$kFrameworkMirrorOption',
frameworkMirror,
'--$kEngineMirrorOption',
engineMirror,
'--$kCandidateOption', '--$kCandidateOption',
candidateBranch, candidateBranch,
'--$kReleaseOption', '--$kReleaseOption',
...@@ -674,6 +701,8 @@ void main() { ...@@ -674,6 +701,8 @@ void main() {
stateFilePath, stateFilePath,
'--$kDartRevisionOption', '--$kDartRevisionOption',
nextDartRevision, nextDartRevision,
'--$kGithubUsernameOption',
githubUsername,
]); ]);
final File stateFile = fileSystem.file(stateFilePath); final File stateFile = fileSystem.file(stateFilePath);
...@@ -683,7 +712,8 @@ void main() { ...@@ -683,7 +712,8 @@ void main() {
jsonDecode(stateFile.readAsStringSync()), jsonDecode(stateFile.readAsStringSync()),
); );
expect(stdio.error, isNot(contains('Tried to tag the branch point, however'))); expect(stdio.error,
isNot(contains('Tried to tag the branch point, however')));
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
expect(state.isInitialized(), true); expect(state.isInitialized(), true);
expect(state.releaseChannel, releaseChannel); expect(state.releaseChannel, releaseChannel);
...@@ -694,18 +724,24 @@ void main() { ...@@ -694,18 +724,24 @@ void main() {
expect(state.engine.upstream.url, 'git@github.com:flutter/engine.git'); expect(state.engine.upstream.url, 'git@github.com:flutter/engine.git');
expect(state.framework.candidateBranch, candidateBranch); expect(state.framework.candidateBranch, candidateBranch);
expect(state.framework.startingGitHead, revision3); expect(state.framework.startingGitHead, revision3);
expect(state.framework.upstream.url, 'git@github.com:flutter/flutter.git'); expect(
state.framework.upstream.url, 'git@github.com:flutter/flutter.git');
expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS); expect(state.currentPhase, ReleasePhase.APPLY_ENGINE_CHERRYPICKS);
expect(state.conductorVersion, conductorVersion); expect(state.conductorVersion, conductorVersion);
expect(state.releaseType, ReleaseType.BETA_HOTFIX); expect(state.releaseType, ReleaseType.BETA_HOTFIX);
expect(stdio.error, contains('Parsed version $previousVersion.42 has a different x value than candidate branch $candidateBranch')); expect(
stdio.error,
contains(
'Parsed version $previousVersion.42 has a different x value than candidate branch $candidateBranch'));
}); });
test('can convert from dev style version to stable version', () async { test('can convert from dev style version to stable version', () async {
const String revision2 = 'def789'; const String revision2 = 'def789';
const String revision3 = '123abc'; const String revision3 = '123abc';
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String previousDartRevision =
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
const String nextDartRevision =
'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
const String previousVersion = '1.2.0-3.0.pre'; const String previousVersion = '1.2.0-3.0.pre';
const String nextVersion = '1.2.0'; const String nextVersion = '1.2.0';
...@@ -730,7 +766,8 @@ void main() { ...@@ -730,7 +766,8 @@ void main() {
onRun: () { onRun: () {
// Create the DEPS file which the tool will update // Create the DEPS file which the tool will update
engine.createSync(recursive: true); engine.createSync(recursive: true);
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision)); depsFile
.writeAsStringSync(generateMockDeps(previousDartRevision));
}), }),
const FakeCommand( const FakeCommand(
command: <String>['git', 'remote', 'add', 'mirror', engineMirror], command: <String>['git', 'remote', 'add', 'mirror', engineMirror],
...@@ -761,7 +798,12 @@ void main() { ...@@ -761,7 +798,12 @@ void main() {
command: <String>['git', 'add', '--all'], command: <String>['git', 'add', '--all'],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision'], command: <String>[
'git',
'commit',
'--message',
'Update Dart SDK to $nextDartRevision',
],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'], command: <String>['git', 'rev-parse', 'HEAD'],
...@@ -826,12 +868,23 @@ void main() { ...@@ -826,12 +868,23 @@ void main() {
stdout: revision3, stdout: revision3,
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master'], command: <String>[
'git',
'merge-base',
'upstream/$candidateBranch',
'upstream/master'
],
stdout: branchPointRevision, stdout: branchPointRevision,
), ),
// check if commit is tagged, 0 exit code thus it is tagged // check if commit is tagged, 0 exit code thus it is tagged
const FakeCommand( const FakeCommand(
command: <String>['git', 'describe', '--exact-match', '--tags', branchPointRevision], command: <String>[
'git',
'describe',
'--exact-match',
'--tags',
branchPointRevision,
],
), ),
]; ];
...@@ -849,10 +902,6 @@ void main() { ...@@ -849,10 +902,6 @@ void main() {
await runner.run(<String>[ await runner.run(<String>[
'start', 'start',
'--$kFrameworkMirrorOption',
frameworkMirror,
'--$kEngineMirrorOption',
engineMirror,
'--$kCandidateOption', '--$kCandidateOption',
candidateBranch, candidateBranch,
'--$kReleaseOption', '--$kReleaseOption',
...@@ -861,6 +910,8 @@ void main() { ...@@ -861,6 +910,8 @@ void main() {
stateFilePath, stateFilePath,
'--$kDartRevisionOption', '--$kDartRevisionOption',
nextDartRevision, nextDartRevision,
'--$kGithubUsernameOption',
githubUsername,
]); ]);
final File stateFile = fileSystem.file(stateFilePath); final File stateFile = fileSystem.file(stateFilePath);
...@@ -883,14 +934,17 @@ void main() { ...@@ -883,14 +934,17 @@ void main() {
expect(state.conductorVersion, conductorVersion); expect(state.conductorVersion, conductorVersion);
expect(state.releaseType, ReleaseType.STABLE_INITIAL); expect(state.releaseType, ReleaseType.STABLE_INITIAL);
}); });
test(
test('StartContext gets engine and framework checkout directories after run', () async { 'StartContext gets engine and framework checkout directories after run',
() async {
stdio.stdin.add('y'); stdio.stdin.add('y');
const String revision2 = 'def789'; const String revision2 = 'def789';
const String revision3 = '123abc'; const String revision3 = '123abc';
const String branchPointRevision = 'deadbeef'; const String branchPointRevision = 'deadbeef';
const String previousDartRevision = '171876a4e6cf56ee6da1f97d203926bd7afda7ef'; const String previousDartRevision =
const String nextDartRevision = 'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e'; '171876a4e6cf56ee6da1f97d203926bd7afda7ef';
const String nextDartRevision =
'f6c91128be6b77aef8351e1e3a9d07c85bc2e46e';
const String previousVersion = '1.2.0-1.0.pre'; const String previousVersion = '1.2.0-1.0.pre';
// This is a git tag applied to the branch point, not an actual release // This is a git tag applied to the branch point, not an actual release
const String branchPointTag = '1.2.0-3.0.pre'; const String branchPointTag = '1.2.0-3.0.pre';
...@@ -921,7 +975,8 @@ void main() { ...@@ -921,7 +975,8 @@ void main() {
onRun: () { onRun: () {
// Create the DEPS file which the tool will update // Create the DEPS file which the tool will update
engine.createSync(recursive: true); engine.createSync(recursive: true);
depsFile.writeAsStringSync(generateMockDeps(previousDartRevision)); depsFile
.writeAsStringSync(generateMockDeps(previousDartRevision));
}), }),
const FakeCommand( const FakeCommand(
command: <String>['git', 'remote', 'add', 'mirror', engineMirror], command: <String>['git', 'remote', 'add', 'mirror', engineMirror],
...@@ -952,7 +1007,12 @@ void main() { ...@@ -952,7 +1007,12 @@ void main() {
command: <String>['git', 'add', '--all'], command: <String>['git', 'add', '--all'],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'commit', '--message', 'Update Dart SDK to $nextDartRevision'], command: <String>[
'git',
'commit',
'--message',
'Update Dart SDK to $nextDartRevision'
],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'], command: <String>['git', 'rev-parse', 'HEAD'],
...@@ -1014,12 +1074,23 @@ void main() { ...@@ -1014,12 +1074,23 @@ void main() {
stdout: branchPointRevision, stdout: branchPointRevision,
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'merge-base', 'upstream/$candidateBranch', 'upstream/master'], command: <String>[
'git',
'merge-base',
'upstream/$candidateBranch',
'upstream/master'
],
stdout: branchPointRevision, stdout: branchPointRevision,
), ),
// check if commit is tagged // check if commit is tagged
const FakeCommand( const FakeCommand(
command: <String>['git', 'describe', '--exact-match', '--tags', branchPointRevision], command: <String>[
'git',
'describe',
'--exact-match',
'--tags',
branchPointRevision
],
// non-zero exit code means branch point is NOT tagged // non-zero exit code means branch point is NOT tagged
exitCode: 128, exitCode: 128,
), ),
...@@ -1027,7 +1098,12 @@ void main() { ...@@ -1027,7 +1098,12 @@ void main() {
command: <String>['git', 'tag', branchPointTag, branchPointRevision], command: <String>['git', 'tag', branchPointTag, branchPointRevision],
), ),
const FakeCommand( const FakeCommand(
command: <String>['git', 'push', FrameworkRepository.defaultUpstream, branchPointTag], command: <String>[
'git',
'push',
FrameworkRepository.defaultUpstream,
branchPointTag
],
), ),
]; ];
...@@ -1076,6 +1152,7 @@ void main() { ...@@ -1076,6 +1152,7 @@ void main() {
releaseChannel: releaseChannel, releaseChannel: releaseChannel,
processManager: processManager, processManager: processManager,
conductorVersion: conductorVersion, conductorVersion: conductorVersion,
githubUsername: githubUsername,
stateFile: stateFile, stateFile: stateFile,
); );
...@@ -1086,8 +1163,10 @@ void main() { ...@@ -1086,8 +1163,10 @@ void main() {
jsonDecode(stateFile.readAsStringSync()), jsonDecode(stateFile.readAsStringSync()),
); );
expect((await startContext.engine.checkoutDirectory).path, equals(engine.path)); expect((await startContext.engine.checkoutDirectory).path,
expect((await startContext.framework.checkoutDirectory).path, equals(framework.path)); equals(engine.path));
expect((await startContext.framework.checkoutDirectory).path,
equals(framework.path));
expect(state.releaseType, ReleaseType.BETA_INITIAL); expect(state.releaseType, ReleaseType.BETA_INITIAL);
expect(processManager, hasNoRemainingExpectations); expect(processManager, hasNoRemainingExpectations);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment