cli icon indicating copy to clipboard operation
cli copied to clipboard

Functions 7452: Bundling and uploading wasm file to GCS for function extension

Open saga-dasgupta opened this issue 1 year ago β€’ 4 comments

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

saga-dasgupta avatar Sep 12 '24 19:09 saga-dasgupta

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

github-actions[bot] avatar Sep 12 '24 19:09 github-actions[bot]

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

github-actions[bot] avatar Sep 17 '24 16:09 github-actions[bot]

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.

github-actions[bot] avatar Sep 17 '24 16:09 github-actions[bot]

@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.

saga-dasgupta avatar Sep 27 '24 15:09 saga-dasgupta