Skip to content

Commit 96d8db7

Browse files
committed
Merge branch 'main' into zeid/bug-1744327-refactor-workers
2 parents e4db70c + 46cdbea commit 96d8db7

File tree

7 files changed

+20
-33
lines changed

7 files changed

+20
-33
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ jobs:
112112
elif [[ ${CIRCLE_BRANCH} == develop ]]; then
113113
docker tag "mozilla/landoapi" "${DOCKERHUB_REPO}:develop-latest"
114114
docker push "${DOCKERHUB_REPO}:develop-latest"
115+
elif [[ ${CIRCLE_BRANCH} == staging ]]; then
116+
docker tag "mozilla/landoapi" "${DOCKERHUB_REPO}:staging-latest"
117+
docker push "${DOCKERHUB_REPO}:staging-latest"
115118
fi
116119
fi
117120

landoapi/api/uplift.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from landoapi import auth
1111
from landoapi.phabricator import PhabricatorClient
12-
from landoapi.projects import get_relman_group_phid
1312
from landoapi.repos import get_repos_for_env
1413
from landoapi.transplants import convert_path_id_to_phid
1514
from landoapi.uplift import (
@@ -90,19 +89,6 @@ def create(data):
9089
type="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404",
9190
)
9291

93-
# Get the `#release-managers` group PHID for requesting review.
94-
relman_phid = get_relman_group_phid(phab)
95-
if not relman_phid:
96-
return problem(
97-
500,
98-
"#release-managers group not found.",
99-
(
100-
"The RelMan review group could not be found. This is a server-side "
101-
"issue, please file a bug."
102-
),
103-
type="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404",
104-
)
105-
10692
landing_path = convert_path_id_to_phid(landing_path, revision_data)
10793
commit_stack = []
10894
for rev_id, _diff_id in landing_path:
@@ -124,7 +110,6 @@ def create(data):
124110
revision,
125111
diff,
126112
parent_phid,
127-
relman_phid,
128113
target_repository,
129114
)
130115
commit_stack.append(rev)

landoapi/models/revisions.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,6 @@ class DiffWarning(Base):
348348
# The "type" of warning. This is mainly to group warnings when querying the API.
349349
group = db.Column(db.Enum(DiffWarningGroup), nullable=False)
350350

351-
# The code freeze dates generally correspond to PST work days.
352-
@property
353-
def code_freeze_offset(self) -> str:
354-
return "-0800"
355-
356351
def serialize(self):
357352
"""Return a JSON serializable dictionary."""
358353
return {

landoapi/transplants.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This Source Code Form is subject to the terms of the Mozilla Publc
1+
# This Source Code Form is subject to the terms of the Mozilla Public
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44
import functools
@@ -41,6 +41,9 @@
4141
defaults=(None, None, None, None, False),
4242
)
4343

44+
# The code freeze dates generally correspond to PST work days.
45+
CODE_FREEZE_OFFSET = "-0800"
46+
4447

4548
def tokens_are_equal(t1, t2):
4649
"""Return whether t1 and t2 are equal.
@@ -330,14 +333,14 @@ def warning_code_freeze(*, repo, **kwargs):
330333

331334
today = datetime.now(tz=timezone.utc)
332335
freeze_date = datetime.strptime(
333-
f"{freeze_date_str} {DiffWarning.code_freeze_offset}",
336+
f"{freeze_date_str} {CODE_FREEZE_OFFSET}",
334337
"%Y-%m-%d %z",
335338
).replace(tzinfo=timezone.utc)
336339
if today < freeze_date:
337340
return
338341

339342
merge_date = datetime.strptime(
340-
f"{merge_date_str} {DiffWarning.code_freeze_offset}",
343+
f"{merge_date_str} {CODE_FREEZE_OFFSET}",
341344
"%Y-%m-%d %z",
342345
).replace(tzinfo=timezone.utc)
343346

landoapi/uplift.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ def create_uplift_revision(
203203
source_revision: dict,
204204
source_diff: dict,
205205
parent_phid: Optional[str],
206-
relman_phid: str,
207206
target_repository: dict,
208207
) -> dict[str, str]:
209208
"""Create a new revision on a repository, cloning a diff from another repo.
@@ -278,11 +277,6 @@ def create_uplift_revision(
278277
# Copy title & summary from source revision.
279278
{"type": "title", "value": phab.expect(source_revision, "fields", "title")},
280279
{"type": "summary", "value": summary},
281-
# Set release managers as reviewers.
282-
{
283-
"type": "reviewers.add",
284-
"value": [f"blocking({relman_phid})"],
285-
},
286280
# Copy Bugzilla id.
287281
{
288282
"type": "bugzilla.bug-id",

tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from landoapi.app import construct_app, load_config, SUBSYSTEMS
2222
from landoapi.cache import cache, cache_subsystem
2323
from landoapi.mocks.auth import MockAuth0, TEST_JWKS
24-
from landoapi.models.revisions import DiffWarning, Revision
24+
from landoapi.models.revisions import Revision
2525
from landoapi.phabricator import PhabricatorClient
2626
from landoapi.projects import (
2727
CHECKIN_PROJ_SLUG,
@@ -32,7 +32,7 @@
3232
from landoapi.repos import Repo, SCM_LEVEL_3
3333
from landoapi.storage import db as _db, db_subsystem
3434
from landoapi.tasks import celery
35-
from landoapi.transplants import tokens_are_equal
35+
from landoapi.transplants import tokens_are_equal, CODE_FREEZE_OFFSET
3636

3737
from tests.factories import TransResponseFactory
3838
from tests.mocks import PhabricatorDouble, TreeStatusDouble
@@ -431,7 +431,7 @@ def register_codefreeze_uri(request_mocker):
431431

432432
@pytest.fixture
433433
def codefreeze_datetime(request_mocker):
434-
utc_offset = DiffWarning.code_freeze_offset
434+
utc_offset = CODE_FREEZE_OFFSET
435435
dates = {
436436
"today": datetime(2000, 1, 5, 0, 0, 0, tzinfo=timezone.utc),
437437
f"two_days_ago {utc_offset}": datetime(2000, 1, 3, 0, 0, 0),

tests/test_transplants.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# This Source Code Form is subject to the terms of the Mozilla Public
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4-
import os
4+
from datetime import datetime, timezone
55
from unittest.mock import MagicMock, patch
6+
import os
67

78
import pytest
89

@@ -1076,3 +1077,9 @@ def _create_landing_job(
10761077
job.status = LandingJobStatus.SUBMITTED
10771078
db.session.commit()
10781079
return job
1080+
1081+
1082+
def test_codefreeze_datetime_mock(codefreeze_datetime):
1083+
dt = codefreeze_datetime()
1084+
assert dt.now(tz=timezone.utc) == datetime(2000, 1, 5, 0, 0, 0, tzinfo=timezone.utc)
1085+
assert dt.strptime("tomorrow -0800", fmt="") == datetime(2000, 1, 6, 0, 0, 0)

0 commit comments

Comments
 (0)