Skip to content

Commit b052ba7

Browse files
committed
[fix][release] Skip docker build record artifacts when staging release
Recent release workflow runs include auxiliary *.dockerbuild artifacts uploaded by docker/build-push-action. Our staging script downloaded every artifact from the workflow run and tried to unzip them as release packages, which caused stage-release.sh to fail with BadZipFile before the actual napi tarballs were processed.\n\nSkip *.dockerbuild artifacts in download-release-artifacts.py and keep the error message explicit for unexpected non-zip artifacts so release managers can stage 1.17.x and master builds again.
1 parent b6dee92 commit b052ba7

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

build-support/download-release-artifacts.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
name = artifact['name']
5454
url = artifact['archive_download_url']
5555

56+
# docker/build-push-action uploads build records as auxiliary artifacts.
57+
# They are not release packages and break the staging flow if we try to
58+
# unpack them alongside the platform tarballs.
59+
if name.endswith('.dockerbuild'):
60+
print(f'Skipping auxiliary artifact {name}')
61+
continue
62+
5663
print(f'Downloading {name} from {url}')
5764
artifact_response = requests.get(url, headers=headers, stream=True)
5865
artifact_response.raise_for_status()
@@ -65,13 +72,20 @@
6572
try:
6673
dest_dir = os.path.join(dest_path, name)
6774
Path(dest_dir).mkdir(parents=True, exist_ok=True)
68-
with zipfile.ZipFile(tmp_zip_path, 'r') as z:
69-
z.extractall(dest_dir)
75+
try:
76+
with zipfile.ZipFile(tmp_zip_path, 'r') as z:
77+
z.extractall(dest_dir)
78+
except zipfile.BadZipFile as exc:
79+
raise RuntimeError(
80+
f'Artifact {name} is not a ZIP archive. '
81+
'This usually means the workflow uploaded a non-release '
82+
'auxiliary artifact that should be filtered out.'
83+
) from exc
7084
finally:
7185
os.unlink(tmp_zip_path)
7286

7387
for root, dirs, files in os.walk(dest_path, topdown=False):
7488
for name in files:
7589
shutil.move(os.path.join(root, name), dest_path)
7690
if not os.listdir(root):
77-
os.rmdir(root)
91+
os.rmdir(root)

0 commit comments

Comments
 (0)