[PR #5669] [MERGED] Improve asset matching in fetch_and_deploy_gh_release for prebuild and singlefile modes #5987

Closed
opened 2025-11-20 07:08:31 -05:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/5669
Author: @MickLesk
Created: 7/3/2025
Status: Merged
Merged: 7/3/2025
Merged by: @MickLesk

Base: mainHead: f_d_extension


📝 Commits (5)

📄 Description

✍️ Description

This PR enhances the fetch_and_deploy_gh_release function to support glob-style pattern matching for GitHub asset selection in prebuild and singlefile modes. This allows for flexible filename targeting across versions and architectures.

What's Changed
Improved pattern matching logic:
Replaced brittle checks with robust case-based matching on the asset filename only, not the full URL.

Supports wildcard patterns (e.g.):

fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz"

Strips optional quotes from passed $6 parameter (pattern="${6%"}"; pattern="${pattern#"}"), allowing consistent quoted usage without breaking pattern interpretation.

Expands supported archive formats:
.tar.xz and other tar.* formats are now extracted properly using tar -xf.

🧠 Technical Notes
Matching now runs on: filename_candidate="${u##*/}" → avoids matching failures caused by full GitHub URLs
case "$filename_candidate" in $pattern) ensures native glob support
No dependency on regex, which avoids escaping complexity and improves maintainability

🧪 Tested With
Trilium (prebuild): TriliumNotes-Server-v0.96.0-linux-x64.tar.xz
Argus (singlefile): Argus-*.linux-amd64

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/5669 **Author:** [@MickLesk](https://github.com/MickLesk) **Created:** 7/3/2025 **Status:** ✅ Merged **Merged:** 7/3/2025 **Merged by:** [@MickLesk](https://github.com/MickLesk) **Base:** `main` ← **Head:** `f_d_extension` --- ### 📝 Commits (5) - [`2665975`](https://github.com/community-scripts/ProxmoxVE/commit/2665975fcfdfddf52c8c0cb19c2c451e5f7459ac) Improve asset matching in fetch_and_deploy_gh_release for prebuild and singlefile modes - [`a54d755`](https://github.com/community-scripts/ProxmoxVE/commit/a54d755f10eb3d89ccc3d993f89579b31e2303a5) tar globbing - [`3a7239e`](https://github.com/community-scripts/ProxmoxVE/commit/3a7239e9f8894c6d53d312fa493415aa66b5895c) Merge branch 'main' into f_d_extension - [`80be8ff`](https://github.com/community-scripts/ProxmoxVE/commit/80be8ff2dc399000d0e3dc57a08802e8cbf63921) Update tools.func - [`4b4cf88`](https://github.com/community-scripts/ProxmoxVE/commit/4b4cf882617fc43bd08818e22404b103f3d9ad92) Merge branch 'f_d_extension' of https://github.com/community-scripts/ProxmoxVE into f_d_extension ### 📄 Description ## ✍️ Description This PR enhances the fetch_and_deploy_gh_release function to support glob-style pattern matching for GitHub asset selection in prebuild and singlefile modes. This allows for flexible filename targeting across versions and architectures. ✨ What's Changed Improved pattern matching logic: Replaced brittle [[ "$u" == $pattern ]] checks with robust case-based matching on the asset filename only, not the full URL. Supports wildcard patterns (e.g.): ```bash fetch_and_deploy_gh_release "Trilium" "TriliumNext/Trilium" "prebuild" "latest" "/opt/trilium" "TriliumNotes-Server-*linux-x64.tar.xz" ``` Strips optional quotes from passed $6 parameter (pattern="${6%\"}"; pattern="${pattern#\"}"), allowing consistent quoted usage without breaking pattern interpretation. Expands supported archive formats: .tar.xz and other tar.* formats are now extracted properly using tar -xf. 🧠 Technical Notes Matching now runs on: filename_candidate="${u##*/}" → avoids matching failures caused by full GitHub URLs case "$filename_candidate" in $pattern) ensures native glob support No dependency on regex, which avoids escaping complexity and improves maintainability 🧪 Tested With Trilium (prebuild): TriliumNotes-Server-v0.96.0-linux-x64.tar.xz Argus (singlefile): Argus-*.linux-amd64 ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [x] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [ ] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2025-11-20 07:08:31 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#5987