diff --git a/dev/conductor/core/lib/src/next.dart b/dev/conductor/core/lib/src/next.dart index 8a3f6061982..f5f8d048aeb 100644 --- a/dev/conductor/core/lib/src/next.dart +++ b/dev/conductor/core/lib/src/next.dart @@ -264,21 +264,33 @@ class NextContext extends Context { case pb.ReleasePhase.PUBLISH_VERSION: stdio.printStatus('Please ensure that you have merged your framework PR and that'); stdio.printStatus('post-submit CI has finished successfully.\n'); - final Remote upstream = Remote( + final Remote frameworkUpstream = Remote( name: RemoteName.upstream, url: state.framework.upstream.url, ); final FrameworkRepository framework = FrameworkRepository( checkouts, // We explicitly want to check out the merged version from upstream - initialRef: '${upstream.name}/${state.framework.candidateBranch}', - upstreamRemote: upstream, + initialRef: '${frameworkUpstream.name}/${state.framework.candidateBranch}', + upstreamRemote: frameworkUpstream, previousCheckoutLocation: state.framework.checkoutPath, ); - final String headRevision = await framework.reverseParse('HEAD'); + final String frameworkHead = await framework.reverseParse('HEAD'); + final Remote engineUpstream = Remote( + name: RemoteName.upstream, + url: state.engine.upstream.url, + ); + final EngineRepository engine = EngineRepository( + checkouts, + // We explicitly want to check out the merged version from upstream + initialRef: '${engineUpstream.name}/${state.engine.candidateBranch}', + upstreamRemote: engineUpstream, + previousCheckoutLocation: state.engine.checkoutPath, + ); + final String engineHead = await engine.reverseParse('HEAD'); if (autoAccept == false) { final bool response = await prompt( - 'Are you ready to tag commit $headRevision as ${state.releaseVersion}\n' + 'Are you ready to tag commit $frameworkHead as ${state.releaseVersion}\n' 'and push to remote ${state.framework.upstream.url}?', ); if (!response) { @@ -287,7 +299,8 @@ class NextContext extends Context { return; } } - await framework.tag(headRevision, state.releaseVersion, upstream.name); + await framework.tag(frameworkHead, state.releaseVersion, frameworkUpstream.name); + await engine.tag(engineHead, state.releaseVersion, engineUpstream.name); break; case pb.ReleasePhase.PUBLISH_CHANNEL: final Remote upstream = Remote( diff --git a/dev/conductor/core/lib/src/repository.dart b/dev/conductor/core/lib/src/repository.dart index e047d5b6be4..0f52e4ee9d9 100644 --- a/dev/conductor/core/lib/src/repository.dart +++ b/dev/conductor/core/lib/src/repository.dart @@ -319,6 +319,27 @@ abstract class Repository { ); } + /// Tag [commit] and push the tag to the remote. + Future tag(String commit, String tagName, String remote) async { + assert(commit.isNotEmpty); + assert(tagName.isNotEmpty); + assert(remote.isNotEmpty); + stdio.printStatus('About to tag commit $commit as $tagName...'); + await git.run( + ['tag', tagName, commit], + 'tag the commit with the version label', + workingDirectory: (await checkoutDirectory).path, + ); + stdio.printStatus('Tagging successful.'); + stdio.printStatus('About to push $tagName to remote $remote...'); + await git.run( + ['push', remote, tagName], + 'publish the tag to the repo', + workingDirectory: (await checkoutDirectory).path, + ); + stdio.printStatus('Tag push successful.'); + } + /// List commits in reverse chronological order. Future> revList(List args) async { return (await git.getOutput(['rev-list', ...args], @@ -592,27 +613,6 @@ class FrameworkRepository extends Repository { ); } - /// Tag [commit] and push the tag to the remote. - Future tag(String commit, String tagName, String remote) async { - assert(commit.isNotEmpty); - assert(tagName.isNotEmpty); - assert(remote.isNotEmpty); - stdio.printStatus('About to tag commit $commit as $tagName...'); - await git.run( - ['tag', tagName, commit], - 'tag the commit with the version label', - workingDirectory: (await checkoutDirectory).path, - ); - stdio.printStatus('Tagging successful.'); - stdio.printStatus('About to push $tagName to remote $remote...'); - await git.run( - ['push', remote, tagName], - 'publish the tag to the repo', - workingDirectory: (await checkoutDirectory).path, - ); - stdio.printStatus('Tag push successful.'); - } - @override Future cloneRepository(String? cloneName) async { assert(localUpstream); diff --git a/dev/conductor/core/test/next_test.dart b/dev/conductor/core/test/next_test.dart index 29417b39808..44ddae273c9 100644 --- a/dev/conductor/core/test/next_test.dart +++ b/dev/conductor/core/test/next_test.dart @@ -758,6 +758,10 @@ void main() { candidateBranch: candidateBranch, upstream: pb.Remote(url: FrameworkRepository.defaultUpstream), ), + engine: pb.Repository( + candidateBranch: candidateBranch, + upstream: pb.Remote(url: EngineRepository.defaultUpstream), + ), releaseVersion: releaseVersion, ); platform = FakePlatform( @@ -773,6 +777,18 @@ void main() { stdio.stdin.add('n'); final FakeProcessManager processManager = FakeProcessManager.list( [ + // Framework checkout + const FakeCommand( + command: ['git', 'fetch', 'upstream'], + ), + const FakeCommand( + command: ['git', 'checkout', '$remoteName/$candidateBranch'], + ), + const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + stdout: revision1, + ), + // Engine checkout const FakeCommand( command: ['git', 'fetch', 'upstream'], ), @@ -818,6 +834,7 @@ void main() { test('updates state.currentPhase if user responds yes', () async { stdio.stdin.add('y'); final FakeProcessManager processManager = FakeProcessManager.list([ + // Framework checkout const FakeCommand( command: ['git', 'fetch', 'upstream'], ), @@ -828,12 +845,31 @@ void main() { command: ['git', 'rev-parse', 'HEAD'], stdout: revision1, ), + // Engine checkout + const FakeCommand( + command: ['git', 'fetch', 'upstream'], + ), + const FakeCommand( + command: ['git', 'checkout', '$remoteName/$candidateBranch'], + ), + const FakeCommand( + command: ['git', 'rev-parse', 'HEAD'], + stdout: revision2, + ), + // Framework tag const FakeCommand( command: ['git', 'tag', releaseVersion, revision1], ), const FakeCommand( command: ['git', 'push', remoteName, releaseVersion], ), + // Engine tag + const FakeCommand( + command: ['git', 'tag', releaseVersion, revision2], + ), + const FakeCommand( + command: ['git', 'push', remoteName, releaseVersion], + ), ]); final FakePlatform platform = FakePlatform( environment: {