Skip to content

Commit 22e3327

Browse files
author
Casey Hillers
authored
[conductor] Roll engine->flutter whenever version is out of date (#121502)
[conductor] Roll engine whenever version is out of date
1 parent cc26a1a commit 22e3327

File tree

2 files changed

+59
-30
lines changed

2 files changed

+59
-30
lines changed

dev/conductor/core/lib/src/next.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,6 @@ class NextContext extends Context {
160160
}
161161
break;
162162
case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS:
163-
if (state.engine.cherrypicks.isEmpty && state.engine.dartRevision.isEmpty) {
164-
stdio.printStatus(
165-
'This release has no engine cherrypicks, and thus the engine.version file\n'
166-
'in the framework does not need to be updated.',
167-
);
168-
169-
if (state.framework.cherrypicks.isEmpty) {
170-
stdio.printStatus(
171-
'This release also has no framework cherrypicks. Therefore, a framework\n'
172-
'pull request is not required.',
173-
);
174-
break;
175-
}
176-
}
177163
final Remote engineUpstreamRemote = Remote(
178164
name: RemoteName.upstream,
179165
url: state.engine.upstream.url,

dev/conductor/core/test/next_test.dart

Lines changed: 59 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,60 @@ void main() {
425425
engineRevisionFile.writeAsStringSync(oldEngineVersion, flush: true);
426426
});
427427

428-
test('with no dart, engine or framework cherrypicks, no user input, no PR needed', () async {
429-
state = pb.ConductorState(
428+
test('with no dart, engine or framework cherrypicks, updates engine revision if version mismatch', () async {
429+
stdio.stdin.add('n');
430+
processManager.addCommands(<FakeCommand>[
431+
const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
432+
// we want merged upstream commit, not local working commit
433+
const FakeCommand(command: <String>['git', 'checkout', 'upstream/$candidateBranch']),
434+
const FakeCommand(
435+
command: <String>['git', 'rev-parse', 'HEAD'],
436+
stdout: revision1,
437+
),
438+
const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
439+
FakeCommand(
440+
command: const <String>['git', 'checkout', workingBranch],
441+
onRun: () {
442+
final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml')
443+
..createSync();
444+
_initializeCiYamlFile(file);
445+
},
446+
),
447+
const FakeCommand(
448+
command: <String>['git', 'status', '--porcelain'],
449+
stdout: 'MM bin/internal/release-candidate-branch.version',
450+
),
451+
const FakeCommand(command: <String>['git', 'add', '--all']),
452+
const FakeCommand(command: <String>[
453+
'git',
454+
'commit',
455+
'--message',
456+
'Create candidate branch version $candidateBranch for $releaseChannel',
457+
]),
458+
const FakeCommand(
459+
command: <String>['git', 'rev-parse', 'HEAD'],
460+
stdout: revision3,
461+
),
462+
const FakeCommand(
463+
command: <String>['git', 'status', '--porcelain'],
464+
stdout: 'MM bin/internal/engine.version',
465+
),
466+
const FakeCommand(command: <String>['git', 'add', '--all']),
467+
const FakeCommand(command: <String>[
468+
'git',
469+
'commit',
470+
'--message',
471+
'Update Engine revision to $revision1 for $releaseChannel release $releaseVersion',
472+
]),
473+
const FakeCommand(
474+
command: <String>['git', 'rev-parse', 'HEAD'],
475+
stdout: revision4,
476+
),
477+
]);
478+
final pb.ConductorState state = pb.ConductorState(
479+
releaseChannel: releaseChannel,
480+
releaseVersion: releaseVersion,
481+
currentPhase: ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS,
430482
framework: pb.Repository(
431483
candidateBranch: candidateBranch,
432484
checkoutPath: frameworkCheckoutPath,
@@ -438,16 +490,14 @@ void main() {
438490
candidateBranch: candidateBranch,
439491
checkoutPath: engineCheckoutPath,
440492
upstream: pb.Remote(name: 'upstream', url: engineUpstreamRemoteUrl),
493+
currentGitHead: revision1,
441494
),
442-
currentPhase: ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS,
443495
);
444-
445496
writeStateToFile(
446497
fileSystem.file(stateFile),
447498
state,
448499
<String>[],
449500
);
450-
451501
final Checkouts checkouts = Checkouts(
452502
fileSystem: fileSystem,
453503
parentDirectory: fileSystem.directory(checkoutsParentDirectory)..createSync(recursive: true),
@@ -456,23 +506,16 @@ void main() {
456506
stdio: stdio,
457507
);
458508
final CommandRunner<void> runner = createRunner(checkouts: checkouts);
459-
460509
await runner.run(<String>[
461510
'next',
462511
'--$kStateOption',
463512
stateFile,
464513
]);
465514

466-
final pb.ConductorState finalState = readStateFromFile(
467-
fileSystem.file(stateFile),
468-
);
469-
470-
expect(finalState.currentPhase, ReleasePhase.PUBLISH_VERSION);
471-
expect(stdio.error, isEmpty);
472-
expect(
473-
stdio.stdout,
474-
contains('pull request is not required'),
475-
);
515+
expect(processManager, hasNoRemainingExpectations);
516+
expect(stdio.stdout, contains('release-candidate-branch.version containing $candidateBranch'));
517+
expect(stdio.stdout, contains('Updating engine revision from $oldEngineVersion to $revision1'));
518+
expect(stdio.stdout, contains('Are you ready to push your framework branch'));
476519
});
477520

478521
test('with no engine cherrypicks but a dart revision update, updates engine revision', () async {

0 commit comments

Comments
 (0)