You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/09/07 05:42:13 UTC
(opendal) 01/01: feat(release): prepare weekly ATR source candidates
This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch xuanwo/weekly-source-release
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 34c4a7d9b3d709eec1bff30ed287bd4bd38a9f50
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Mon Sep 7 13:41:54 2026 +0800
feat(release): prepare weekly ATR source candidates
---
.github/scripts/weekly_release/atr.py | 87 +++
.github/scripts/weekly_release/controller.py | 586 +++++++++++++++++++++
.github/scripts/weekly_release/github.py | 115 ++++
.github/scripts/weekly_release/model.py | 134 +++++
.github/scripts/weekly_release/prepare.py | 158 ++++++
.github/scripts/weekly_release/runtime.py | 124 +++++
.../scripts/weekly_release/test_weekly_release.py | 485 +++++++++++++++++
.github/workflows/ci_check.yml | 1 +
.github/workflows/ci_odev.yml | 1 +
.github/workflows/ci_weekly_release.yml | 41 ++
.github/workflows/release-compose.yml | 47 +-
.github/workflows/weekly_release.yml | 118 +++++
.release/config.json | 9 +
dev/src/generate/dotnet.rs | 6 +-
dev/src/main.rs | 8 +-
dev/src/release/bump.rs | 17 +-
dev/src/release/mod.rs | 4 +-
website/community/release/weekly.md | 209 ++++++++
18 files changed, 2138 insertions(+), 12 deletions(-)
diff --git a/.github/scripts/weekly_release/atr.py b/.github/scripts/weekly_release/atr.py
new file mode 100644
index 0000000000..ca9a72582c
--- /dev/null
+++ b/.github/scripts/weekly_release/atr.py
@@ -0,0 +1,87 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Read public ATR state and prepare the RM-owned vote request."""
+
+import json
+from urllib.error import HTTPError
+from urllib.request import Request, urlopen
+
+
+class ATR:
+ def request(self, path):
+ req = Request("https://releases.apache.org/api" + path)
+ try:
+ with urlopen(req, timeout=60) as response:
+ return json.load(response)
+ except HTTPError as error:
+ if error.code == 404:
+ return None
+ raise RuntimeError(f"ATR {path} returned HTTP {error.code}") from None
+
+ def release(self, version):
+ data = self.request(f"/release/get/opendal/{version}")
+ return data["release"] if data else None
+
+ def checks(self, version, revision):
+ result = []
+ offset = 0
+ while True:
+ data = self.request(
+ f"/checks/list/opendal/{version}/{revision}?limit=1000&offset={offset}"
+ )
+ if data is None:
+ raise ValueError("ATR check revision not found")
+ result.extend(data["checks"])
+ offset += len(data["checks"])
+ if offset >= data["count"]:
+ return result
+ if not data["checks"]:
+ raise ValueError("ATR checks pagination made no progress")
+
+
+def vote_payload(record, revision, concerns):
+ rehearsal = record["dry_run"]
+ label = "[REHEARSAL] " if rehearsal else ""
+ body = (
+ f"Hello OpenDAL community,\n\n{label}Please review OpenDAL {record['version']} "
+ f"candidate {record['rc']}, ATR revision {revision}.\n\n"
+ f"Candidate: https://releases.apache.org/vote/opendal/{record['atr_version']}\n"
+ f"Source commit: {record['candidate_sha']}\n"
+ "KEYS: https://downloads.apache.org/opendal/KEYS\n\n"
+ "Independently rebuild and verify the source archives on trusted hardware. "
+ "Record your verification evidence and cast your own ballot through ATR's "
+ "website or API. GitHub comments and email replies are discussion only, "
+ "not Trusted Vote ballots. The vote stays open for at least 72 hours.\n"
+ )
+ if rehearsal:
+ body += "\nThis is a rehearsal only. No official publication is authorized.\n"
+ else:
+ body += "\nA passing vote authorizes ATR to publish these exact source files automatically.\n"
+ return {
+ "project": "opendal",
+ "version": record["atr_version"],
+ "revision": revision,
+ "email_to": "dev@opendal.apache.org",
+ "vote_duration": 72,
+ "subject": f"[VOTE] {label}Release Apache OpenDAL {record['rc']}",
+ "body": body,
+ "concerns_noted": sorted(set(concerns)),
+ "notify_when_finished": True,
+ "automatic_resolve_when_finished": True,
+ "automatic_publish_when_resolved": not rehearsal,
+ }
diff --git a/.github/scripts/weekly_release/controller.py b/.github/scripts/weekly_release/controller.py
new file mode 100644
index 0000000000..1f55cd857c
--- /dev/null
+++ b/.github/scripts/weekly_release/controller.py
@@ -0,0 +1,586 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Resume a weekly source release from persisted state; never wait on a runner."""
+
+import argparse
+import base64
+import datetime as dt
+import hashlib
+import io
+import json
+import os
+import zipfile
+from pathlib import Path
+
+from atr import ATR, vote_payload
+from github import ensure_ref, ref, reminder
+from model import (
+ canonical,
+ cutoff,
+ cycle_id,
+ next_rc,
+ plan_versions,
+ timestamp,
+ version_tuple,
+ versions,
+)
+from prepare import PACKAGE_FILE, candidate, sync_main
+from runtime import Store, api, config, download, git, run
+
+TERMINAL = {"released", "rehearsed", "cancelled", "skipped"}
+
+
+def now():
+ return dt.datetime.now(dt.timezone.utc)
+
+
+def initial_state(cfg):
+ tag = cfg["baseline_tag"]
+ version_tuple(tag.removeprefix("v"))
+ # A Git tag alone does not establish that the baseline was published.
+ download(f"https://downloads.apache.org/opendal/{tag.removeprefix('v')}/")
+ return {
+ "schema": 1,
+ "baseline": {
+ "tag": tag,
+ "sha": git("rev-parse", tag + "^{commit}"),
+ "versions": versions(git("show", f"{tag}:{PACKAGE_FILE}")),
+ },
+ "candidates": {},
+ }
+
+
+def load_state(store, cfg):
+ if ref(cfg["repository"], "heads/" + cfg["state_branch"]):
+ return store.load()
+ state = initial_state(cfg)
+ repo = cfg["repository"]
+ blob = api(
+ f"repos/{repo}/git/blobs",
+ {"content": base64.b64encode(canonical(state)).decode(), "encoding": "base64"},
+ )
+ tree = api(
+ f"repos/{repo}/git/trees",
+ {
+ "tree": [
+ {
+ "path": "state.json",
+ "mode": "100644",
+ "type": "blob",
+ "sha": blob["sha"],
+ }
+ ]
+ },
+ )
+ commit = api(
+ f"repos/{repo}/git/commits",
+ {
+ "message": "Initialize weekly release state",
+ "tree": tree["sha"],
+ "parents": [],
+ },
+ )
+ ensure_ref(repo, "heads/" + cfg["state_branch"], commit["sha"])
+ return store.load()
+
+
+def cutoff_commit(cfg, when):
+ # Push workflow runs retain the server timestamp and head even if their job
+ # was queued or cancelled. Commit author/committer dates are not push times.
+ repo = cfg["repository"]
+ runs = []
+ for page in range(1, 101):
+ data = api(
+ f"repos/{repo}/actions/workflows/weekly_release.yml/runs?event=push&branch=main&per_page=100&page={page}"
+ )
+ part = data["workflow_runs"]
+ runs.extend(r for r in part if timestamp(r["created_at"]) <= when)
+ if runs or len(part) < 100:
+ break
+ if not runs:
+ raise ValueError(
+ "no main push snapshot exists before the cutoff; wait for the next week or run a rehearsal"
+ )
+ return max(runs, key=lambda r: (r["created_at"], r["id"]))["head_sha"]
+
+
+def plan(state, cfg, dry_run=False):
+ when = now() if dry_run else cutoff(now())
+ identity = (
+ ("rehearsal-" + os.environ["GITHUB_RUN_ID"]) if dry_run else cycle_id(when)
+ )
+ if identity in state["candidates"]:
+ return
+ baseline = state["baseline"]
+ sha = git("rev-parse", "origin/main") if dry_run else cutoff_commit(cfg, when)
+ comparison = baseline.get("cutoff_sha", baseline["sha"])
+ git("merge-base", "--is-ancestor", comparison, sha)
+ synced = set()
+ for previous in state["candidates"].values():
+ if previous.get("sync_number"):
+ pr = api(f"repos/{cfg['repository']}/pulls/{previous['sync_number']}")
+ if pr["merged"]:
+ synced.add(pr["merge_commit_sha"])
+ commits = git("rev-list", "--first-parent", f"{comparison}..{sha}").splitlines()
+ paths = []
+ for commit in commits:
+ if commit not in synced:
+ paths.extend(
+ git(
+ "diff",
+ "--name-only",
+ commit + "^",
+ commit,
+ "--",
+ "core",
+ "bindings",
+ "integrations",
+ "LICENSE",
+ "NOTICE",
+ ).splitlines()
+ )
+ if not paths:
+ state["candidates"][identity] = {"id": identity, "phase": "skipped"}
+ return
+ inventory = versions(git("show", f"{sha}:{PACKAGE_FILE}"))
+ # New declarations are compatibility input. Existing declarations remain
+ # immutable, so publication consumes them by moving the successful baseline.
+ changes = []
+ for path in git(
+ "diff",
+ "--diff-filter=A",
+ "--name-only",
+ comparison,
+ sha,
+ "--",
+ ".release/changes",
+ ).splitlines():
+ if path.endswith(".json"):
+ changes.append(json.loads(git("show", f"{sha}:{path}")))
+ # All packages are released together. Explicit larger versions already
+ # reviewed in package.rs and release declarations take precedence.
+ changes.append(
+ {
+ "summary": f"[Changes since {baseline['tag']}](https://github.com/{cfg['repository']}/compare/{baseline['tag']}...{sha})",
+ "packages": {p: "patch" for p in inventory},
+ }
+ )
+ targets = plan_versions(baseline["versions"], inventory, changes)
+ targets = {p: max(v, inventory[p], key=version_tuple) for p, v in targets.items()}
+ tags = git("tag", "--list").splitlines()
+ tags += [r["rc"] for r in state["candidates"].values() if "rc" in r]
+ rc = next_rc(targets["core"], tags)
+ state["candidates"][identity] = {
+ "id": identity,
+ "phase": "preparing",
+ "dry_run": dry_run,
+ "cutoff": when.isoformat(),
+ "cutoff_sha": sha,
+ "baseline_tag": baseline["tag"],
+ "versions": targets,
+ "version": targets["core"],
+ "rc": rc,
+ "atr_version": rc.removeprefix("v"),
+ "branch": f"release-candidates/{identity.lower()}",
+ "changes": changes,
+ "dispatches": {},
+ }
+
+
+def workflow(record, cfg, filename, inputs, persist):
+ repo = cfg["repository"]
+ data = api(
+ f"repos/{repo}/actions/workflows/{filename}/runs?event=workflow_dispatch&head_sha={record['candidate_sha']}&per_page=100"
+ )
+ intent = record["dispatches"].get(filename)
+ runs = [
+ r
+ for r in data["workflow_runs"]
+ if r["head_branch"] == record["branch"]
+ and r["head_sha"] == record["candidate_sha"]
+ and intent
+ and timestamp(r["created_at"]) >= timestamp(intent)
+ ]
+ if runs:
+ run = max(runs, key=lambda r: (r["id"], r["run_attempt"]))
+ if run["status"] != "completed":
+ return None
+ if run["conclusion"] != "success":
+ raise ValueError(
+ f"{filename} failed: {run['html_url']}; rerun the failed workflow"
+ )
+ return run
+ if intent:
+ # A lost dispatch response is not permission to create a second upload.
+ raise ValueError(
+ f"awaiting {filename} dispatch recorded at {intent}; if no run exists, use retry-dispatch"
+ )
+ if ref(repo, "heads/" + record["branch"]) != record["candidate_sha"]:
+ raise ValueError("release branch moved after candidate freeze")
+ record["dispatches"][filename] = now().replace(microsecond=0).isoformat()
+ persist()
+ api(
+ f"repos/{repo}/actions/workflows/{filename}/dispatches",
+ {"ref": record["branch"], "inputs": inputs},
+ )
+ return None
+
+
+def expected_paths(record):
+ return {
+ f"{record['version']}/apache-opendal-{p.replace('/', '-')}-{v}-src.tar.gz{suffix}"
+ for p, v in record["versions"].items()
+ for suffix in ("", ".asc", ".sha512")
+ }
+
+
+def output(**values):
+ with open(os.environ["GITHUB_OUTPUT"], "a") as file:
+ file.writelines(f"{key}={value}\n" for key, value in values.items())
+
+
+def signed_checksums(record, cfg):
+ endpoint = (
+ f"repos/{cfg['repository']}/actions/runs/{record['compose_run']}/artifacts"
+ )
+ artifacts = api(endpoint)["artifacts"]
+ name = f"signed-source-{record['compose_run']}-{record['compose_attempt']}"
+ matches = [a for a in artifacts if a["name"] == name and not a["expired"]]
+ if len(matches) != 1:
+ raise ValueError("missing immutable signed artifact")
+ record["signed_artifact"] = matches[0]["id"]
+ raw = run(
+ "gh",
+ "api",
+ f"repos/{cfg['repository']}/actions/artifacts/{matches[0]['id']}/zip",
+ )
+ with zipfile.ZipFile(io.BytesIO(raw)) as archive:
+ names = archive.namelist()
+ expected = expected_paths(record)
+ if (
+ len(names) != len(set(names))
+ or {record["version"] + "/" + n for n in names} != expected
+ ):
+ raise ValueError("signed CI artifact inventory differs")
+ return {
+ record["version"] + "/" + n: hashlib.sha512(archive.read(n)).hexdigest()
+ for n in names
+ }
+
+
+def published_files(record):
+ # Check the distribution area itself; vote resolution is not publication.
+ for path, digest in record["checksums"].items():
+ data = download("https://downloads.apache.org/opendal/" + path)
+ if hashlib.sha512(data).hexdigest() != digest:
+ raise ValueError(f"published bytes differ from the voted candidate: {path}")
+
+
+def capture_files(record, atr):
+ from hashlib import sha512
+
+ path = f"/release/paths/opendal/{record['atr_version']}/{record['revision']}"
+ value = atr.request(path)
+ if value is None or set(value["rel_paths"]) != expected_paths(record):
+ raise ValueError(
+ "ATR candidate inventory differs from the expected signed source bundle"
+ )
+ # Download pinned bytes only after ATR has made the candidate public for voting.
+ # The candidate API and vote revision are rechecked before and after downloads.
+ result = {}
+ for name in value["rel_paths"]:
+ # The download/path route serves the currently frozen voting revision.
+ raw = download(
+ f"https://releases.apache.org/download/path/opendal/{record['atr_version']}/{name}"
+ )
+ result[name] = sha512(raw).hexdigest()
+ release = atr.release(record["atr_version"])
+ if (
+ release["latest_revision_number"] != record["revision"]
+ or release["phase"] != "release_candidate"
+ ):
+ raise ValueError("ATR candidate changed while recording vote artifacts")
+ if result != record["checksums"]:
+ raise ValueError(
+ "ATR bytes differ from the signed CI artifact; RM must cancel the vote in ATR"
+ )
+ record["verified_vote_files"] = True
+
+
+def reconcile(record, state, cfg, atr, persist):
+ phase = record["phase"]
+ repo = cfg["repository"]
+ if phase == "preparing":
+ pr = candidate(record, cfg)
+ record.update(phase="reviewing", bump_pr=pr["number"], bump_url=pr["html_url"])
+ elif phase == "reviewing":
+ pr = api(f"repos/{repo}/pulls/{record['bump_pr']}")
+ if not pr["merged"]:
+ if pr["state"] == "closed":
+ record["phase"] = "cancelled"
+ return
+ sha = pr["merge_commit_sha"]
+ git("fetch", "origin", record["branch"])
+ git("merge-base", "--is-ancestor", record["cutoff_sha"], sha)
+ actual = versions(git("show", f"{sha}:{PACKAGE_FILE}"))
+ if actual != record["versions"]:
+ raise ValueError(
+ "merged version plan differs; cancel and prepare a new candidate"
+ )
+ record.update(candidate_sha=sha, phase="checking")
+ elif phase == "checking":
+ # Reconcile the tag on every retry, including a lost creation response.
+ ensure_ref(repo, "tags/" + record["rc"], record["candidate_sha"])
+ for filename in cfg["validation_workflows"]:
+ if not workflow(record, cfg, filename, {}, persist):
+ return
+ record["phase"] = "composing"
+ elif phase == "composing":
+ run_id = int(os.environ["GITHUB_RUN_ID"])
+ if "compose_run" not in record:
+ if ref(repo, "heads/" + record["branch"]) != record["candidate_sha"]:
+ raise ValueError("release branch moved after candidate freeze")
+ record["compose_run"] = run_id
+ persist()
+ if record["compose_run"] == run_id:
+ # workflow_call retains the initiating actor for ATR OIDC. A bot
+ # dispatch would replace it with github-actions[bot].
+ output(
+ compose="true",
+ candidate=record["candidate_sha"],
+ rc=record["atr_version"],
+ )
+ return
+ build = api(f"repos/{repo}/actions/runs/{record['compose_run']}")
+ if build["status"] != "completed":
+ return
+ if build["conclusion"] != "success":
+ raise ValueError(
+ f"compose failed: {build['html_url']}; rerun all jobs of that run"
+ )
+ record.update(phase="staged", compose_attempt=build["run_attempt"])
+ elif phase == "staged":
+ release = atr.release(record["atr_version"])
+ if not release or release["phase"] != "release_candidate_draft":
+ raise ValueError("expected the uploaded ATR draft")
+ revision = release["latest_revision_number"]
+ ongoing = atr.request(
+ f"/checks/ongoing/opendal/{record['atr_version']}/{revision}"
+ )
+ if ongoing["ongoing"]:
+ return
+ checks = atr.checks(record["atr_version"], revision)
+ if any(c["status"] == "blocker" for c in checks):
+ raise ValueError("ATR refuses to start a vote while blockers exist")
+ policy = atr.request("/policy/get/opendal")
+ if policy["policy_vote_mode"] != "trusted":
+ raise ValueError("OpenDAL must use ATR Trusted Vote")
+ record["checksums"] = signed_checksums(record, cfg)
+ record["revision"] = revision
+ paths = atr.request(
+ f"/release/paths/opendal/{record['atr_version']}/{revision}"
+ )
+ if set(paths["rel_paths"]) != expected_paths(record):
+ raise ValueError("unexpected ATR files or publication layout")
+ # OpenDAL's own validation workflows determine quality. ATR concerns are
+ # acknowledged as requested, rather than becoming another approval gate.
+ record["vote_request"] = vote_payload(
+ record,
+ revision,
+ [c["checker"] for c in checks if c["status"] in {"concern", "exception"}],
+ )
+ record["phase"] = "awaiting-vote"
+ elif phase == "awaiting-vote":
+ release = atr.release(record["atr_version"])
+ if not release or release["latest_revision_number"] != record["revision"]:
+ raise ValueError(
+ "ATR candidate changed; cancel and prepare a new candidate"
+ )
+ if release["phase"] == "release_candidate_draft":
+ record["attention"] = (
+ "RM: review vote-request.json and start the 72-hour Trusted Vote in ATR."
+ )
+ return
+ if release["phase"] not in {"release_candidate", "release_preview", "release"}:
+ raise ValueError("unexpected ATR vote state")
+ if release["vote_mode"] != "trusted" or not release["vote_started"]:
+ raise ValueError("ATR vote does not match the prepared Trusted Vote")
+ record.pop("attention", None)
+ record["phase"] = "voting"
+ elif phase == "voting":
+ release = atr.release(record["atr_version"])
+ if release is None:
+ raise ValueError("ATR candidate disappeared; RM must reconcile")
+ if release["phase"] == "release_candidate_draft":
+ record["phase"] = "cancelled"
+ return
+ if not record.get("discussion"):
+ record["discussion"] = reminder(repo, record)
+ if release["phase"] == "release_candidate":
+ if not record.get("verified_vote_files"):
+ capture_files(record, atr)
+ if now() >= timestamp(release["vote_started"]) + dt.timedelta(hours=72):
+ record["attention"] = (
+ "Vote remains open after 72 hours; RM may cancel in ATR."
+ )
+ return
+ if (
+ release["phase"] not in {"release_preview", "release"}
+ or not release["vote_resolved"]
+ ):
+ raise ValueError("unexpected ATR vote state")
+ if record["dry_run"]:
+ record["phase"] = "rehearsed"
+ else:
+ if not record.get("verified_vote_files"):
+ raise ValueError(
+ "voted artifact digests were not recorded; RM must reconcile before publication follow-up"
+ )
+ record["phase"] = "publishing"
+ elif phase == "publishing":
+ if record["dry_run"]:
+ raise ValueError("rehearsals cannot publish")
+ published_files(record)
+ # Freeze the successful baseline before nonessential GitHub follow-up.
+ state["baseline"] = {
+ "tag": "v" + record["version"],
+ "sha": record["candidate_sha"],
+ "versions": record["versions"],
+ "cutoff_sha": record["cutoff_sha"],
+ }
+ record["phase"] = "announcing"
+ elif phase == "announcing":
+ release = atr.release(record["atr_version"])
+ if release["phase"] != "release":
+ if record.get("announce_requested"):
+ raise ValueError(
+ "announcement outcome needs reconciliation in ATR; no duplicate email"
+ )
+ record["announce_requested"] = True
+ persist()
+ output(
+ announce="true",
+ rc=record["atr_version"],
+ version=record["version"],
+ revision=release["latest_revision_number"],
+ )
+ return
+ record["phase"] = "syncing"
+ elif phase == "syncing":
+ # Lightweight final tags do not trigger tag-based language publishers;
+ # publishing other channels is a separate, explicitly dispatched workflow.
+ ensure_ref(repo, "tags/v" + record["version"], record["candidate_sha"])
+ pr = sync_main(record, cfg)
+ record.update(
+ phase="released", sync_pr=pr["html_url"], sync_number=pr["number"]
+ )
+ else:
+ raise ValueError(f"unknown phase: {phase}")
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument(
+ "operation",
+ choices=[
+ "tick",
+ "rehearsal",
+ "retry-dispatch",
+ "cancel",
+ "retry-announce",
+ ],
+ )
+ parser.add_argument("--candidate")
+ parser.add_argument("--workflow", choices=["ci_odev.yml", "ci_check.yml"])
+ args = parser.parse_args()
+ cfg = config()
+ if (
+ cfg["repository"] != "apache/opendal"
+ or os.environ.get("GITHUB_REPOSITORY") != "apache/opendal"
+ ):
+ raise ValueError("weekly releases run only in apache/opendal")
+ store = Store(cfg)
+ state = load_state(store, cfg)
+ saved = canonical(state)
+
+ def persist():
+ nonlocal saved
+ current = canonical(state)
+ if current != saved:
+ store.save(state)
+ saved = current
+
+ atr = ATR()
+ if args.operation in {"retry-dispatch", "cancel", "retry-announce"}:
+ record = state["candidates"][args.candidate]
+ if args.operation == "retry-dispatch":
+ if record["phase"] != "checking":
+ raise ValueError("candidate is not dispatching")
+ record["dispatches"].pop(args.workflow, None)
+ elif args.operation == "retry-announce":
+ if record["phase"] != "announcing":
+ raise ValueError("candidate is not announcing")
+ record.pop("announce_requested", None)
+ else:
+ release = atr.release(record["atr_version"])
+ if release and release["phase"] != "release_candidate_draft":
+ raise ValueError(
+ "cancel the vote in ATR first; a published release cannot be cancelled"
+ )
+ if record["phase"] in {"publishing", "announcing", "syncing", "released"}:
+ raise ValueError("publication must resume with the same candidate")
+ record["phase"] = "cancelled"
+ persist()
+ return
+ active = [r for r in state["candidates"].values() if r["phase"] not in TERMINAL]
+ if len(active) > 1:
+ raise ValueError("multiple active candidates")
+ if not active:
+ plan(state, cfg, dry_run=args.operation == "rehearsal")
+ persist()
+ active = [r for r in state["candidates"].values() if r["phase"] not in TERMINAL]
+ elif args.operation == "rehearsal":
+ raise ValueError(
+ "finish or cancel the active candidate before starting a rehearsal"
+ )
+ for record in active:
+ try:
+ for _ in range(12):
+ previous = record["phase"]
+ reconcile(record, state, cfg, atr, persist)
+ record.pop("error", None)
+ persist()
+ if record["phase"] == previous or record["phase"] in TERMINAL:
+ break
+ except Exception as error:
+ record["error"] = str(error)
+ raise
+ finally:
+ persist()
+ if record["phase"] == "awaiting-vote":
+ handoff = Path("vote-request.json")
+ handoff.write_bytes(canonical(record["vote_request"]))
+ summary = f"Candidate {record['id']}: {record['phase']}\n{record.get('error', record.get('attention', ''))}\n"
+ print(summary)
+ if path := os.environ.get("GITHUB_STEP_SUMMARY"):
+ with open(path, "a") as file:
+ file.write(summary)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/.github/scripts/weekly_release/github.py b/.github/scripts/weekly_release/github.py
new file mode 100644
index 0000000000..29b992bffd
--- /dev/null
+++ b/.github/scripts/weekly_release/github.py
@@ -0,0 +1,115 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""GitHub release operations with deterministic identities for retry reconciliation."""
+
+import base64
+import os
+
+from runtime import api, pages, run
+
+
+def graphql(query, **variables):
+ value = api("graphql", {"query": query, "variables": variables})
+ if value.get("errors"):
+ raise RuntimeError("GitHub GraphQL operation failed")
+ return value["data"]
+
+
+def ref(repo, name):
+ values = api(f"repos/{repo}/git/matching-refs/{name}")
+ return next(
+ (v["object"]["sha"] for v in values if v["ref"] == "refs/" + name), None
+ )
+
+
+def ensure_ref(repo, name, sha):
+ existing = ref(repo, name)
+ if existing:
+ if existing != sha:
+ raise ValueError(f"ref already names a different commit: {name}")
+ else:
+ api(f"repos/{repo}/git/refs", {"ref": "refs/" + name, "sha": sha})
+
+
+def push(branch, cwd):
+ # Git receives credentials through process environment, never argv or disk.
+ auth = base64.b64encode(
+ ("x-access-token:" + os.environ["GH_TOKEN"]).encode()
+ ).decode()
+ env = dict(
+ os.environ,
+ GIT_CONFIG_COUNT="1",
+ GIT_CONFIG_KEY_0="http.https://github.com/.extraheader",
+ GIT_CONFIG_VALUE_0="AUTHORIZATION: basic " + auth,
+ )
+ run("git", "push", "origin", f"HEAD:refs/heads/{branch}", cwd=cwd, env=env)
+
+
+def pull_request(repo, head, base, title, body):
+ matches = pages(f"repos/{repo}/pulls?state=all&head=apache:{head}&base={base}")
+ if matches:
+ return matches[0]
+ return api(
+ f"repos/{repo}/pulls",
+ {"head": head, "base": base, "title": title, "body": body},
+ )
+
+
+def reminder(repo, record):
+ title = f"[{'REHEARSAL' if record['dry_run'] else 'VOTE REMINDER'}] OpenDAL {record['rc']}"
+ body = (
+ f"The formal vote is on [ATR](https://releases.apache.org/vote/opendal/{record['atr_version']}).\n\n"
+ f"Source commit: `{record['candidate_sha']}`. ATR revision: `{record['revision']}`.\n\n"
+ "Please independently rebuild the source archives and verify signatures using OpenDAL KEYS. "
+ "Use your own ATR account or API token to submit your ballot and verification evidence. "
+ "Replies here are discussion, not formal ballots. ATR sends ballot receipts and the result to dev@opendal.apache.org.\n\n"
+ "The vote runs for at least 72 hours from ATR's vote announcement. "
+ + (
+ "This rehearsal never publishes an official release."
+ if record["dry_run"]
+ else "ATR automatically publishes the approved source files after a passing vote."
+ )
+ )
+ cursor = None
+ while True:
+ data = graphql(
+ """query($cursor:String){repository(owner:"apache",name:"opendal"){
+ id discussionCategories(first:100){nodes{id name}}
+ discussions(first:100,after:$cursor,orderBy:{field:CREATED_AT,direction:DESC}){
+ nodes{id title url} pageInfo{hasNextPage endCursor}}}}""",
+ cursor=cursor,
+ )["repository"]
+ for item in data["discussions"]["nodes"]:
+ if item["title"] == title:
+ return item["url"]
+ info = data["discussions"]["pageInfo"]
+ if not info["hasNextPage"]:
+ break
+ cursor = info["endCursor"]
+ category = next(
+ c["id"] for c in data["discussionCategories"]["nodes"] if c["name"] == "General"
+ )
+ return graphql(
+ """mutation($repo:ID!,$category:ID!,$title:String!,$body:String!){
+ createDiscussion(input:{repositoryId:$repo,categoryId:$category,title:$title,body:$body}){
+ discussion{url}}}""",
+ repo=data["id"],
+ category=category,
+ title=title,
+ body=body,
+ )["createDiscussion"]["discussion"]["url"]
diff --git a/.github/scripts/weekly_release/model.py b/.github/scripts/weekly_release/model.py
new file mode 100644
index 0000000000..405dd24ece
--- /dev/null
+++ b/.github/scripts/weekly_release/model.py
@@ -0,0 +1,134 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Deterministic release identities and version plans."""
+
+import datetime as dt
+import hashlib
+import json
+import re
+
+UTC = dt.timezone.utc
+TERMINAL = {"dry-run-complete", "released", "withdrawn", "failed", "skipped"}
+PACKAGE_PATTERN = re.compile(r'make_package\("([^"\n]+)", "(\d+\.\d+\.\d+)"')
+
+
+def canonical(value):
+ return json.dumps(
+ value, sort_keys=True, separators=(",", ":"), ensure_ascii=True
+ ).encode()
+
+
+def digest(value):
+ return hashlib.sha512(value).hexdigest()
+
+
+def timestamp(value):
+ result = dt.datetime.fromisoformat(value.replace("Z", "+00:00"))
+ if result.tzinfo is None:
+ raise ValueError("timestamp must have a timezone")
+ return result.astimezone(UTC)
+
+
+def cutoff(now):
+ """Most recent Friday 00:00 UTC, independent of runner start delays."""
+ local = now.astimezone(UTC)
+ friday = local.replace(hour=0, minute=0, second=0, microsecond=0)
+ friday -= dt.timedelta(days=(local.weekday() - 4) % 7)
+ return friday.astimezone(UTC)
+
+
+def cycle_id(when):
+ return when.astimezone(UTC).strftime("%G-W%V")
+
+
+def snapshot_at(snapshots, when):
+ eligible = [s for s in snapshots if timestamp(s["at"]) <= when]
+ if not eligible:
+ raise ValueError("no recorded main snapshot before cutoff; wait for next cycle")
+ return max(eligible, key=lambda s: timestamp(s["at"]))["sha"]
+
+
+def versions(source):
+ result = dict(PACKAGE_PATTERN.findall(source))
+ if "core" not in result:
+ raise ValueError("source package inventory has no core")
+ return result
+
+
+def version_tuple(value):
+ if not re.fullmatch(r"\d+\.\d+\.\d+", value):
+ raise ValueError(f"invalid stable version: {value}")
+ return tuple(map(int, value.split(".")))
+
+
+def bump(value, change):
+ major, minor, patch = version_tuple(value)
+ if change == "breaking":
+ return f"{major + 1}.0.0" if major else f"0.{minor + 1}.0"
+ if change == "feature" and major:
+ return f"{major}.{minor + 1}.0"
+ if change in {"feature", "patch"}:
+ return f"{major}.{minor}.{patch + 1}"
+ raise ValueError(f"unknown change type: {change}")
+
+
+def validate_change(change, packages):
+ if set(change) != {"summary", "packages"}:
+ raise ValueError("change must contain summary and packages only")
+ if not isinstance(change["summary"], str) or not change["summary"].strip():
+ raise ValueError("change summary must be nonempty")
+ if not isinstance(change["packages"], dict):
+ raise ValueError( # noqa: TRY004
+ "packages must be an object (empty for release-neutral changes)"
+ )
+ for package, kind in change["packages"].items():
+ if package not in packages or kind not in {"patch", "feature", "breaking"}:
+ raise ValueError(f"invalid package/change: {package}: {kind}")
+
+
+def plan_versions(baseline, inventory, changes):
+ """Release the existing full source/package matrix as one coordinated train.
+
+ Unchanged packages get a patch for the coordinated release. This keeps the
+ existing all-package publishers from attempting an occupied stable version.
+ """
+ levels = {"patch": 0, "feature": 1, "breaking": 2}
+ selected = {}
+ for change in changes:
+ validate_change(change, inventory)
+ for package, kind in change["packages"].items():
+ if levels[kind] > levels.get(selected.get(package), -1):
+ selected[package] = kind
+ if not selected:
+ return {}
+ if set(baseline) != set(inventory):
+ raise ValueError(
+ "package inventory changed; initialize its reviewed baseline before weekly release"
+ )
+ if selected.get("core") == "breaking":
+ # These integrations expose OpenDAL in their public Rust contracts.
+ for package in inventory:
+ if package.startswith("integrations/"):
+ selected[package] = "breaking"
+ return {p: bump(baseline[p], selected.get(p, "patch")) for p in inventory}
+
+
+def next_rc(version, tags):
+ pattern = re.compile(rf"v{re.escape(version)}-rc\.(\d+)")
+ numbers = [int(m[1]) for t in tags if (m := pattern.fullmatch(t))]
+ return f"v{version}-rc.{max(numbers, default=0) + 1}"
diff --git a/.github/scripts/weekly_release/prepare.py b/.github/scripts/weekly_release/prepare.py
new file mode 100644
index 0000000000..84d9f4168b
--- /dev/null
+++ b/.github/scripts/weekly_release/prepare.py
@@ -0,0 +1,158 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import tempfile
+from pathlib import Path
+
+from github import ensure_ref, pull_request, push, ref
+from model import PACKAGE_PATTERN, version_tuple, versions
+from runtime import git, run
+
+PACKAGE_FILE = "dev/src/release/package.rs"
+
+
+def apply_versions(root, targets, baseline, sync=False):
+ path = root / PACKAGE_FILE
+ current = versions(path.read_text())
+ if not set(targets).issubset(current):
+ raise ValueError("cannot update an unknown package")
+ if sync and any(
+ version_tuple(current[p]) > version_tuple(v) for p, v in targets.items()
+ ):
+ raise ValueError(
+ "main already has a higher version; manual reconciliation required"
+ )
+ path.write_text(
+ PACKAGE_PATTERN.sub(
+ lambda m: f'make_package("{m[1]}", "{targets.get(m[1], m[2])}"',
+ path.read_text(),
+ )
+ )
+ run(
+ "cargo",
+ "run",
+ "--quiet",
+ "--manifest-path",
+ root / "dev/Cargo.toml",
+ "--",
+ "update-version",
+ "--baseline",
+ baseline,
+ cwd=root,
+ env=build_env(),
+ )
+ # Generated native loader package versions are not managed by update-version.
+ if "bindings/nodejs" in targets:
+ for name in ("index.cjs", "index.mjs"):
+ file = root / "bindings/nodejs" / name
+ if file.exists():
+ file.write_text(
+ file.read_text().replace(
+ current["bindings/nodejs"], targets["bindings/nodejs"]
+ )
+ )
+
+
+def build_env():
+ return {
+ k: v
+ for k, v in os.environ.items()
+ if not any(
+ word in k.upper()
+ for word in ("TOKEN", "SECRET", "PASSWORD", "PAT", "GIT_CONFIG")
+ )
+ or k == "PATH"
+ }
+
+
+def candidate(record, cfg):
+ repo = cfg["repository"]
+ branch = record["branch"]
+ if ref(repo, "heads/" + branch) is None:
+ ensure_ref(repo, "heads/" + branch, record["cutoff_sha"])
+ bump_branch = branch + "-bump"
+ existing = ref(repo, "heads/" + bump_branch)
+ if existing is None:
+ with tempfile.TemporaryDirectory(prefix="opendal-prepare-") as tmp:
+ root = Path(tmp) / "repo"
+ git("worktree", "add", "--detach", root, record["cutoff_sha"])
+ try:
+ apply_versions(root, record["versions"], record["baseline_tag"])
+ run(
+ "python3",
+ "scripts/dependencies.py",
+ "generate",
+ cwd=root,
+ env=build_env(),
+ )
+ changelog = root / "CHANGELOG.md"
+ notes = "\n".join(
+ f"- {c['summary']}" for c in record["changes"] if c["packages"]
+ )
+ changelog.write_text(
+ f"# v{record['version']}\n\n{notes}\n\n" + changelog.read_text()
+ )
+ git("add", "--all", cwd=root)
+ env = dict(
+ build_env(),
+ GIT_AUTHOR_NAME="OpenDAL Release",
+ GIT_AUTHOR_EMAIL="dev@opendal.apache.org",
+ GIT_COMMITTER_NAME="OpenDAL Release",
+ GIT_COMMITTER_EMAIL="dev@opendal.apache.org",
+ GIT_AUTHOR_DATE=record["cutoff"],
+ GIT_COMMITTER_DATE=record["cutoff"],
+ )
+ run(
+ "git",
+ "-c",
+ "commit.gpgsign=false",
+ "commit",
+ "-m",
+ f"Prepare {record['rc']}",
+ cwd=root,
+ env=env,
+ )
+ push(bump_branch, root)
+ finally:
+ git("worktree", "remove", "--force", root)
+ body = (
+ f"Prepare {record['rc']} from cutoff `{record['cutoff_sha']}`.\n\n"
+ "Review package versions, compatibility and changelog before merging into this release branch. "
+ "The weekly controller then builds and stages the candidate and prepares an ATR Trusted Vote for the release manager to start.\n\n"
+ + (
+ "This is a rehearsal: official publication and main synchronization are disabled.\n\n"
+ if record["dry_run"]
+ else ""
+ )
+ + "Generated by the weekly release controller from reviewed release declarations."
+ )
+ return pull_request(
+ repo, bump_branch, branch, f"chore(release): prepare {record['rc']}", body
+ )
+
+
+def sync_main(record, cfg):
+ return pull_request(
+ cfg["repository"],
+ record["branch"],
+ "main",
+ f"chore(release): merge released {record['version']} back to main",
+ f"Source release {record['version']} has been published through ATR. "
+ f"Merge its version and changelog updates from `{record['candidate_sha']}` back into main.\n\n"
+ "Generated by the weekly release controller. Resolve conflicts through this PR; do not change the released commit.",
+ )
diff --git a/.github/scripts/weekly_release/runtime.py b/.github/scripts/weekly_release/runtime.py
new file mode 100644
index 0000000000..7f6d5bf5e5
--- /dev/null
+++ b/.github/scripts/weekly_release/runtime.py
@@ -0,0 +1,124 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import base64
+import json
+import os
+import subprocess
+from pathlib import Path
+from urllib.parse import quote
+from urllib.request import Request, urlopen
+
+from model import canonical
+
+ROOT = Path(__file__).resolve().parents[3]
+
+
+def run(*args, cwd=None, data=None, env=None):
+ result = subprocess.run(
+ [str(a) for a in args],
+ cwd=cwd or ROOT,
+ input=data,
+ env=env,
+ capture_output=True,
+ check=False,
+ )
+ if result.returncode:
+ # Never include argv; redact secrets in diagnostics.
+ diagnostic = result.stderr.decode(errors="replace")[-4000:]
+ for name, value in os.environ.items():
+ if len(value) >= 8 and any(
+ word in name for word in ("TOKEN", "PASSWORD", "SECRET", "PRIVATE_KEY")
+ ):
+ diagnostic = diagnostic.replace(value, "[REDACTED]")
+ raise RuntimeError(
+ f"{Path(str(args[0])).name} failed (exit {result.returncode}): {diagnostic}"
+ )
+ return result.stdout
+
+
+def git(*args, cwd=None):
+ return run("git", *args, cwd=cwd).decode().strip()
+
+
+def api(endpoint, payload=None, method=None):
+ args = ["gh", "api", endpoint]
+ if method:
+ args += ["--method", method]
+ if payload is not None:
+ args += ["--input", "-"]
+ raw = run(*args, data=canonical(payload) if payload is not None else None)
+ return json.loads(raw) if raw.strip() else None
+
+
+def pages(endpoint):
+ output = []
+ for page in range(1, 1001):
+ part = api(
+ f"{endpoint}{'&' if '?' in endpoint else '?'}per_page=100&page={page}"
+ )
+ if not isinstance(part, list):
+ raise ValueError("expected paginated array") # noqa: TRY004
+ output.extend(part)
+ if len(part) < 100:
+ return output
+ raise ValueError("pagination limit exceeded")
+
+
+def download(url):
+ with urlopen(
+ Request(url, headers={"User-Agent": "Apache-OpenDAL-release"}), timeout=120
+ ) as response:
+ return response.read()
+
+
+class Store:
+ """Compare-and-swap state on the release-state branch."""
+
+ def __init__(self, config):
+ self.repo = config["repository"]
+ self.branch = config["state_branch"]
+ self.endpoint = f"repos/{self.repo}/contents/state.json"
+ self.sha = None
+
+ def load(self, public=False):
+ if public:
+ return json.loads(
+ download(
+ f"https://raw.githubusercontent.com/{self.repo}/{self.branch}/state.json"
+ )
+ )
+ entry = api(f"{self.endpoint}?ref={quote(self.branch, safe='')}")
+ self.sha = entry["sha"]
+ return json.loads(base64.b64decode(entry["content"]))
+
+ def save(self, state):
+ value = api(
+ self.endpoint,
+ {
+ "message": "Update weekly release state",
+ "branch": self.branch,
+ "sha": self.sha,
+ "content": base64.b64encode(canonical(state)).decode(),
+ },
+ method="PUT",
+ )
+ self.sha = value["content"]["sha"]
+
+
+def config():
+ return json.loads((ROOT / ".release/config.json").read_text())
diff --git a/.github/scripts/weekly_release/test_weekly_release.py b/.github/scripts/weekly_release/test_weekly_release.py
new file mode 100644
index 0000000000..66a5ccae26
--- /dev/null
+++ b/.github/scripts/weekly_release/test_weekly_release.py
@@ -0,0 +1,485 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Exercise release lifecycle, retry boundaries and immutable artifact identities."""
+
+import hashlib
+import io
+import os
+import subprocess
+import tempfile
+import unittest
+import zipfile
+from pathlib import Path
+from unittest.mock import Mock, patch
+
+import atr
+import controller as c
+import model
+import prepare
+
+CFG = {
+ "repository": "apache/opendal",
+ "validation_workflows": ["ci_odev.yml", "ci_check.yml"],
+}
+SHA = "a" * 40
+
+
+def record(phase="staged", dry=False):
+ return {
+ "id": "2026-W37",
+ "phase": phase,
+ "dry_run": dry,
+ "candidate_sha": SHA,
+ "cutoff_sha": "b" * 40,
+ "branch": "release-candidates/2026-W37",
+ "version": "0.59.2",
+ "versions": {"core": "0.59.2"},
+ "rc": "v0.59.2-rc.1",
+ "atr_version": "0.59.2-rc.1",
+ "revision": "00001",
+ "dispatches": {},
+ "compose_run": 123,
+ "compose_attempt": 1,
+ }
+
+
+def release(phase="release_candidate", resolved=None):
+ return {
+ "phase": phase,
+ "vote_started": "2026-09-04T01:00:00Z",
+ "vote_resolved": resolved,
+ "latest_revision_number": "00001",
+ "vote_mode": "trusted",
+ }
+
+
+class ModelTests(unittest.TestCase):
+ def test_friday_cutoff_is_utc_and_stable_for_delayed_schedule(self):
+ now = model.timestamp("2026-09-07T10:00:00+08:00")
+ self.assertEqual(model.cutoff(now).isoformat(), "2026-09-04T00:00:00+00:00")
+ self.assertEqual(model.cycle_id(model.cutoff(now)), "2026-W36")
+
+ def test_failed_candidate_does_not_consume_stable_versions(self):
+ base = {"core": "0.59.0"}
+ patch_change = [{"summary": "Fix", "packages": {"core": "patch"}}]
+ self.assertEqual(
+ model.plan_versions(base, base, patch_change), {"core": "0.59.1"}
+ )
+ self.assertEqual(
+ model.next_rc("0.59.1", ["v0.59.1-rc.1", "v0.59.1-rc.999"]),
+ "v0.59.1-rc.1000",
+ )
+ breaking = [{"summary": "New contract", "packages": {"core": "breaking"}}]
+ self.assertEqual(model.plan_versions(base, base, breaking), {"core": "0.60.0"})
+
+ def test_package_baselines_and_compatibility_propagation(self):
+ base = {
+ "core": "0.59.0",
+ "integrations/object_store": "0.60.0",
+ "bindings/python": "0.47.0",
+ }
+ plan = model.plan_versions(
+ base, base, [{"summary": "Breaking", "packages": {"core": "breaking"}}]
+ )
+ self.assertEqual(
+ plan,
+ {
+ "core": "0.60.0",
+ "integrations/object_store": "0.61.0",
+ "bindings/python": "0.47.1",
+ },
+ )
+ with self.assertRaises(ValueError):
+ model.plan_versions(
+ base,
+ {"core": "0.59.0"},
+ [{"summary": "Change", "packages": {"core": "patch"}}],
+ )
+
+ def test_cutoff_uses_run_timestamp_not_current_main(self):
+ runs = [
+ {"created_at": "2026-09-04T00:01:00Z", "id": 2, "head_sha": "new"},
+ {"created_at": "2026-09-03T23:59:00Z", "id": 1, "head_sha": "cutoff"},
+ ]
+ with patch.object(c, "api", return_value={"workflow_runs": runs}):
+ self.assertEqual(
+ c.cutoff_commit(CFG, model.timestamp("2026-09-04T00:00:00Z")), "cutoff"
+ )
+ with (
+ patch.object(c, "api", return_value={"workflow_runs": []}),
+ self.assertRaises(ValueError),
+ ):
+ c.cutoff_commit(CFG, model.timestamp("2026-09-04T00:00:00Z"))
+
+
+class WorkflowTests(unittest.TestCase):
+ def test_dispatch_persisted_before_network_and_not_duplicated(self):
+ r = record("composing")
+ events = []
+
+ def api(path, payload=None):
+ if payload is None:
+ return {"workflow_runs": []}
+ events.append("dispatch")
+ raise TimeoutError("response lost")
+
+ with (
+ patch.object(c, "api", side_effect=api),
+ patch.object(c, "ref", return_value=SHA),
+ ):
+ with self.assertRaises(TimeoutError):
+ c.workflow(
+ r, CFG, "release-compose.yml", {}, lambda: events.append("save")
+ )
+ with self.assertRaises(ValueError):
+ c.workflow(
+ r, CFG, "release-compose.yml", {}, lambda: events.append("save")
+ )
+ self.assertEqual(events, ["save", "dispatch"])
+
+ def test_dispatch_adopts_only_frozen_sha_branch_and_completed_success(self):
+ r = record()
+ r["dispatches"]["test.yml"] = "2026-09-04T00:00:00Z"
+ run = {
+ "id": 1,
+ "head_sha": SHA,
+ "head_branch": r["branch"],
+ "created_at": "2026-09-04T00:00:00Z",
+ "run_attempt": 1,
+ "status": "completed",
+ "conclusion": "success",
+ "html_url": "run",
+ }
+ with patch.object(c, "api", return_value={"workflow_runs": [run]}):
+ self.assertEqual(c.workflow(r, CFG, "test.yml", {}, Mock()), run)
+ run["head_sha"] = "c" * 40
+ with self.assertRaises(ValueError):
+ c.workflow(r, CFG, "test.yml", {}, Mock())
+
+ def test_compose_uses_same_run_instead_of_bot_dispatch(self):
+ r = record("composing")
+ r.pop("compose_run")
+ with (
+ patch.dict(os.environ, {"GITHUB_RUN_ID": "321"}),
+ patch.object(c, "ref", return_value=SHA),
+ patch.object(c, "output") as output,
+ patch.object(c, "api") as api,
+ ):
+ c.reconcile(r, {}, CFG, Mock(), Mock())
+ self.assertEqual(r["compose_run"], 321)
+ output.assert_called_once_with(
+ compose="true", candidate=SHA, rc=r["atr_version"]
+ )
+ api.assert_not_called()
+
+ def test_compose_adopts_completed_reusable_workflow(self):
+ r = record("composing")
+ with (
+ patch.dict(os.environ, {"GITHUB_RUN_ID": "321"}),
+ patch.object(
+ c,
+ "api",
+ return_value={
+ "status": "completed",
+ "conclusion": "success",
+ "run_attempt": 2,
+ },
+ ),
+ ):
+ c.reconcile(r, {}, CFG, Mock(), Mock())
+ self.assertEqual(r["phase"], "staged")
+ self.assertEqual(r["compose_attempt"], 2)
+
+ def test_candidate_build_environment_has_no_credentials(self):
+ with patch.dict(
+ os.environ,
+ {
+ "GH_TOKEN": "secret",
+ "ATR_PAT": "secret",
+ "GITHUB_TOKEN": "secret",
+ "GIT_CONFIG_VALUE_0": "secret",
+ "PATH": "/bin",
+ },
+ ):
+ env = prepare.build_env()
+ self.assertNotIn("GH_TOKEN", env)
+ self.assertNotIn("ATR_PAT", env)
+ self.assertNotIn("GIT_CONFIG_VALUE_0", env)
+ self.assertEqual(env["PATH"], "/bin")
+
+
+class LifecycleTests(unittest.TestCase):
+ def setUp(self):
+ self.atr = Mock(spec=atr.ATR)
+ self.persist = Mock()
+ self.state = {"baseline": {"tag": "v0.59.0"}}
+
+ def test_failed_tag_creation_is_retried_before_validation(self):
+ r = record("checking")
+ with (
+ patch.object(c, "ensure_ref", side_effect=[TimeoutError(), None]) as tag,
+ patch.object(c, "workflow", return_value=None) as workflow,
+ ):
+ with self.assertRaises(TimeoutError):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "checking")
+ workflow.assert_not_called()
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(tag.call_count, 2)
+ workflow.assert_called_once()
+
+ def test_announcement_uses_oidc_action_and_waits_for_release(self):
+ r = record("announcing")
+ self.atr.release.return_value = release("release_preview")
+ with patch.object(c, "output") as output:
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "announcing")
+ self.persist.assert_called_once()
+ self.assertTrue(output.call_args.kwargs["announce"])
+ self.atr.release.return_value = release("release")
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "syncing")
+
+ def test_rehearsal_opens_trusted_vote_without_publication(self):
+ r = record(dry=True)
+ payload = atr.vote_payload(r, "00001", ["rat", "rat"])
+ self.assertTrue(payload["automatic_resolve_when_finished"])
+ self.assertFalse(payload["automatic_publish_when_resolved"])
+ self.assertEqual(payload["vote_duration"], 72)
+ self.assertEqual(payload["concerns_noted"], ["rat"])
+ self.assertIn("REHEARSAL", payload["subject"])
+ self.assertTrue(
+ atr.vote_payload(record(), "00001", [])["automatic_publish_when_resolved"]
+ )
+
+ def test_staged_prepares_handoff_without_starting_vote(self):
+ r = record()
+ self.atr.release.return_value = release("release_candidate_draft")
+ self.atr.request.side_effect = [
+ {"ongoing": 0},
+ {"policy_vote_mode": "trusted"},
+ {"rel_paths": list(c.expected_paths(r))},
+ ]
+ self.atr.checks.return_value = [
+ {"status": "concern", "checker": "rat"},
+ {"status": "suggestion", "checker": "sbom"},
+ ]
+
+ with patch.object(c, "signed_checksums", return_value={}):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "awaiting-vote")
+ self.assertEqual(r["vote_request"]["concerns_noted"], ["rat"])
+
+ def test_blocker_does_not_start_vote(self):
+ r = record()
+ self.atr.release.return_value = release("release_candidate_draft")
+ self.atr.request.return_value = {"ongoing": 0}
+ self.atr.checks.return_value = [{"status": "blocker", "checker": "archive"}]
+ with self.assertRaises(ValueError):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+
+ def test_manual_vote_is_observed_without_credentials_or_post(self):
+ r = record("awaiting-vote")
+ self.atr.release.return_value = release("release_candidate_draft")
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "awaiting-vote")
+ self.atr.release.return_value = release()
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "voting")
+
+ def test_manual_vote_cannot_change_revision_or_vote_mode(self):
+ for key, value in [
+ ("latest_revision_number", "00002"),
+ ("vote_mode", "manual"),
+ ]:
+ r = record("awaiting-vote")
+ remote = release()
+ remote[key] = value
+ self.atr.release.return_value = remote
+ with self.assertRaises(ValueError):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "awaiting-vote")
+
+ def test_vote_timeout_waits_for_rm_and_preserves_baseline(self):
+ r = record("voting")
+ r.update(discussion="url", verified_vote_files=True)
+ self.atr.release.return_value = release()
+ with patch.object(
+ c, "now", return_value=model.timestamp("2026-09-08T00:00:00Z")
+ ):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "voting")
+ self.assertIn("RM", r["attention"])
+ self.assertEqual(self.state["baseline"], {"tag": "v0.59.0"})
+
+ def test_cancelled_vote_and_rehearsal_never_advance_baseline(self):
+ for dry, phase, expected in [
+ (False, "release_candidate_draft", "cancelled"),
+ (True, "release_preview", "rehearsed"),
+ ]:
+ r = record("voting", dry=dry)
+ r["discussion"] = "url"
+ self.atr.release.return_value = release(
+ phase, resolved="2026-09-07T01:00:00Z"
+ )
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], expected)
+ self.assertEqual(self.state["baseline"], {"tag": "v0.59.0"})
+
+ def test_passing_vote_is_not_yet_a_published_release(self):
+ r = record("voting")
+ r.update(discussion="url", verified_vote_files=True)
+ self.atr.release.return_value = release(
+ "release_preview", resolved="2026-09-07T01:00:00Z"
+ )
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "publishing")
+ self.assertEqual(self.state["baseline"], {"tag": "v0.59.0"})
+ with (
+ patch.object(
+ c, "published_files", side_effect=ValueError("not propagated")
+ ),
+ self.assertRaises(ValueError),
+ ):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(self.state["baseline"], {"tag": "v0.59.0"})
+ with patch.object(c, "published_files"):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(self.state["baseline"]["sha"], SHA)
+ self.assertEqual(r["phase"], "announcing")
+
+ def test_uncertain_announcement_is_not_repeated(self):
+ r = record("announcing")
+ self.atr.release.return_value = release("release_preview")
+ with (
+ patch.object(c, "output", side_effect=TimeoutError()),
+ self.assertRaises(TimeoutError),
+ ):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ with patch.object(c, "output") as output:
+ with self.assertRaises(ValueError):
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ output.assert_not_called()
+ self.atr.release.return_value = release("release")
+ c.reconcile(r, self.state, CFG, self.atr, self.persist)
+ self.assertEqual(r["phase"], "syncing")
+
+
+class ArtifactTests(unittest.TestCase):
+ def test_immutable_actions_zip_inventory(self):
+ r = record()
+ files = {p.split("/", 1)[1]: b"content" for p in c.expected_paths(r)}
+ buf = io.BytesIO()
+ with zipfile.ZipFile(buf, "w") as z:
+ for name, data in files.items():
+ z.writestr(name, data)
+ response = {
+ "artifacts": [{"id": 1, "name": "signed-source-123-1", "expired": False}]
+ }
+ with (
+ patch.object(c, "api", return_value=response),
+ patch.object(c, "run", return_value=buf.getvalue()),
+ ):
+ checksums = c.signed_checksums(r, CFG)
+ self.assertEqual(set(checksums), c.expected_paths(r))
+ self.assertEqual(
+ set(checksums.values()), {hashlib.sha512(b"content").hexdigest()}
+ )
+ r["versions"]["bindings/python"] = "0.47.1"
+ with (
+ patch.object(c, "api", return_value=response),
+ patch.object(c, "run", return_value=buf.getvalue()),
+ self.assertRaises(ValueError),
+ ):
+ c.signed_checksums(r, CFG)
+
+ def test_changed_atr_bytes_require_rm_cancellation(self):
+ r = record("voting")
+ r["checksums"] = {
+ p: hashlib.sha512(b"original").hexdigest() for p in c.expected_paths(r)
+ }
+ remote = Mock(spec=atr.ATR)
+ remote.request.return_value = {"rel_paths": list(c.expected_paths(r))}
+ remote.release.return_value = release()
+ with (
+ patch.object(c, "download", return_value=b"modified"),
+ self.assertRaises(ValueError),
+ ):
+ c.capture_files(r, remote)
+
+ def test_publication_compares_every_signed_file(self):
+ r = record("publishing")
+ r["checksums"] = {
+ p: hashlib.sha512(b"content").hexdigest() for p in c.expected_paths(r)
+ }
+ with patch.object(c, "download", return_value=b"content") as download:
+ c.published_files(r)
+ self.assertEqual(download.call_count, 3)
+ with (
+ patch.object(c, "download", return_value=b"different"),
+ self.assertRaises(ValueError),
+ ):
+ c.published_files(r)
+
+
+class PlanningGitTests(unittest.TestCase):
+ def test_sync_merge_alone_does_not_create_a_release(self):
+ with tempfile.TemporaryDirectory() as tmp:
+
+ def git(*args):
+ return (
+ subprocess.check_output(
+ ["git", "-C", tmp, *args], stderr=subprocess.DEVNULL
+ )
+ .decode()
+ .strip()
+ )
+
+ git("init", "-b", "main")
+ git("config", "user.name", "Test")
+ git("config", "user.email", "test@example.org")
+ git("config", "commit.gpgsign", "false")
+ p = Path(tmp) / "core"
+ p.mkdir()
+ (p / "Cargo.toml").write_text('version = "0.59.0"')
+ git("add", ".")
+ git("commit", "-m", "Baseline")
+ base = git("rev-parse", "HEAD")
+ (p / "Cargo.toml").write_text('version = "0.59.1"')
+ git("commit", "-am", "Sync released version")
+ sync = git("rev-parse", "HEAD")
+ state = {
+ "baseline": {"sha": base},
+ "candidates": {"old": {"sync_number": 1}},
+ }
+ with (
+ patch.object(c, "git", side_effect=git),
+ patch.object(c, "cutoff_commit", return_value=sync),
+ patch.object(
+ c, "api", return_value={"merged": True, "merge_commit_sha": sync}
+ ),
+ ):
+ c.plan(state, CFG)
+ self.assertEqual(
+ [r["phase"] for k, r in state["candidates"].items() if k != "old"],
+ ["skipped"],
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/workflows/ci_check.yml b/.github/workflows/ci_check.yml
index 499058a87c..d6c065c436 100644
--- a/.github/workflows/ci_check.yml
+++ b/.github/workflows/ci_check.yml
@@ -18,6 +18,7 @@
name: Check
on:
+ workflow_dispatch:
push:
branches:
- main
diff --git a/.github/workflows/ci_odev.yml b/.github/workflows/ci_odev.yml
index c251e72aff..d9b2b8987b 100644
--- a/.github/workflows/ci_odev.yml
+++ b/.github/workflows/ci_odev.yml
@@ -18,6 +18,7 @@
name: odev CI
on:
+ workflow_dispatch:
push:
branches:
- main
diff --git a/.github/workflows/ci_weekly_release.yml b/.github/workflows/ci_weekly_release.yml
new file mode 100644
index 0000000000..61dc02b46b
--- /dev/null
+++ b/.github/workflows/ci_weekly_release.yml
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Weekly release tooling CI
+on:
+ push:
+ branches: [main]
+ pull_request:
+ paths:
+ - '.github/scripts/weekly_release/**'
+ - '.github/workflows/weekly_release.yml'
+ - '.github/workflows/release-compose.yml'
+ - '.github/workflows/ci_weekly_release.yml'
+ - '.release/**'
+permissions:
+ contents: read
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - uses: actions/setup-python@v6
+ with:
+ python-version: '3.12'
+ - run: python3 -m unittest discover -s .github/scripts/weekly_release -p 'test_*.py'
diff --git a/.github/workflows/release-compose.yml b/.github/workflows/release-compose.yml
index bc70a46da4..c0acd08cd9 100644
--- a/.github/workflows/release-compose.yml
+++ b/.github/workflows/release-compose.yml
@@ -24,11 +24,30 @@ on:
description: Full SHA of the reviewed source commit on the selected branch
type: string
required: true
+ version-directory:
+ description: Stage under the stable version directory for weekly publication
+ type: boolean
+ default: false
rc:
description: Candidate version, for example 0.59.2-rc.1
type: string
required: true
+ workflow_call:
+ inputs:
+ candidate:
+ type: string
+ required: true
+ rc:
+ type: string
+ required: true
+ version-directory:
+ type: boolean
+ default: false
+ secrets:
+ GPG_SECRET_KEY:
+ required: true
+
permissions:
contents: read
@@ -38,7 +57,7 @@ concurrency:
jobs:
source_bundle:
- if: github.event_name == 'workflow_dispatch' && github.repository == 'apache/opendal'
+ if: github.repository == 'apache/opendal'
runs-on: ubuntu-latest
permissions:
contents: read
@@ -47,7 +66,7 @@ jobs:
steps:
- uses: actions/checkout@v7
with:
- ref: ${{ github.sha }}
+ ref: ${{ inputs.candidate }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v6
@@ -62,7 +81,9 @@ jobs:
import os, re, subprocess
assert re.fullmatch(r"[0-9a-f]{40}", os.environ["CANDIDATE"]), "full candidate SHA required"
assert re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+-rc\.[1-9][0-9]*", os.environ["RC"]), "RC version required"
- subprocess.run(["git", "merge-base", "--is-ancestor", os.environ["CANDIDATE"], "HEAD"], check=True)
+ if os.environ["GITHUB_EVENT_NAME"] == "workflow_dispatch" and os.environ["GITHUB_WORKFLOW"] == "Compose source candidate on ATR":
+ subprocess.run(["git", "merge-base", "--is-ancestor", os.environ["CANDIDATE"], os.environ["GITHUB_SHA"]], check=True)
+ subprocess.run(["git", "cat-file", "-e", os.environ["CANDIDATE"] + "^{commit}"], check=True)
PYTHON
- uses: ./.github/actions/setup
- name: Prepare unsigned candidate without signing credentials
@@ -89,7 +110,7 @@ jobs:
steps:
- uses: actions/checkout@v7
with:
- ref: ${{ github.sha }}
+ ref: ${{ inputs.candidate }}
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v6
@@ -127,12 +148,28 @@ jobs:
artifact-ids: ${{ needs.source_sign.outputs.artifact-id }}
path: ${{ runner.temp }}/signed-source
merge-multiple: true
+ - name: Arrange source publication directory
+ env:
+ RC: ${{ inputs.rc }}
+ VERSION_DIRECTORY: ${{ inputs.version-directory }}
+ run: |
+ python3 - <<'PYTHON'
+ import os, re, shutil
+ from pathlib import Path
+ rc = os.environ["RC"]
+ assert re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+-rc\.[1-9][0-9]*", rc)
+ root = Path(os.environ["RUNNER_TEMP"])
+ target = root / "atr-source"
+ if os.environ["VERSION_DIRECTORY"] == "true":
+ target /= rc.split("-rc.")[0]
+ shutil.copytree(root / "signed-source", target)
+ PYTHON
- name: Upload candidate to ATR compose
uses: apache/tooling-actions/upload-to-atr@fa721a0b176d713807b574da721b96545b587eea
with:
project: opendal
version: ${{ inputs.rc }}
- src: ${{ runner.temp }}/signed-source
+ src: ${{ runner.temp }}/atr-source
- name: Record staging handoff
run: |
echo 'Candidate uploaded to ATR compose. Inspect ATR checks and independently rebuild the downloaded files before starting a vote. This workflow does not vote or finish a release.' >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/weekly_release.yml b/.github/workflows/weekly_release.yml
new file mode 100644
index 0000000000..21170b2faf
--- /dev/null
+++ b/.github/workflows/weekly_release.yml
@@ -0,0 +1,118 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Weekly source release
+run-name: Weekly source release ${{ inputs.operation || github.event_name }}
+
+on:
+ push:
+ branches: [main]
+ schedule:
+ - cron: '7,22,37,52 * * * *'
+ workflow_dispatch:
+ inputs:
+ operation:
+ description: Reconcile, rehearse, or recover a candidate
+ type: choice
+ options: [tick, rehearsal, retry-dispatch, cancel, retry-announce]
+ default: tick
+ candidate:
+ description: Candidate ID for recovery
+ type: string
+ workflow:
+ description: Confirmed missing dispatch to retry
+ type: choice
+ options: [ci_odev.yml, ci_check.yml]
+
+permissions:
+ contents: read
+
+concurrency:
+ group: weekly-source-release
+ cancel-in-progress: false
+
+jobs:
+ reconcile:
+ # Push run metadata records the cutoff even when a scheduler starts late.
+ if: github.repository == 'apache/opendal' && github.event_name != 'push'
+ runs-on: ubuntu-latest
+ timeout-minutes: 45
+ permissions:
+ contents: write
+ pull-requests: write
+ discussions: write
+ actions: write
+ id-token: write
+ outputs:
+ compose: ${{ steps.reconcile.outputs.compose }}
+ candidate: ${{ steps.reconcile.outputs.candidate }}
+ rc: ${{ steps.reconcile.outputs.rc }}
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ ref: main
+ fetch-depth: 0
+ persist-credentials: false
+ - uses: actions/setup-python@v6
+ with:
+ python-version: '3.12'
+ - uses: ./.github/actions/setup
+ - name: Reconcile the weekly release
+ id: reconcile
+ env:
+ GH_TOKEN: ${{ github.token }}
+ OPERATION: ${{ inputs.operation || 'tick' }}
+ CANDIDATE: ${{ inputs.candidate }}
+ WORKFLOW: ${{ inputs.workflow }}
+ run: |
+ python3 .github/scripts/weekly_release/controller.py "$OPERATION" \
+ --candidate "$CANDIDATE" --workflow "${WORKFLOW:-ci_odev.yml}"
+ - name: Upload RM vote handoff
+ if: hashFiles('vote-request.json') != ''
+ uses: actions/upload-artifact@v7
+ with:
+ name: weekly-vote-request-${{ github.run_id }}-${{ github.run_attempt }}
+ path: vote-request.json
+ - name: Announce the published source release through ATR
+ if: steps.reconcile.outputs.announce == 'true'
+ uses: apache/tooling-actions/release-on-atr@fa721a0b176d713807b574da721b96545b587eea
+ with:
+ version: ${{ steps.reconcile.outputs.rc }}
+ announce: 'true'
+ announce-revision: ${{ steps.reconcile.outputs.revision }}
+ announce-email-to: announce@apache.org
+ announce-path-suffix: ${{ steps.reconcile.outputs.version }}
+ announce-body: |
+ Apache OpenDAL ${{ steps.reconcile.outputs.version }} is available.
+
+ Downloads: https://downloads.apache.org/opendal/${{ steps.reconcile.outputs.version }}/
+
+ Apache OpenDAL provides a unified interface for accessing data across storage services.
+
+ compose:
+ needs: reconcile
+ if: needs.reconcile.outputs.compose == 'true'
+ permissions:
+ contents: read
+ id-token: write
+ uses: ./.github/workflows/release-compose.yml
+ with:
+ candidate: ${{ needs.reconcile.outputs.candidate }}
+ rc: ${{ needs.reconcile.outputs.rc }}
+ version-directory: true
+ secrets:
+ GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
diff --git a/.release/config.json b/.release/config.json
new file mode 100644
index 0000000000..2ffb03cd70
--- /dev/null
+++ b/.release/config.json
@@ -0,0 +1,9 @@
+{
+ "repository": "apache/opendal",
+ "state_branch": "release-state",
+ "baseline_tag": "v0.59.0",
+ "validation_workflows": [
+ "ci_odev.yml",
+ "ci_check.yml"
+ ]
+}
diff --git a/dev/src/generate/dotnet.rs b/dev/src/generate/dotnet.rs
index 931050f061..0695ded523 100644
--- a/dev/src/generate/dotnet.rs
+++ b/dev/src/generate/dotnet.rs
@@ -233,7 +233,11 @@ fn pascalize_backticks(text: &str) -> String {
result.push_str(&rest[..start]);
let after = &rest[start + 1..];
match after.find('`') {
- Some(end) if after[..end].chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_') => {
+ Some(end)
+ if after[..end]
+ .chars()
+ .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '_') =>
+ {
result.push_str(&heck::AsUpperCamelCase(&after[..end]).to_string());
rest = &after[end + 1..];
}
diff --git a/dev/src/main.rs b/dev/src/main.rs
index 8459f19cf0..d0b3de7622 100644
--- a/dev/src/main.rs
+++ b/dev/src/main.rs
@@ -60,7 +60,11 @@ enum Commands {
language: String,
},
/// Update the version of all packages.
- UpdateVersion,
+ UpdateVersion {
+ /// Compare versions against the last successful release.
+ #[arg(long)]
+ baseline: Option<String>,
+ },
/// Create all the release artifacts.
Release {
/// Build source archives without invoking GPG.
@@ -76,7 +80,7 @@ fn main() -> anyhow::Result<()> {
match Cmd::parse().command {
Commands::Generate { language } => generate::run(&language),
- Commands::UpdateVersion => release::update_version(),
+ Commands::UpdateVersion { baseline } => release::update_version(baseline.as_deref()),
Commands::Release { unsigned } => release::archive_package(!unsigned),
Commands::ReleasePackages => release::print_packages(),
}
diff --git a/dev/src/release/bump.rs b/dev/src/release/bump.rs
index d516694e0e..6781fddee3 100644
--- a/dev/src/release/bump.rs
+++ b/dev/src/release/bump.rs
@@ -23,8 +23,21 @@ use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
use toml_edit::{DocumentMut, Item};
-pub fn validate_release_versions(packages: &[Package]) -> anyhow::Result<()> {
- let baseline = latest_final_release_tag()?;
+pub fn validate_release_versions(
+ packages: &[Package],
+ baseline: Option<&str>,
+) -> anyhow::Result<()> {
+ let baseline = match baseline {
+ Some(tag) => {
+ let version = Version::parse(tag.strip_prefix('v').unwrap_or(tag))?;
+ anyhow::ensure!(
+ version.pre.is_empty() && version.build.is_empty(),
+ "baseline must be a final release"
+ );
+ tag.to_string()
+ }
+ None => latest_final_release_tag()?,
+ };
let mut violations = Vec::new();
for package in packages {
diff --git a/dev/src/release/mod.rs b/dev/src/release/mod.rs
index 33f417f559..509290417a 100644
--- a/dev/src/release/mod.rs
+++ b/dev/src/release/mod.rs
@@ -26,9 +26,9 @@ use std::path::Path;
mod bump;
mod package;
-pub fn update_version() -> anyhow::Result<()> {
+pub fn update_version(baseline: Option<&str>) -> anyhow::Result<()> {
let packages = package::all_packages();
- bump::validate_release_versions(&packages)?;
+ bump::validate_release_versions(&packages, baseline)?;
let mut updated = false;
for package in packages {
diff --git a/website/community/release/weekly.md b/website/community/release/weekly.md
new file mode 100644
index 0000000000..e431a7a138
--- /dev/null
+++ b/website/community/release/weekly.md
@@ -0,0 +1,209 @@
+---
+title: Weekly source releases
+sidebar_position: 4
+---
+
+# Weekly source releases
+
+OpenDAL prepares a source release from the Friday 00:00 UTC cutoff. A version PR
+is reviewed and merged into a release branch, after which GitHub Actions validates,
+builds, signs and uploads the candidate. ATR hosts the formal Trusted Vote and
+publishes the approved source files. GitHub Discussions provides a reminder and
+space for discussion, not a second ballot box.
+
+Monday availability is a target. The 72-hour voting period begins with ATR's vote
+announcement, after preparation and validation complete. An unresolved vote blocks
+the next candidate until the release manager cancels it or completes the release.
+
+This controller publishes source archives only. Maven, crates.io, PyPI, npm,
+NuGet, website deployment and other distribution channels retain their existing
+workflows. Its tags are created using the repository `GITHUB_TOKEN`, so they do
+not trigger the existing tag-based publishers.
+
+## Configure once
+
+The source compose workflow uses the existing `GPG_SECRET_KEY` secret and
+`SOURCE_SIGNING_FINGERPRINT` variable. The weekly controller uses GitHub's
+short-lived repository `GITHUB_TOKEN`. It requires no additional personal GitHub
+or ATR token, and no ASF ID variable.
+
+Enable Actions to create pull requests in the repository's workflow permissions.
+The workflow requests contents, pull requests, discussions and Actions write
+permissions. Explicit validation dispatches work with `GITHUB_TOKEN`; generated
+pushes and PRs do not automatically trigger further workflows.
+
+Configure ATR Trusted Publishing for repository `opendal`, with the optional
+branch restriction empty. Register `.github/workflows/weekly_release.yml` under
+both **compose** and **finish**. Keep `.github/workflows/release-compose.yml` under
+compose for direct manual use. The weekly workflow calls compose as a reusable
+workflow, preserving the initiating actor and caller workflow identity for OIDC.
+Announcement uses ASF's `release-on-atr` action with OIDC.
+
+The scheduled workflow actor must be linked to an ASF committer account with the
+required project permissions. GitHub associates scheduled runs with the user who
+last changed the cron schedule; a manual run uses its initiating user. An RM
+should maintain the schedule and initiate recovery runs. This identity comes
+from GitHub OIDC, not an ASF ID supplied in repository configuration.
+
+The RM and voters keep their personal ATR authentication in their local official
+ATR clients. The controller cannot start or cancel a vote or cast a ballot.
+
+Review `.release/config.json` before deployment. `baseline_tag` identifies the
+last official source release for initialization, not a failed RC. Initialization
+checks its public distribution directory and records its package versions. After
+that, persisted state determines the successful baseline. There is no enablement
+variable, GitHub environment approval, or recurring initialization operation.
+Installing the workflow on the default branch activates its schedule.
+
+`release-state/state.json` is created automatically on the first reconciliation.
+It contains candidate identities, version plans, artifact digests, workflow and
+ATR task IDs, and publication progress. It never contains credentials. Writes use
+GitHub's content SHA comparison and the workflow runs serially. Restrict writes
+to this branch to release maintainers; do not rewrite it to recover a failed run.
+
+
+## Candidate preparation
+
+Main push workflow metadata records the head and server timestamp. A delayed
+scheduler chooses the latest recorded push at or before Friday 00:00 UTC; it does
+not use commit author dates or the later main head. If no push snapshot predates
+the cutoff, the controller waits for a later cycle instead of guessing. Keep the
+weekly workflow's run history until its cutoff has been consumed.
+
+A week with no unreleased source changes is skipped. Version synchronization PRs
+created by the controller do not themselves cause another release. The controller
+starts from the last successful package versions, increments the complete source
+package matrix by at least a patch, and preserves larger versions already declared
+in `dev/src/release/package.rs`. Public dependency compatibility is also checked by
+`update-version --baseline`.
+
+A normal PR can supply compatibility information in an added, uniquely named
+`.release/changes/*.json` file:
+
+```json
+{
+ "summary": "Explain the user-visible change",
+ "packages": {"core": "breaking"}
+}
+```
+
+The supported levels are `patch`, `feature`, and `breaking`. Breaking changes to
+pre-1.0 packages raise the minor version; post-1.0 packages raise the major version.
+Breaking core changes also raise integration compatibility versions. Package names
+are the paths in the source package inventory. A changed inventory requires a
+reviewed baseline migration. Classification is reviewed by humans; the controller
+does not infer API compatibility from commit messages. Existing declaration files
+should not be edited or removed; add corrections in a new file.
+
+The controller creates `release-candidates/<cycle>` at the cutoff and a `-bump`
+branch containing generated versions, dependency inventories and changelog. The
+version PR targets the release branch. Review and merge that PR to continue.
+The resulting commit is frozen for CI, the RC tag, signing and voting. If the
+release branch changes afterward, cancel and prepare a fresh candidate rather
+than rebuilding different sources under the same identity.
+
+`ci_odev.yml` and `ci_check.yml` are explicitly dispatched and must pass before
+compose. Compose runs as part of the weekly run, without another workflow dispatch.
+Source reproducibility and signature validation also run in compose.
+ATR concerns and suggestions do not introduce another project quality gate:
+the prepared vote request includes the acknowledged concerns. ATR's server still
+requires its background checks to complete and refuses candidates with blockers.
+
+## Trusted Vote and publication
+
+The candidate is uploaded under `<stable-version>/` inside ATR. This preserves
+OpenDAL's versioned SVN distribution layout when ATR's automatic publisher uses
+an empty download suffix. The ATR candidate key includes the RC suffix; source
+archive names and the published directory use their stable package versions.
+
+After upload, the controller records the immutable signed Actions artifact's
+SHA-512 digests and checks the ATR inventory. It enters `awaiting-vote` and writes
+`vote-request.json` to the `weekly-vote-request` artifact and persisted state.
+The request fixes the candidate revision, vote text and acknowledged concerns.
+Repeated ticks do not start a vote or send vote mail.
+
+### RM: start the vote
+
+Download the handoff from the weekly run. Review its candidate SHA, ATR revision
+and vote text, then start the vote in ATR's web interface, or authorize your local
+agent to submit the prepared request using your official ATR client's identity.
+The request goes to `/api/vote/start`; it is never submitted by CI. Retain the
+returned task ID if using the API so an uncertain response can be reconciled
+without sending another vote email.
+
+Use these settings:
+
+- Trusted Vote with a minimum duration of 72 hours.
+- Notify when finished and automatically resolve when finished.
+- Automatically publish when resolved for a real release.
+- Disable automatic publication for a rehearsal.
+
+The supplied JSON sets these values, including `automatic_resolve_when_finished`
+and `automatic_publish_when_resolved`. When using the web interface, set the same
+options explicitly. The controller's public release query cannot confirm those
+per-vote automation settings; the RM owns that check when opening the vote.
+
+The controller observes the manually started Trusted Vote and requires it to
+match the recorded revision. It creates the GitHub reminder, downloads the frozen
+candidate and compares every archive, signature and checksum with the signed
+Actions artifact. A mismatch stops follow-up and asks the RM to cancel in ATR.
+Voters independently rebuild on trusted hardware, inspect the source, and submit
+their own authorized ballots through ATR's website or API. GitHub comments and
+email replies are discussion, not recorded Trusted Vote ballots.
+
+ATR resolves a passing vote and publishes its exact files to SVN. If the vote has
+not passed at expiry, the RM can cancel it in ATR; the controller does not invent a
+result or start a competing candidate. An API/client failure is reported in the
+workflow summary and persisted without discarding the candidate.
+
+The controller checks all published bytes on `downloads.apache.org` before
+advancing its baseline. It then uses the OIDC announcement action and, after ATR reports the release
+phase, creates a
+PR from the released branch back to main. Normal PR review handles conflicts.
+The next version calculation uses the successful baseline even while that PR is
+pending. Publication already in progress must be recovered using the same
+candidate; it cannot be replaced by next week's head.
+
+## Rehearse and recover
+
+Start a rehearsal from the Actions UI or:
+
+```shell
+gh workflow run weekly_release.yml --repo apache/opendal -f operation=rehearsal
+```
+
+A rehearsal uses the current main head and an unused RC number, then follows the
+same version PR, validation, signing and upload flow, followed by the RM starting
+a real Trusted Vote. Its vote
+and GitHub reminder explicitly identify it as a rehearsal. Automatic SVN
+publication is false; it never announces an official release, creates a final tag,
+synchronizes main or advances the successful baseline. Candidate data may remain
+in ATR. Rehearsal success ends at a passing vote; the RM cancels an unsuccessful
+vote in ATR.
+
+Routine ticks resume work without rebuilding completed artifacts. Rerun failed
+validation workflows through GitHub Actions. For failed compose, rerun **all jobs**
+of the original weekly run so its signing artifact and run attempt stay aligned.
+The controller adopts that run's successful retry. Once voting begins, never rerun compose for that candidate.
+
+Recovery operations take the candidate ID shown in state and the workflow summary:
+
+- `cancel`: abandon preparation, or acknowledge a vote already cancelled in ATR.
+ It refuses candidates in publication or later phases.
+- `retry-dispatch`: after confirming no workflow run was created, clear that
+ validation workflow's uncertain dispatch marker and allow another dispatch.
+- `retry-announce`: after confirming ATR did not send the announcement, allow a
+ new announcement request. Never use it merely because a response timed out.
+
+All operations have a manual Actions entry point; none requires an environment
+approval. A cancelled or failed candidate does not consume a stable version. Next
+week's fresh cutoff is recalculated from the last successful release, with a new
+RC number. An active candidate always takes precedence over starting a new one.
+
+## Validation boundary
+
+Local lifecycle tests cover preparation, manual vote handoff, fixed revisions,
+reusable compose recovery and publication follow-up. A live deployment must still
+verify the scheduled actor, repository token permissions, ATR caller-workflow
+matching and OIDC announcement. ATR's `release` phase confirms that it accepted
+the announcement; email delivery is handled asynchronously by ATR.