feat: revamp plugin system - #1683
Open
jescalada wants to merge 12 commits into
Open
Conversation
I'm skipping this from the architecture guide for now, since it's only relevant to plugin users
✅ Deploy Preview for endearing-brigadeiros-63f9d0 canceled.
|
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1683 +/- ##
==========================================
- Coverage 90.26% 87.13% -3.14%
==========================================
Files 94 104 +10
Lines 9115 9799 +684
Branches 1705 1748 +43
==========================================
+ Hits 8228 8538 +310
- Misses 854 1226 +372
- Partials 33 35 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
phase: Which phase in the chain to executedisplayName: User-facing string for sideband streaming and auditsisCollectible: Same as regular processors, non-critical errors allow chain to continue running, errors are collected in the endchains: Which push chains to run the plugin for (ATM: tags, branches or both)Description
Note: This PR was human-written, and I would appreciate your human thoughts on it 😃
It revamps the plugin system to allow inserting plugins into specific phases in each chain. It also adds
PluginOptionsto configure the plugindisplayName,isCollectibleandchainsproperties.Each chain is divided into
Phases, which are consideredChainElements. Both plugins and chain elements are resolved into executable actions (ProcessorExec).This allows plugins to access certain
Actionfields that get populated later on, such as the push diff in theAFTER_DIFFphase.For example:
Each phase along with the guaranteed properties is described in the updated plugin documentation.
CustomSecretScanner plugin execution
This simple plugin demonstrates how to access the diff and scan it - previously not possible:
Related Issue
Resolves #
The idea of phases was already introduced by @dcoric in #1639. I expanded on it and focused on plugin revamp specifically.
I think safe, accurate pull scanning (supply chain scans) cannot actually be done via plugins at the moment: if we naively pull the diff using
simpleGitwithin a plugin, we end up getting only the default branch (thus a user pulling a different, compromised branch wouldn't be detected), and on top of that the scan would complete first and then trigger a second "authorized" pull, thus if a vulnerability was introduced right after the scan finished, the user would be able to pull it anyways.As a follow-up to this PR. I'd like to rewrite the pull chain logic to actually obtain the data requested by the user
git pull <specific-branch>, store it in the action so it's extensible via plugins, and finally forward thegit pullresult to the user.Checklist
General
Documentation
Tests
npm test)npm run lintandnpm run format:check)npm run check-types)