[build-tools] unify workflows hook#3957
Open
hSATAC wants to merge 3 commits into
Open
Conversation
Signed-off-by: Ash Wu <hsatac@gmail.com>
…ntion Signed-off-by: Ash Wu <hsatac@gmail.com>
Signed-off-by: Ash Wu <hsatac@gmail.com>
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3957 +/- ##
==========================================
+ Coverage 59.28% 59.38% +0.11%
==========================================
Files 935 936 +1
Lines 41093 41204 +111
Branches 8660 8689 +29
==========================================
+ Hits 24356 24465 +109
- Misses 16643 16645 +2
Partials 94 94 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
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.
Why
Workflow hooks (
before_install_node_modules,before_submit, …) are currently spliced into the generatedsteps[]on the server, with every job type wiring them by hand, and they silently don't work in managed native builds. We're unifying this so the server sendsjob.hookson the payload and the worker inserts the steps itself — one implementation, one set of semantics (ENG-22614).This PR is the worker half and ships dormant: insertion is gated on
job.hooksbeing present, which the server doesn't send yet, so there is no behavior change until the server side switches over.How
@expo/eas-build-jobgains aHOOK_ANCHORSregistry — the single source of hook anchor names. Function-bound anchors carry afunctionId(e.g.eas/install_node_modules); the parser resolves anchors through a reverse map at parse time, so the functions themselves need no changes.ShellStepZ(__hook_id, or the__hook_before_id/__hook_after_idpair for split placements like maestro_cloud). The values are loose strings on purpose, never enums — an older worker must treat anchor names newer than itself as inert metadata.StepsConfigParsertakes a new requiredhooksoption and splices hook steps around anchor occurrences. This also works inside function-group expansions (uses: eas/build), which required retaining the originating function on expanded steps (BuildStep.sourceFunction— expansion used to drop that identity).after_xruns iff its anchor executed, whether it passed or failed.BuildStepgains arunAfterStepgate checked inshouldExecuteStep; a user-suppliedif:is AND-ed with the gate, sosuccess()/failure()keep their meaning andalways()cannot bypass the gate.BuildConfigErrornaming the key.Inserting N hook step(s) for anchor …); that is the signal we'll build the silent-drop metric on before the server-side rollout.One deliberate restriction: a function group inside an after hook is rejected at parse time — the group API has no channel to gate its expanded steps on the anchor, so they would run even when the anchor was skipped. Groups in before hooks are unaffected.
Test Plan
~40 new unit tests across the three packages: insertion positions for function and shell anchors (including hooks landing inside a real
uses: eas/buildexpansion), split-pair gating, no-nesting, multi-occurrence, gate semantics, skew cases (unknown keys and anchors stay inert), and dormancy (nojob.hooks→ identical parse output). Registry consistency tests assert everyfunctionIdnames a registered eas function and that no function-group id shadows one. Existing suites across all packages are unchanged and green.