Unverified Commit 22e33275 authored by Casey Hillers's avatar Casey Hillers Committed by GitHub

[conductor] Roll engine->flutter whenever version is out of date (#121502)

[conductor] Roll engine whenever version is out of date
parent cc26a1aa
...@@ -160,20 +160,6 @@ class NextContext extends Context { ...@@ -160,20 +160,6 @@ class NextContext extends Context {
} }
break; break;
case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS: case pb.ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS:
if (state.engine.cherrypicks.isEmpty && state.engine.dartRevision.isEmpty) {
stdio.printStatus(
'This release has no engine cherrypicks, and thus the engine.version file\n'
'in the framework does not need to be updated.',
);
if (state.framework.cherrypicks.isEmpty) {
stdio.printStatus(
'This release also has no framework cherrypicks. Therefore, a framework\n'
'pull request is not required.',
);
break;
}
}
final Remote engineUpstreamRemote = Remote( final Remote engineUpstreamRemote = Remote(
name: RemoteName.upstream, name: RemoteName.upstream,
url: state.engine.upstream.url, url: state.engine.upstream.url,
......
...@@ -425,8 +425,60 @@ void main() { ...@@ -425,8 +425,60 @@ void main() {
engineRevisionFile.writeAsStringSync(oldEngineVersion, flush: true); engineRevisionFile.writeAsStringSync(oldEngineVersion, flush: true);
}); });
test('with no dart, engine or framework cherrypicks, no user input, no PR needed', () async { test('with no dart, engine or framework cherrypicks, updates engine revision if version mismatch', () async {
state = pb.ConductorState( stdio.stdin.add('n');
processManager.addCommands(<FakeCommand>[
const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
// we want merged upstream commit, not local working commit
const FakeCommand(command: <String>['git', 'checkout', 'upstream/$candidateBranch']),
const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'],
stdout: revision1,
),
const FakeCommand(command: <String>['git', 'fetch', 'upstream']),
FakeCommand(
command: const <String>['git', 'checkout', workingBranch],
onRun: () {
final File file = fileSystem.file('$checkoutsParentDirectory/framework/.ci.yaml')
..createSync();
_initializeCiYamlFile(file);
},
),
const FakeCommand(
command: <String>['git', 'status', '--porcelain'],
stdout: 'MM bin/internal/release-candidate-branch.version',
),
const FakeCommand(command: <String>['git', 'add', '--all']),
const FakeCommand(command: <String>[
'git',
'commit',
'--message',
'Create candidate branch version $candidateBranch for $releaseChannel',
]),
const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'],
stdout: revision3,
),
const FakeCommand(
command: <String>['git', 'status', '--porcelain'],
stdout: 'MM bin/internal/engine.version',
),
const FakeCommand(command: <String>['git', 'add', '--all']),
const FakeCommand(command: <String>[
'git',
'commit',
'--message',
'Update Engine revision to $revision1 for $releaseChannel release $releaseVersion',
]),
const FakeCommand(
command: <String>['git', 'rev-parse', 'HEAD'],
stdout: revision4,
),
]);
final pb.ConductorState state = pb.ConductorState(
releaseChannel: releaseChannel,
releaseVersion: releaseVersion,
currentPhase: ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS,
framework: pb.Repository( framework: pb.Repository(
candidateBranch: candidateBranch, candidateBranch: candidateBranch,
checkoutPath: frameworkCheckoutPath, checkoutPath: frameworkCheckoutPath,
...@@ -438,16 +490,14 @@ void main() { ...@@ -438,16 +490,14 @@ void main() {
candidateBranch: candidateBranch, candidateBranch: candidateBranch,
checkoutPath: engineCheckoutPath, checkoutPath: engineCheckoutPath,
upstream: pb.Remote(name: 'upstream', url: engineUpstreamRemoteUrl), upstream: pb.Remote(name: 'upstream', url: engineUpstreamRemoteUrl),
currentGitHead: revision1,
), ),
currentPhase: ReleasePhase.APPLY_FRAMEWORK_CHERRYPICKS,
); );
writeStateToFile( writeStateToFile(
fileSystem.file(stateFile), fileSystem.file(stateFile),
state, state,
<String>[], <String>[],
); );
final Checkouts checkouts = Checkouts( final Checkouts checkouts = Checkouts(
fileSystem: fileSystem, fileSystem: fileSystem,
parentDirectory: fileSystem.directory(checkoutsParentDirectory)..createSync(recursive: true), parentDirectory: fileSystem.directory(checkoutsParentDirectory)..createSync(recursive: true),
...@@ -456,23 +506,16 @@ void main() { ...@@ -456,23 +506,16 @@ void main() {
stdio: stdio, stdio: stdio,
); );
final CommandRunner<void> runner = createRunner(checkouts: checkouts); final CommandRunner<void> runner = createRunner(checkouts: checkouts);
await runner.run(<String>[ await runner.run(<String>[
'next', 'next',
'--$kStateOption', '--$kStateOption',
stateFile, stateFile,
]); ]);
final pb.ConductorState finalState = readStateFromFile( expect(processManager, hasNoRemainingExpectations);
fileSystem.file(stateFile), expect(stdio.stdout, contains('release-candidate-branch.version containing $candidateBranch'));
); expect(stdio.stdout, contains('Updating engine revision from $oldEngineVersion to $revision1'));
expect(stdio.stdout, contains('Are you ready to push your framework branch'));
expect(finalState.currentPhase, ReleasePhase.PUBLISH_VERSION);
expect(stdio.error, isEmpty);
expect(
stdio.stdout,
contains('pull request is not required'),
);
}); });
test('with no engine cherrypicks but a dart revision update, updates engine revision', () async { test('with no engine cherrypicks but a dart revision update, updates engine revision', () async {
......
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