Functions 7452: Bundling and uploading wasm file to GCS for function extension
Issue: https://github.com/Shopify/script-service/issues/7452
WHY are these changes introduced?
To have a consistent way of uploading and obtaining extension data is core using the App Module Framework.
WHAT is this pull request doing?
This PR adds the "bundling" feature to functions and sets the output path for compilation to the bundle directory to ensure the wasm file generated is zipped and uploaded to GCS like every other extension.
The deployment plan is: This version of CLI goes out which bundles the wasm file and uploads it (existing wasm blob upload stays in place). Then on Core's side we verify we are able to obtain the wasm content and upload it to our runtime-engine bucket. Then we come back here and delete the uploadWasmBlob path and in core we throw an error when we fail to upload. TLDR: existing upload path stays in place till we can verify new path works.
How to test your changes?
Tophat this normally from your local computer since core changes are out. Run cli for dev and deploy both for an app with functions
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
- [x] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
- [x] Existing analytics will cater for this addition
- [x] PR includes analytics changes to measure impact
Checklist
- [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
- [x] I've considered possible documentation changes
Thanks for your contribution!
Depending on what you are working on, you may want to request a review from a Shopify team:
- Themes: @shopify/advanced-edits
- UI extensions: @shopify/ui-extensions-cli
- Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
- Hydrogen: @shopify/hydrogen
- Other: @shopify/app-inner-loop
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 72.67% (-0.06% π») |
8540/11751 |
| π‘ | Branches | 69.64% (-0.06% π») |
4196/6025 |
| π‘ | Functions | 71.73% (+0.02% πΌ) |
2207/3077 |
| π‘ | Lines | 73.01% (-0.06% π») |
8084/11073 |
Show files with reduced coverage π»
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / extension-instance.ts |
84.85% (-0.55% π») |
74.29% (-0.95% π») |
90.91% (-0.4% π») |
86.29% (-0.43% π») |
| π΄ | ... / extension.ts |
54.55% (-0.72% π») |
50% | 57.14% | 55.81% (-0.94% π») |
| π’ | ... / upload.ts |
80.87% (-3.91% π») |
75.41% (-4.59% π») |
84.21% (-1.16% π») |
81.37% (-4.11% π») |
| π’ | ... / ConcurrentOutput.tsx |
98.39% (-1.61% π») |
90.91% (-4.55% π») |
100% | 98.33% (-1.67% π») |
Test suite run success
1943 tests passing in 876 suites.
Report generated by π§ͺjest coverage report action from 6834807af603dbbec5dc2f131af888d5a5b5c2c1
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.
@isaacroldan @jacobsteves I added a commit to remove uploadWasmBlob and any associated logic because after my Core changes deployed I learnt that the production service account role core uses did not have an update/overwrite file access so CLI can't be writing the same file to the bucket. So I had to add the cleanup in this PR itself but that is okay since folks using this version of CLI would bundling/uploading or sending the wasm file as text over the network so it works in sync and harmony with Core. I tophatted it all.