release-scope 0.5.1__tar.gz → 0.5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {release_scope-0.5.1 → release_scope-0.5.2}/PKG-INFO +18 -15
  2. {release_scope-0.5.1 → release_scope-0.5.2}/README.md +16 -13
  3. {release_scope-0.5.1 → release_scope-0.5.2}/pyproject.toml +2 -2
  4. {release_scope-0.5.1 → release_scope-0.5.2}/pyproject.toml.orig +2 -2
  5. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_candidates.py +7 -3
  6. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_static/index.html +24 -13
  7. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_use_case.py +13 -5
  8. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/__init__.py +0 -0
  9. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/__main__.py +0 -0
  10. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_cache.py +0 -0
  11. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_errors.py +0 -0
  12. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_files.py +0 -0
  13. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_gitlab.py +0 -0
  14. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_jira.py +0 -0
  15. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_jira_keys.py +0 -0
  16. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_links.py +0 -0
  17. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_messages.py +0 -0
  18. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_report.py +0 -0
  19. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_rows.py +0 -0
  20. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_settings.py +0 -0
  21. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_static/alpine.LICENSE.txt +0 -0
  22. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/_static/alpine.min.js +0 -0
  23. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/ioc.py +0 -0
  24. {release_scope-0.5.1 → release_scope-0.5.2}/release_scope/py.typed +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: release-scope
3
- Version: 0.5.1
4
- Summary: Collect what sits between production and the default branch across GitLab services: tags, MRs, Jira keys, failed jobs
3
+ Version: 0.5.2
4
+ Summary: Collect what sits between production and the default branch across GitLab services into a GitLab Pages site for picking release tags
5
5
  Keywords: release,gitlab,jira,deployments,merge-requests,ci,cli,python
6
6
  Author: Artur Shiriev
7
7
  Author-email: Artur Shiriev <me@shiriev.ru>
@@ -54,9 +54,9 @@ Description-Content-Type: text/markdown
54
54
  Jira issues, failed jobs.
55
55
 
56
56
  For every service it reads the latest successful production deployment, walks the default branch down to that
57
- commit, and writes a static site with one JSON report: a row per merge request or direct commit, newest first, with the tags that
58
- point into it, the environments running it, the Jira keys its MR mentions, and the failed jobs of its main-branch
59
- and tag pipelines. With a Jira token, it also reads the summary and status of every key in one batched search,
57
+ commit, or down to its first commit when the service was never deployed to production, and writes a static site with
58
+ one JSON report: a row per merge request or direct commit, newest first, with the tags that point into it, the
59
+ environments running it, the Jira keys its MR mentions, and the failed jobs of its main-branch and tag pipelines. With a Jira token, it also reads the summary and status of every key in one batched search,
60
60
  and the GitLab merge requests and commits linked to each issue. GitLab's Jira integration adds those links to the
61
61
  issue's Web links whenever a commit or MR mentions it; a link counts only if it starts with
62
62
  `RELEASE_SCOPE_GITLAB__ENDPOINT`. The projects they point to are the issue's related services.
@@ -120,7 +120,8 @@ The report is versioned by `schema_version`; the models live in
120
120
  Top-level `jira` is `null` without a Jira token; otherwise it holds `issues` by key (summary, status, status category,
121
121
  issue type, linked GitLab changes), the `missing` keys Jira did not return, and an `error` if a Jira request failed.
122
122
  Each service lists its `candidates`: the tags a release could ship, newest first, each with its pipeline, the number of
123
- rows it ships, the in-scope Jira keys of those rows, and the compare link from production. One row, trimmed:
123
+ rows it ships, the in-scope Jira keys of those rows, and the compare link from production, or the tag's commit history
124
+ when the service has no production deployment. One row, trimmed:
124
125
 
125
126
  ```json
126
127
  {
@@ -140,13 +141,14 @@ Besides `report.json`, `collect` writes `index.html` and its script into the out
140
141
  installed package and change only with it, so the page always matches the report schema. The page loads
141
142
  `report.json` from next to itself; it needs a web server, not a `file://` URL.
142
143
 
143
- **Services** lists every service with a production deployment, and every service that failed to collect, as one
144
- line: what production runs, the picked tag, how many merge requests or commits and Jira tasks it ships, failed jobs,
145
- and a mark when the range was cut at `RELEASE_SCOPE_MAX_COMMITS`. Opening a line shows the service's environments,
146
- warnings, merge requests that are not merged yet, and its rows with tags and their pipelines, merge requests or
147
- commits, Jira keys, environments, and failed jobs; rows out of scope are dimmed. Each tag has a **pick** button:
144
+ **Services** lists every service with a production deployment or with rows, and every service that failed to collect,
145
+ as one line: what production runs, the picked tag, how many merge requests or commits and Jira tasks it ships, failed jobs
146
+ with the ones allowed to fail counted apart, and a mark when the range was cut at `RELEASE_SCOPE_MAX_COMMITS`.
147
+ Opening a line shows the service's environments, warnings, merge requests that are not merged yet, and its rows with
148
+ tags and their pipelines, merge requests or commits, Jira keys with their status, environments, and failed jobs; rows
149
+ out of scope are dimmed. Links open in a new tab. Each tag has a **pick** button:
148
150
  picking it highlights the rows it ships and closes the line again. A `--jira` report starts with each service's
149
- release tag picked. Services without a production deployment are left out of the page.
151
+ release tag picked. Services with neither a production deployment nor rows are left out of the page.
150
152
 
151
153
  The address keeps the picks after `#`, as `team/api=2.4.0&team/web=5.12.0`, so sharing or reloading the page keeps
152
154
  them. An address with picks replaces the release tags of a `--jira` report; picks that are not in the report, such as
@@ -157,10 +159,11 @@ reload starts from the release tags again.
157
159
  text box to copy from by hand, since browsers allow the copy button only over HTTPS:
158
160
 
159
161
  - **Jira tasks**: the keys of every in-scope row from each picked tag down to production, without duplicates, with
160
- summary and status, flagging issues that are not done. Copy them one per line or as a JQL `key in (...)` clause,
161
- each in its own box.
162
+ summary and a status badge: grey to do, blue in progress, green done. Copy them one per line or as a JQL
163
+ `key in (...)` clause, each in its own box.
162
164
  - **Tag pipelines**: the pipeline of each picked tag, as a Markdown list.
163
- - **Compare**: a GitLab compare link per service from production to the picked tag, as a Markdown list.
165
+ - **Compare**: a GitLab compare link per service from production to the picked tag, as a Markdown list. A service
166
+ never deployed to production gets the commit history of the tag instead.
164
167
  - **Release post**: one Markdown text with a line per picked tag, holding its compare link and pipeline, followed by
165
168
  the Jira tasks with their summaries.
166
169
 
@@ -21,9 +21,9 @@
21
21
  Jira issues, failed jobs.
22
22
 
23
23
  For every service it reads the latest successful production deployment, walks the default branch down to that
24
- commit, and writes a static site with one JSON report: a row per merge request or direct commit, newest first, with the tags that
25
- point into it, the environments running it, the Jira keys its MR mentions, and the failed jobs of its main-branch
26
- and tag pipelines. With a Jira token, it also reads the summary and status of every key in one batched search,
24
+ commit, or down to its first commit when the service was never deployed to production, and writes a static site with
25
+ one JSON report: a row per merge request or direct commit, newest first, with the tags that point into it, the
26
+ environments running it, the Jira keys its MR mentions, and the failed jobs of its main-branch and tag pipelines. With a Jira token, it also reads the summary and status of every key in one batched search,
27
27
  and the GitLab merge requests and commits linked to each issue. GitLab's Jira integration adds those links to the
28
28
  issue's Web links whenever a commit or MR mentions it; a link counts only if it starts with
29
29
  `RELEASE_SCOPE_GITLAB__ENDPOINT`. The projects they point to are the issue's related services.
@@ -87,7 +87,8 @@ The report is versioned by `schema_version`; the models live in
87
87
  Top-level `jira` is `null` without a Jira token; otherwise it holds `issues` by key (summary, status, status category,
88
88
  issue type, linked GitLab changes), the `missing` keys Jira did not return, and an `error` if a Jira request failed.
89
89
  Each service lists its `candidates`: the tags a release could ship, newest first, each with its pipeline, the number of
90
- rows it ships, the in-scope Jira keys of those rows, and the compare link from production. One row, trimmed:
90
+ rows it ships, the in-scope Jira keys of those rows, and the compare link from production, or the tag's commit history
91
+ when the service has no production deployment. One row, trimmed:
91
92
 
92
93
  ```json
93
94
  {
@@ -107,13 +108,14 @@ Besides `report.json`, `collect` writes `index.html` and its script into the out
107
108
  installed package and change only with it, so the page always matches the report schema. The page loads
108
109
  `report.json` from next to itself; it needs a web server, not a `file://` URL.
109
110
 
110
- **Services** lists every service with a production deployment, and every service that failed to collect, as one
111
- line: what production runs, the picked tag, how many merge requests or commits and Jira tasks it ships, failed jobs,
112
- and a mark when the range was cut at `RELEASE_SCOPE_MAX_COMMITS`. Opening a line shows the service's environments,
113
- warnings, merge requests that are not merged yet, and its rows with tags and their pipelines, merge requests or
114
- commits, Jira keys, environments, and failed jobs; rows out of scope are dimmed. Each tag has a **pick** button:
111
+ **Services** lists every service with a production deployment or with rows, and every service that failed to collect,
112
+ as one line: what production runs, the picked tag, how many merge requests or commits and Jira tasks it ships, failed jobs
113
+ with the ones allowed to fail counted apart, and a mark when the range was cut at `RELEASE_SCOPE_MAX_COMMITS`.
114
+ Opening a line shows the service's environments, warnings, merge requests that are not merged yet, and its rows with
115
+ tags and their pipelines, merge requests or commits, Jira keys with their status, environments, and failed jobs; rows
116
+ out of scope are dimmed. Links open in a new tab. Each tag has a **pick** button:
115
117
  picking it highlights the rows it ships and closes the line again. A `--jira` report starts with each service's
116
- release tag picked. Services without a production deployment are left out of the page.
118
+ release tag picked. Services with neither a production deployment nor rows are left out of the page.
117
119
 
118
120
  The address keeps the picks after `#`, as `team/api=2.4.0&team/web=5.12.0`, so sharing or reloading the page keeps
119
121
  them. An address with picks replaces the release tags of a `--jira` report; picks that are not in the report, such as
@@ -124,10 +126,11 @@ reload starts from the release tags again.
124
126
  text box to copy from by hand, since browsers allow the copy button only over HTTPS:
125
127
 
126
128
  - **Jira tasks**: the keys of every in-scope row from each picked tag down to production, without duplicates, with
127
- summary and status, flagging issues that are not done. Copy them one per line or as a JQL `key in (...)` clause,
128
- each in its own box.
129
+ summary and a status badge: grey to do, blue in progress, green done. Copy them one per line or as a JQL
130
+ `key in (...)` clause, each in its own box.
129
131
  - **Tag pipelines**: the pipeline of each picked tag, as a Markdown list.
130
- - **Compare**: a GitLab compare link per service from production to the picked tag, as a Markdown list.
132
+ - **Compare**: a GitLab compare link per service from production to the picked tag, as a Markdown list. A service
133
+ never deployed to production gets the commit history of the tag instead.
131
134
  - **Release post**: one Markdown text with a line per picked tag, holding its compare link and pipeline, followed by
132
135
  the Jira tasks with their summaries.
133
136
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "release-scope"
3
- description = "Collect what sits between production and the default branch across GitLab services: tags, MRs, Jira keys, failed jobs"
3
+ description = "Collect what sits between production and the default branch across GitLab services into a GitLab Pages site for picking release tags"
4
4
  requires-python = ">=3.11,<4"
5
5
  license = "MIT"
6
6
  readme = "README.md"
@@ -25,7 +25,7 @@ classifiers = [
25
25
  "Typing :: Typed",
26
26
  "Topic :: Software Development :: Build Tools",
27
27
  ]
28
- version = "0.5.1"
28
+ version = "0.5.2"
29
29
  dependencies = [
30
30
  "typer>=0.13",
31
31
  "pydantic>=2; python_version < '3.12'",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "release-scope"
3
- description = "Collect what sits between production and the default branch across GitLab services: tags, MRs, Jira keys, failed jobs"
3
+ description = "Collect what sits between production and the default branch across GitLab services into a GitLab Pages site for picking release tags"
4
4
  authors = [{ name = "Artur Shiriev", email = "me@shiriev.ru" }]
5
5
  requires-python = ">=3.11,<4"
6
6
  license = "MIT"
@@ -17,7 +17,7 @@ classifiers = [
17
17
  "Typing :: Typed",
18
18
  "Topic :: Software Development :: Build Tools",
19
19
  ]
20
- version = "0.5.1"
20
+ version = "0.5.2"
21
21
  dependencies = [
22
22
  "typer>=0.13",
23
23
  # The first release whose pydantic-core ships a wheel for each interpreter.
@@ -3,8 +3,10 @@ from urllib.parse import quote
3
3
  from release_scope._report import Candidate, EnvironmentState, Service
4
4
 
5
5
 
6
- def build_candidates(service: Service, production: EnvironmentState) -> list[Candidate]:
7
- base: str = quote(production.ref if production.tag else production.sha)
6
+ def build_candidates(service: Service, production: EnvironmentState | None) -> list[Candidate]:
7
+ base: str | None = None
8
+ if production is not None:
9
+ base = quote(production.ref if production.tag else production.sha)
8
10
  candidates: list[Candidate] = []
9
11
  for index, row in enumerate(service.rows):
10
12
  shipped = service.rows[index:]
@@ -12,7 +14,9 @@ def build_candidates(service: Service, production: EnvironmentState) -> list[Can
12
14
  candidates.extend(
13
15
  Candidate(
14
16
  tag=tag,
15
- compare_url=f"{service.project_url}/-/compare/{base}...{quote(tag.name)}",
17
+ compare_url=f"{service.project_url}/-/compare/{base}...{quote(tag.name)}"
18
+ if base
19
+ else f"{service.project_url}/-/commits/{quote(tag.name)}",
16
20
  rows=len(shipped),
17
21
  jira_keys=list(keys.values()),
18
22
  )
@@ -4,18 +4,19 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>Release scope</title>
7
+ <base target="_blank">
7
8
  <script>
8
9
  if (!/(\/|\.html)$/.test(location.pathname)) location.replace(location.pathname + "/" + location.search + location.hash);
9
10
  </script>
10
11
  <style>
11
12
  :root {
12
13
  --bg: #ffffff; --fg: #1f2328; --muted: #656d76; --border: #d0d7de; --panel: #f6f8fa;
13
- --accent: #0969da; --bad: #cf222e; --warn: #9a6700;
14
+ --accent: #0969da; --bad: #cf222e; --warn: #9a6700; --good: #1a7f37;
14
15
  }
15
16
  @media (prefers-color-scheme: dark) {
16
17
  :root {
17
18
  --bg: #0d1117; --fg: #e6edf3; --muted: #8d96a0; --border: #30363d; --panel: #161b22;
18
- --accent: #4493f8; --bad: #f85149; --warn: #d29922;
19
+ --accent: #4493f8; --bad: #f85149; --warn: #d29922; --good: #3fb950;
19
20
  }
20
21
  }
21
22
  [x-cloak] { display: none !important; }
@@ -58,6 +59,10 @@
58
59
  .service .body { padding: 8px 12px; }
59
60
  .service .body > p:first-child { margin-top: 0; }
60
61
  .picked-tag { font-weight: 600; }
62
+ .status { display: inline-block; padding: 0 8px; border: 1px solid currentColor; border-radius: 10px; font-size: 12px;
63
+ font-weight: 600; white-space: nowrap; color: var(--muted); }
64
+ .status-indeterminate { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
65
+ .status-done { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
61
66
  button.picked { border-color: var(--accent); color: var(--accent); }
62
67
  </style>
63
68
  </head>
@@ -76,7 +81,8 @@
76
81
  <template x-for="key in report.jira_scope" :key="key">
77
82
  <li>
78
83
  <a :href="issue(key) && issue(key).url" x-text="key"></a>
79
- <span x-text="issue(key) ? issue(key).summary + ' · ' + issue(key).status : 'not found in Jira'"></span>
84
+ <span x-show="issue(key)" :class="statusClass(issue(key))" x-text="issue(key) && issue(key).status"></span>
85
+ <span x-text="issue(key) ? issue(key).summary : 'not found in Jira'"></span>
80
86
  </li>
81
87
  </template>
82
88
  </ul>
@@ -87,7 +93,7 @@
87
93
  <h2>Services</h2>
88
94
  <p x-show="pickable.length" class="muted">Open a service and pick the tag to release: it ships every merge request and commit from its row down to production. The address keeps the picks, so share it to share them.</p>
89
95
  <p x-show="ignored" class="warn" x-text="ignored"></p>
90
- <template x-for="service in deployed" :key="service.project">
96
+ <template x-for="service in listed" :key="service.project">
91
97
  <details class="service" name="services">
92
98
  <summary>
93
99
  <span class="name" x-text="service.project"></span>
@@ -157,7 +163,8 @@
157
163
  <template x-for="key in row.jira_keys" :key="key.key">
158
164
  <div>
159
165
  <a :href="key.url" x-text="key.key"></a>
160
- <span x-text="issue(key.key) ? issue(key.key).summary + ' · ' + issue(key.key).status : ''"></span>
166
+ <span x-show="issue(key.key)" :class="statusClass(issue(key.key))" x-text="issue(key.key) && issue(key.key).status"></span>
167
+ <span x-text="issue(key.key) ? issue(key.key).summary : ''"></span>
161
168
  </div>
162
169
  </template>
163
170
  </td>
@@ -167,7 +174,7 @@
167
174
  <div>
168
175
  <span x-text="line.label"></span>
169
176
  <a :href="line.url" x-text="line.name"></a>
170
- <span x-show="line.allowed" class="muted">(allowed)</span>
177
+ <span x-show="line.allowed" class="muted">(allowed to fail)</span>
171
178
  </div>
172
179
  </template>
173
180
  </td>
@@ -201,8 +208,8 @@
201
208
  <template x-for="task in tasks" :key="task.key">
202
209
  <li>
203
210
  <a :href="task.url" x-text="task.key"></a>
204
- <span x-text="task.issue ? task.issue.summary + ' · ' + task.issue.status : ''"></span>
205
- <span x-show="task.issue && task.issue.status_category !== 'done'" class="warn">not done</span>
211
+ <span x-show="task.issue" :class="statusClass(task.issue)" x-text="task.issue && task.issue.status"></span>
212
+ <span x-text="task.issue ? task.issue.summary : ''"></span>
206
213
  <span x-show="isMissing(task.key)" class="warn">not found in Jira</span>
207
214
  </li>
208
215
  </template>
@@ -291,11 +298,11 @@
291
298
  get collectedAt() {
292
299
  return this.report.collected_at.slice(0, 16).replace("T", " ");
293
300
  },
294
- get deployed() {
295
- return this.report.services.filter((service) => service.error || this.production(service));
301
+ get listed() {
302
+ return this.report.services.filter((service) => service.error || this.production(service) || service.rows.length);
296
303
  },
297
304
  get pickable() {
298
- return this.deployed.filter((service) => service.candidates.length);
305
+ return this.listed.filter((service) => service.candidates.length);
299
306
  },
300
307
  get problems() {
301
308
  const jira = this.report.jira;
@@ -411,6 +418,9 @@
411
418
  issue(key) {
412
419
  return this.report.jira ? this.report.jira.issues[key] : undefined;
413
420
  },
421
+ statusClass(issue) {
422
+ return issue ? `status status-${issue.status_category || "new"}` : "";
423
+ },
414
424
  isMissing(key) {
415
425
  return Boolean(this.report.jira && this.report.jira.missing.includes(key));
416
426
  },
@@ -422,10 +432,11 @@
422
432
  },
423
433
  productionRef(service) {
424
434
  const production = this.production(service);
425
- if (!production) return "";
435
+ if (!production) return "not in production";
426
436
  return production.tag ? production.ref : production.sha.slice(0, 8);
427
437
  },
428
438
  compareLabel({ service, candidate }) {
439
+ if (!this.production(service)) return `commits to ${candidate.tag.name}`;
429
440
  return `${this.productionRef(service)}...${candidate.tag.name}`;
430
441
  },
431
442
  pipelineIcon(pipeline) {
@@ -439,7 +450,7 @@
439
450
  const jobs = pipelines.filter(Boolean).flatMap((pipeline) => pipeline.failed_jobs);
440
451
  const allowed = jobs.filter((job) => job.allow_failure).length;
441
452
  const blocking = jobs.length - allowed;
442
- return [blocking ? `❌ ${blocking}` : "", allowed ? `⚠️ ${allowed} allowed` : ""].filter(Boolean).join(" · ");
453
+ return [blocking ? `❌ ${blocking} failed` : "", allowed ? `${allowed} failed, allowed to fail` : ""].filter(Boolean).join(" · ");
443
454
  },
444
455
  failedJobs(row) {
445
456
  const lines = [];
@@ -251,10 +251,14 @@ class CollectUseCase:
251
251
  service.warnings.append("Project has no default branch.")
252
252
  return service
253
253
  if production is None:
254
- service.warnings.append(f"No successful deployment to '{self.settings.production_environment}'.")
255
- return service
254
+ service.warnings.append(
255
+ f"No successful deployment to '{self.settings.production_environment}'; "
256
+ f"rows run from the first commit of {project.default_branch}."
257
+ )
256
258
 
257
- walk: typing.Final = self._walk(project, project.default_branch, production.sha, service, cache)
259
+ walk: typing.Final = self._walk(
260
+ project, project.default_branch, production.sha if production else None, service, cache
261
+ )
258
262
  drafts, linked, in_scope = walk.drafts, [False] * len(walk.drafts), [True] * len(walk.drafts)
259
263
  if links is not None:
260
264
  drafts, linked, in_scope = self._scope_rows(project, project.default_branch, service, walk, links, cache)
@@ -272,9 +276,13 @@ class CollectUseCase:
272
276
  service.candidates.extend(build_candidates(service, production))
273
277
  return service
274
278
 
275
- def _walk(self, project: Project, default_branch: str, baseline: str, service: Service, cache: Cache) -> _Walk:
279
+ def _walk(
280
+ self, project: Project, default_branch: str, baseline: str | None, service: Service, cache: Cache
281
+ ) -> _Walk:
276
282
  commits, truncated = self.api.list_first_parent_commits(
277
- project.id, f"{baseline}..{default_branch}", max_items=self.settings.max_commits
283
+ project.id,
284
+ f"{baseline}..{default_branch}" if baseline else default_branch,
285
+ max_items=self.settings.max_commits,
278
286
  )
279
287
  walk: typing.Final = _Walk(truncated=truncated)
280
288
  service.truncated = truncated