-
Notifications
You must be signed in to change notification settings - Fork 4
fix: consolidate per-platform SHA512SUMS into single file to avoid upload collisions #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -203,8 +203,18 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Combine all per-artifact SHA512SUMS into a single file at the workspace root. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # This mirrors the common open-source convention (e.g. Node.js SHASUMS256.txt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # and avoids GitHub Release asset name collisions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| combined_sha="SHA512SUMS" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| find clang-tools-* -name SHA512SUMS -type f -print0 | xargs -0 cat > "$combined_sha" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Created combined $(wc -l < "$combined_sha")-entry $combined_sha" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Remove the per-artifact SHA512SUMS files so they are not uploaded individually. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| find clang-tools-* -name SHA512SUMS -type f -delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Collect all files and upload one-by-one with a small delay | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapfile -t files < <(find clang-* -type f) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| mapfile -t files < <(find clang-tools-* -type f) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+210
to
+217
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Guard the If no artifact directories were downloaded, Bash leaves Suggested fix+ shopt -s nullglob
+ artifact_dirs=(clang-tools-*)
+ if [[ ${`#artifact_dirs`[@]} -eq 0 ]]; then
+ echo "::warning::No artifact directories found"
+ exit 0
+ fi
+
combined_sha="SHA512SUMS"
- find clang-tools-* -name SHA512SUMS -type f -print0 | xargs -0 cat > "$combined_sha"
+ find "${artifact_dirs[@]}" -name SHA512SUMS -type f -print0 | xargs -0 cat > "$combined_sha"
echo "Created combined $(wc -l < "$combined_sha")-entry $combined_sha"
# Remove the per-artifact SHA512SUMS files so they are not uploaded individually.
- find clang-tools-* -name SHA512SUMS -type f -delete
+ find "${artifact_dirs[@]}" -name SHA512SUMS -type f -delete
# Collect all files and upload one-by-one with a small delay
- mapfile -t files < <(find clang-tools-* -type f)
+ mapfile -t files < <(find "${artifact_dirs[@]}" -type f)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [[ ${#files[@]} -eq 0 ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "::warning::No files found to upload" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -213,8 +223,9 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Found ${#files[@]} files to upload" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| failed=0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Upload versions.json | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Upload top-level metadata files first (no filename conflicts) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| upload_with_retry "versions.json" || failed=1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| upload_with_retry "SHA512SUMS" || failed=1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for file in "${files[@]}"; do | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| upload_with_retry "$file" || failed=1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| sleep 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Fail fast when an artifact is missing its
SHA512SUMS.This currently uploads whatever checksum files happen to exist. If one
clang-tools-*artifact is missing its localSHA512SUMS, that asset still gets released but disappears from the consolidated root file, which breaks the documented verification contract forsha512sum -c SHA512SUMS --ignore-missing.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents