Release: retry transient asset verification failures
Modular container CI / release-build (push) Successful in 20m45s
Signed modular release / publish (push) Successful in 18m32s
Nightly product integration / publish-nightly (push) Successful in 20m47s

This commit is contained in:
faumaray committed 2026-07-30 04:14:52 +03:00
1 parent 4f8a46b0c4
commit 9236dc844b
2 files changed
+59 -12

No files matched your search

+32
View File
@@ -32,6 +32,7 @@ class State:
self.fail_upload_attempt: int | None = None
self.downloads = 0
self.draft_download_attempts = 0
self.transient_download_failures = 0
self.tag_protections = [
{
"id": 1,
@@ -84,6 +85,10 @@ class Handler(BaseHTTPRequestHandler):
def do_GET(self) -> None:
target = urlsplit(self.path)
if target.path.startswith("/downloads/"):
if self.server.state.transient_download_failures:
self.server.state.transient_download_failures -= 1
self.close_connection = True
return
asset_id = int(target.path.split("/")[2])
if any(
release["draft"]
@@ -355,6 +360,33 @@ class GiteaReleaseTest(unittest.TestCase):
self.assertIn("download verification failed", failed.stderr)
self.assertEqual(self.server.state.uploads, 2)
def test_publish_retries_a_transient_download_failure(self) -> None:
artifacts = Path(self.temporary.name, "artifacts")
artifacts.mkdir()
Path(artifacts, "one.bin").write_bytes(b"first")
target = "0123456789abcdef0123456789abcdef01234567"
self.server.state.tags["v1.2.3"] = target
self.server.state.transient_download_failures = 1
self.run_script(
"publish",
"--owner",
"Void",
"--repo",
"Echoion",
"--tag",
"v1.2.3",
"--target",
target,
"--name",
"Echoion 1.2.3",
"--body",
"test release",
"--artifacts",
os.fspath(artifacts),
)
self.assertEqual(self.server.state.transient_download_failures, 0)
self.assertEqual(self.server.state.downloads, 1)
def test_publish_creates_a_missing_nightly_tag_idempotently(self) -> None:
artifacts = Path(self.temporary.name, "artifacts")
artifacts.mkdir()