Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't allow Friday deploys in Chrome. #4513

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/local/butler/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import tempfile
import time

import pytz

from local.butler import appengine
from local.butler import common
from local.butler import constants
Expand All @@ -47,9 +49,9 @@
Version = namedtuple('Version', ['id', 'deploy_time', 'traffic_split'])


def now():
def now(tz=None):
"""Used for mocks."""
return datetime.datetime.now()
return datetime.datetime.now(tz)


def _get_services(paths):
Expand Down Expand Up @@ -449,6 +451,27 @@ def _deploy_terraform(config_dir):
common.execute(f'rm -rf {terraform_dir}/.terraform*')


def _is_safe_deploy_day():
time_now_in_ny = now(pytz.timezone('America/New_York'))
day_now_in_ny = time_now_in_ny.weekday()
return day_now_in_ny not in {4, 5, 6} # The days of the week are 0-indexed.


def _enforce_safe_day_to_deploy():
jonathanmetzman marked this conversation as resolved.
Show resolved Hide resolved
"""Checks that is not an unsafe day (Friday, Saturday, or Sunday) to
deploy for chrome ClusterFuzz."""

config = local_config.Config()
if config.get('weekend_deploy_allowed', True):
return

if not _is_safe_deploy_day():
raise RuntimeError('Cannot deploy Fri-Sun to this CF instance except for '
'urgent fixes. See b/384493595. If needed, temporarily '
'delete+commit this. You are not too l33t for this '
'rule. Do not break it!')


def _deploy_k8s(config_dir):
"""Deploys all k8s workloads."""
k8s_dir = os.path.join('infra', 'k8s')
Expand Down
Loading