Skip to content

Allow configuring the plugin-git version for local backend clone - #7536

Merged
6543 merged 5 commits into
woodpecker-ci:mainfrom
AhmadNajiKam:fix/local-plugin-git-download
Nov 11, 2026
Merged

6543 merged 5 commits into
woodpecker-ci:mainfrom
AhmadNajiKam:fix/local-plugin-git-download

Conversation

@AhmadNajiKam

@AhmadNajiKam AhmadNajiKam commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

When plugin-git is not in $PATH, the local backend downloads it for the clone step. Until now it always used the latest release.

This PR:

  • adds WOODPECKER_BACKEND_LOCAL_PLUGIN_GIT_VERSION (default latest) so a specific release can be used, e.g. 2.12.1
  • finds the release through the GitHub API (releases/latest or releases/tags/<version>) and picks the binary whose name contains the OS and architecture, so changes to file names don't break it
  • gives separate errors for a version that doesn't exist and a release that has no binary for this OS/architecture
  • matches file names on whole OS/architecture parts, so linux/arm no longer picks linux-arm64_plugin-git
  • treats responses other than 200 as errors instead of writing an error page as the binary
  • adds tests and documents the new option

There is no checksum verification: checksums.txt comes from the same release as the binary, so it wouldn't catch a tampered release. Once releases are signed, signature verification can be added.

Closes #7531

When plugin-git is not in $PATH, the local backend downloads it from
GitHub. That download ignored the HTTP status, so an error page was
saved, made executable and run, and the clone step failed with
"exec format error". The binary was not checked against the release
checksums. The version could not be pinned. Assets were matched with
strings.Contains, so GOARCH=arm got the arm64 binary.

Download from the release download URLs instead of going through the
GitHub API. Build the asset name exactly from GOOS/GOARCH. Fail on
non-200 responses. Check the binary against the release's
checksums.txt before writing it to disk. Add
WOODPECKER_BACKEND_LOCAL_PLUGIN_GIT_VERSION (default "latest") to pin
the version.
Comment thread pipeline/backend/local/clone.go Resolved
@6543

6543 commented Nov 10, 2026

Copy link
Copy Markdown
Member

also I dont see any value in checking the checksumm because they arrive via the same channel ... so if one can taint/change the binary he can also change the checksum ...

... if we sign the releases at some point that would be a different storry :)

@6543

6543 commented Nov 10, 2026

Copy link
Copy Markdown
Member

PS: i would redirect this pull th allow specify the git clone version ...

Add WOODPECKER_BACKEND_LOCAL_PLUGIN_GIT_VERSION (default "latest") to
choose which plugin-git release the local backend downloads when no
plugin-git binary is found in $PATH.

Drop the checksum verification: checksums.txt is served from the same
release as the binary, so it adds no protection against a tampered
release. This can be revisited once releases are signed.

Also move pluginGitReleaseURL to the top of clone.go.
@AhmadNajiKam AhmadNajiKam changed the title Verify plugin-git download in local backend Allow configuring the plugin-git version for local backend clone Nov 10, 2026
@6543 6543 added enhancement improve existing features backend/local labels Nov 10, 2026
Comment thread pipeline/backend/local/clone.go Resolved
@woodpecker-bot

woodpecker-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Surge PR preview deployment was removed

@codecov

codecov Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.63636% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.58%. Comparing base (e58fe79) to head (91cca7d).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
pipeline/backend/local/clone.go 88.37% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7536      +/-   ##
==========================================
+ Coverage   66.40%   66.58%   +0.18%     
==========================================
  Files         449      449              
  Lines       22478    22487       +9     
==========================================
+ Hits        14926    14973      +47     
+ Misses       7552     7514      -38     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Find the release (latest or the configured version) through the GitHub
API and pick the binary by OS/arch, so a missing version and a missing
platform binary give separate errors. Match whole name parts so
linux/arm no longer picks the arm64 binary.
Comment thread pipeline/backend/local/clone.go Resolved
@6543
6543 merged commit 83f79a1 into woodpecker-ci:main Nov 11, 2026
9 checks passed
@woodpecker-bot woodpecker-bot mentioned this pull request Nov 11, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/local enhancement improve existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local backend downloads and runs plugin-git without verifying it

3 participants