Skip to content

Commit b9c8199

Browse files
authored
Merge pull request #97 from lsst-sqre/tickets/DM-32710
DM-32710: Update main as default branch for editions (1.23.0 release)
2 parents e445607 + 248bd98 commit b9c8199

14 files changed

+91
-87
lines changed

CHANGELOG.rst

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
Change log
33
##########
44

5+
1.23.0 (2021-11-29)
6+
===================
7+
8+
- Change "master" to "main" as the tracked branch for default editions when a product is created.
9+
- Update the lsstdoc tracking mode so that it accepts either master or main as the name of a default branch to track if a semantic version is not available yet.
10+
511
1.22.0 (2021-04-27)
612
===================
713

keeper/api/products.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def new_product() -> Tuple[str, int, Dict[str, str]]:
223223

224224
# Create a default edition for the product
225225
edition_data = {
226-
"tracked_refs": ["master"],
226+
"tracked_refs": ["main"],
227227
"slug": "main",
228228
"title": "Latest",
229229
}

keeper/editiontracking/lsstdocmode.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ def should_update(
4444
# build is tracking `master`, then allow this rebuild.
4545
# This is used in the period before a semantic version is
4646
# available.
47-
if candidate_build.git_refs[0] == "master":
48-
if (
49-
edition.build_id is None
50-
or edition.build.git_refs[0] == "master"
47+
if candidate_build.git_refs[0] in ("master", "main"):
48+
if edition.build_id is None or edition.build.git_refs[0] in (
49+
"main",
50+
"master",
5151
):
5252
return True
5353

manifests/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ resources:
1010

1111
images:
1212
- name: lsstsqre/ltd-keeper
13-
newTag: 1.22.0
13+
newTag: 1.23.0

tests/test_builds.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_builds(client: TestClient, mocker: Mock) -> None:
4747
mocker.resetall()
4848

4949
e = {
50-
"tracked_refs": ["master"],
50+
"tracked_refs": ["main"],
5151
"slug": "latest",
5252
"title": "Latest",
5353
"published_url": "pipelines.lsst.io",
@@ -66,7 +66,7 @@ def test_builds(client: TestClient, mocker: Mock) -> None:
6666
b1 = {
6767
"slug": "b1",
6868
"github_requester": "jonathansick",
69-
"git_refs": ["master"],
69+
"git_refs": ["main"],
7070
}
7171
r = client.post("/products/pipelines/builds/", b1)
7272
assert r.status == 201
@@ -166,7 +166,7 @@ def test_builds(client: TestClient, mocker: Mock) -> None:
166166
# Add an auto-slugged build
167167
mocker.resetall()
168168

169-
b2 = {"git_refs": ["master"]}
169+
b2 = {"git_refs": ["main"]}
170170
r = client.post("/products/pipelines/builds/", b2)
171171

172172
assert r.status == 201
@@ -183,7 +183,7 @@ def test_builds(client: TestClient, mocker: Mock) -> None:
183183
# Add an auto-slugged build
184184
mocker.resetall()
185185

186-
b3 = {"git_refs": ["master"]}
186+
b3 = {"git_refs": ["main"]}
187187
r = client.post("/products/pipelines/builds/", b3)
188188

189189
assert r.status == 201
@@ -208,7 +208,7 @@ def test_builds(client: TestClient, mocker: Mock) -> None:
208208
# Add a build with a badly formatted git_refs
209209
mocker.resetall()
210210

211-
b5 = {"slug": "another-bad-build", "git_refs": "master"}
211+
b5 = {"slug": "another-bad-build", "git_refs": "main"}
212212
with pytest.raises(ValidationError):
213213
r = client.post("/products/pipelines/builds/", b5)
214214

tests/test_builds_v2.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_builds_v2(client: TestClient, mocker: Mock) -> None:
6262
mocker.resetall()
6363

6464
e = {
65-
"tracked_refs": ["master"],
65+
"tracked_refs": ["main"],
6666
"slug": "latest",
6767
"title": "Latest",
6868
"published_url": "pipelines.lsst.io",
@@ -81,7 +81,7 @@ def test_builds_v2(client: TestClient, mocker: Mock) -> None:
8181
b1 = {
8282
"slug": "b1",
8383
"github_requester": "jonathansick",
84-
"git_refs": ["master"],
84+
"git_refs": ["main"],
8585
}
8686
r = client.post(
8787
"/products/pipelines/builds/", b1, headers={"Accept": v2_json_type}
@@ -189,7 +189,7 @@ def test_builds_v2(client: TestClient, mocker: Mock) -> None:
189189
# Add an auto-slugged build
190190
mocker.resetall()
191191

192-
b2 = {"git_refs": ["master"]}
192+
b2 = {"git_refs": ["main"]}
193193
r = client.post("/products/pipelines/builds/", b2)
194194

195195
assert r.status == 201
@@ -206,7 +206,7 @@ def test_builds_v2(client: TestClient, mocker: Mock) -> None:
206206
# Add an auto-slugged build
207207
mocker.resetall()
208208

209-
b3 = {"git_refs": ["master"]}
209+
b3 = {"git_refs": ["main"]}
210210
r = client.post(
211211
"/products/pipelines/builds/", b3, headers={"Accept": v2_json_type}
212212
)
@@ -233,7 +233,7 @@ def test_builds_v2(client: TestClient, mocker: Mock) -> None:
233233
# Add a build with a badly formatted git_refs
234234
mocker.resetall()
235235

236-
b5 = {"slug": "another-bad-build", "git_refs": "master"}
236+
b5 = {"slug": "another-bad-build", "git_refs": "main"}
237237
with pytest.raises(ValidationError):
238238
r = client.post(
239239
"/products/pipelines/builds/", b5, headers={"Accept": v2_json_type}

tests/test_editions.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ def test_editions(client: TestClient, mocker: Mock) -> None:
5353
assert e0["pending_rebuild"] is False
5454

5555
# ========================================================================
56-
# Create a build of the 'master' branch
56+
# Create a build of the 'main' branch
5757
mocker.resetall()
5858

59-
r = client.post("/products/pipelines/builds/", {"git_refs": ["master"]})
59+
r = client.post("/products/pipelines/builds/", {"git_refs": ["main"]})
6060
b1_url = r.json["self_url"]
6161
assert r.status == 201
6262

6363
# ========================================================================
64-
# Confirm build of the 'master' branch
64+
# Confirm build of the 'main' branch
6565
mocker.resetall()
6666

6767
client.patch(b1_url, {"uploaded": True})
@@ -81,15 +81,15 @@ def test_editions(client: TestClient, mocker: Mock) -> None:
8181
r = client.patch(e0_url, {"pending_rebuild": False})
8282

8383
# ========================================================================
84-
# Create a second build of the 'master' branch
84+
# Create a second build of the 'main' branch
8585
mocker.resetall()
8686

87-
r = client.post("/products/pipelines/builds/", {"git_refs": ["master"]})
87+
r = client.post("/products/pipelines/builds/", {"git_refs": ["main"]})
8888
assert r.status == 201
8989
b2_url = r.json["self_url"]
9090

9191
# ========================================================================
92-
# Confirm second build of the 'master' branch
92+
# Confirm second build of the 'main' branch
9393
mocker.resetall()
9494

9595
client.patch(b2_url, {"uploaded": True})
@@ -109,11 +109,11 @@ def test_editions(client: TestClient, mocker: Mock) -> None:
109109
r = client.patch(e0_url, {"pending_rebuild": False})
110110

111111
# ========================================================================
112-
# Setup an edition also tracking master called 'latest'
112+
# Setup an edition also tracking main called 'latest'
113113
mocker.resetall()
114114

115115
e1 = {
116-
"tracked_refs": ["master"],
116+
"tracked_refs": ["main"],
117117
"slug": "latest",
118118
"title": "Latest",
119119
"build_url": b1_url,
@@ -181,11 +181,11 @@ def test_editions(client: TestClient, mocker: Mock) -> None:
181181
# Change the tracked_refs with PATCH
182182
mocker.resetall()
183183

184-
r = client.patch(e1_url, {"tracked_refs": ["tickets/DM-9999", "master"]})
184+
r = client.patch(e1_url, {"tracked_refs": ["tickets/DM-9999", "main"]})
185185

186186
assert r.status == 200
187187
assert r.json["tracked_refs"][0] == "tickets/DM-9999"
188-
assert r.json["tracked_refs"][1] == "master"
188+
assert r.json["tracked_refs"][1] == "main"
189189
assert r.json["pending_rebuild"] is False # no need to rebuild
190190

191191
mock_registry[
@@ -217,7 +217,7 @@ def test_editions(client: TestClient, mocker: Mock) -> None:
217217
with pytest.raises(ValidationError):
218218
r = client.post(
219219
"/products/pipelines/editions/",
220-
{"slug": "main", "tracked_refs": ["master"], "title": "Main"},
220+
{"slug": "main", "tracked_refs": ["main"], "title": "Main"},
221221
)
222222

223223

tests/test_patch_edition_mode.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_pach_lsst_doc_edition(client: TestClient, mocker: Mock) -> None:
2121
2222
1. Create a product with the default GIT_REF tracking mode for the
2323
main edition.
24-
2. Post a build on `master`; it is tracked.
24+
2. Post a build on `main`; it is tracked.
2525
3. Post a `v1.0` build; it is not tracked.
2626
4. Patch the main edition to use the LSST_DOC tracking mode.
2727
5. Post a `v1.1` build that is tracked.
@@ -53,7 +53,7 @@ def test_pach_lsst_doc_edition(client: TestClient, mocker: Mock) -> None:
5353
mock_registry["keeper.api.products.launch_task_chain"].assert_called_once()
5454

5555
# ========================================================================
56-
# Create a build on 'master'
56+
# Create a build on 'main'
5757
mocker.resetall()
5858

5959
# Get the URL for the default edition
@@ -63,20 +63,19 @@ def test_pach_lsst_doc_edition(client: TestClient, mocker: Mock) -> None:
6363
b1_data = {
6464
"slug": "b1",
6565
"github_requester": "jonathansick",
66-
"git_refs": ["master"],
66+
"git_refs": ["main"],
6767
}
6868
r = client.post(product_url + "/builds/", b1_data)
6969
b1_url = r.headers["Location"]
7070

7171
# ========================================================================
72-
# Create a build on 'master'
72+
# Confirm the build on 'main'
7373
mocker.resetall()
7474

7575
r = client.patch(b1_url, {"uploaded": True})
7676

7777
# Test that the main edition updated.
7878
r = client.get(e1_url)
79-
8079
assert r.json["build_url"] == b1_url
8180

8281
# Check pending_rebuild semaphore and manually reset it since the celery

tests/test_products.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_products(client: TestClient, mocker: Mock) -> None:
6363
r = client.get(default_ed_url)
6464
assert r.json["slug"] == "main"
6565
assert r.json["title"] == "Latest"
66-
assert r.json["tracked_refs"] == ["master"]
66+
assert r.json["tracked_refs"] == ["main"]
6767
assert r.json["published_url"] == "https://pipelines.lsst.io"
6868

6969
# ========================================================================

tests/test_track_eups_daily_tag.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ def test_eups_daily_release_edition(client: TestClient, mocker: Mock) -> None:
6464
assert r.json["pending_rebuild"] is False
6565

6666
# ========================================================================
67-
# Create a build for the 'master' branch that is not tracked
67+
# Create a build for the 'main' branch that is not tracked
6868
b2_data = {
6969
"slug": "b2",
7070
"github_requester": "jonathansick",
71-
"git_refs": ["master"],
71+
"git_refs": ["main"],
7272
}
7373
r = client.post("/products/pipelines/builds/", b2_data)
7474
b2_url = r.headers["Location"]
7575
r = client.patch(b2_url, {"uploaded": True})
7676

7777
# Test that the main edition *did not* update because this build is
78-
# neither for master not a semantic version.
78+
# neither for main not a semantic version.
7979
# with semantic versions
8080
r = client.get(edition_url)
8181
assert r.json["build_url"] == b1_url
@@ -114,7 +114,7 @@ def test_eups_daily_release_edition(client: TestClient, mocker: Mock) -> None:
114114
r = client.patch(b4_url, {"uploaded": True})
115115

116116
# Test that the main edition *did not* update because this build is
117-
# neither for master not a semantic version.
117+
# neither for main not a semantic version.
118118
# with semantic versions
119119
r = client.get(edition_url)
120120
assert r.json["build_url"] == b3_url

tests/test_track_eups_major_tag.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ def test_eups_major_release_edition(client: TestClient, mocker: Mock) -> None:
6363
assert r.json["pending_rebuild"] is False
6464

6565
# ========================================================================
66-
# Create a build for the 'master' branch that is not tracked
66+
# Create a build for the 'main' branch that is not tracked
6767
b2_data = {
6868
"slug": "b2",
6969
"github_requester": "jonathansick",
70-
"git_refs": ["master"],
70+
"git_refs": ["main"],
7171
}
7272
r = client.post("/products/pipelines/builds/", b2_data)
7373
b2_url = r.headers["Location"]
7474
r = client.patch(b2_url, {"uploaded": True})
7575

7676
# Test that the main edition *did not* update because this build is
77-
# neither for master not a semantic version.
77+
# neither for main not a semantic version.
7878
# with semantic versions
7979
r = client.get(edition_url)
8080
assert r.json["build_url"] == b1_url
@@ -113,7 +113,7 @@ def test_eups_major_release_edition(client: TestClient, mocker: Mock) -> None:
113113
r = client.patch(b4_url, {"uploaded": True})
114114

115115
# Test that the main edition *did not* update because this build is
116-
# neither for master not a semantic version.
116+
# neither for main not a semantic version.
117117
# with semantic versions
118118
r = client.get(edition_url)
119119
assert r.json["build_url"] == b3_url

tests/test_track_eups_weekly_tag.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ def test_eups_weekly_release_edition(client: TestClient, mocker: Mock) -> None:
8888
assert r.json["pending_rebuild"] is False
8989

9090
# ========================================================================
91-
# Create a build for the 'master' branch that is not tracked
91+
# Create a build for the 'main' branch that is not tracked
9292
b2_data = {
9393
"slug": "b2",
9494
"github_requester": "jonathansick",
95-
"git_refs": ["master"],
95+
"git_refs": ["main"],
9696
}
9797
r = client.post("/products/pipelines/builds/", b2_data)
9898
b2_url = r.headers["Location"]
9999
r = client.patch(b2_url, {"uploaded": True})
100100

101101
# Test that the main edition *did not* update because this build is
102-
# neither for master not a semantic version.
102+
# neither for main not a semantic version.
103103
# with semantic versions
104104
r = client.get(edition_url)
105105
assert r.json["build_url"] == b1_url
@@ -146,7 +146,7 @@ def test_eups_weekly_release_edition(client: TestClient, mocker: Mock) -> None:
146146
r = client.patch(b4_url, {"uploaded": True})
147147

148148
# Test that the main edition *did not* update because this build is
149-
# neither for master nor a semantic version.
149+
# neither for main nor a semantic version.
150150
# with semantic versions
151151
r = client.get(edition_url)
152152
assert r.json["build_url"] == b3_url

0 commit comments

Comments
 (0)