Skip to content

Commit

Permalink
Sync the live folder after Nomulus rollback (#854)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
weiminyu committed Oct 29, 2020
1 parent 5bba658 commit 83918e9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions release/rollback/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ def _generate_steps(
rollback_steps.append(
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)


Expand Down
3 changes: 2 additions & 1 deletion release/rollback/rollback_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_rollback_success(self):

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


if __name__ == '__main__':
Expand Down
17 changes: 17 additions & 0 deletions release/rollback/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,20 @@ def update_deploy_tags(dev_project: str, env: str,
f'Update Nomulus tag in {env}',
(f'echo {nom_tag} | gsutil cp - {destination}', ''), nom_tag,
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))

0 comments on commit 83918e9

Please sign in to comment.