Sync the live folder after Nomulus rollback (#854)

* Sync the live folder after Nomulus rollback

To update the nomulus tool on corp desktop, the artifacts from the
rollback target release should be copied to the 'live' folder.

* Fix a test
This commit is contained in:
Weimin Yu 2020-10-29 16:21:56 -04:00 committed by GitHub
parent b8d913ef64
commit ef688796d0
3 changed files with 22 additions and 1 deletions

View file

@ -172,6 +172,9 @@ def _generate_steps(
rollback_steps.append( rollback_steps.append(
steps.update_deploy_tags(gcs_client.project, env, target_release)) steps.update_deploy_tags(gcs_client.project, env, target_release))
rollback_steps.append(
steps.sync_live_release(gcs_client.project, target_release))
return tuple(rollback_steps) return tuple(rollback_steps)

View file

@ -114,7 +114,7 @@ class RollbackTestCase(unittest.TestCase):
steps = plan.get_rollback_plan(self._gcs_client, self._appengine_admin, steps = plan.get_rollback_plan(self._gcs_client, self._appengine_admin,
'crash', 'nomulus-20201014-RC00') 'crash', 'nomulus-20201014-RC00')
self.assertEqual(len(steps), 14) self.assertEqual(len(steps), 15)
self.assertRegex(steps[0].info(), self.assertRegex(steps[0].info(),
'.*nom_build :integration:sqlIntegrationTest.*') '.*nom_build :integration:sqlIntegrationTest.*')
self.assertRegex(steps[1].info(), '.*gcloud app versions start.*') self.assertRegex(steps[1].info(), '.*gcloud app versions start.*')
@ -123,6 +123,7 @@ class RollbackTestCase(unittest.TestCase):
self.assertRegex(steps[9].info(), '.*gcloud app versions stop.*') self.assertRegex(steps[9].info(), '.*gcloud app versions stop.*')
self.assertRegex(steps[13].info(), self.assertRegex(steps[13].info(),
'.*echo nomulus-20201014-RC00 | gsutil cat -.*') '.*echo nomulus-20201014-RC00 | gsutil cat -.*')
self.assertRegex(steps[14].info(), '.*gsutil -m rsync -d .*')
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -150,3 +150,20 @@ def update_deploy_tags(dev_project: str, env: str,
f'Update Nomulus tag in {env}', f'Update Nomulus tag in {env}',
(f'echo {nom_tag} | gsutil cp - {destination}', ''), nom_tag, (f'echo {nom_tag} | gsutil cp - {destination}', ''), nom_tag,
destination) destination)
def sync_live_release(dev_project: str, nom_tag: str) -> RollbackStep:
"""Syncs the target release artifacts to the live folder.
By convention the gs://{dev_project}-deploy/live folder should contain the
artifacts from the currently serving release.
For Domain Registry team members, this step updates the nomulus tool
installed on corp desktops.
"""
artifacts_folder = f'gs://{dev_project}-deploy/{nom_tag}'
live_folder = f'gs://{dev_project}-deploy/live'
return RollbackStep(
f'Syncing {artifacts_folder} to {live_folder}.',
('gsutil', '-m', 'rsync', '-d', artifacts_folder, live_folder))