Skip to content

chore: demo asset-canister sync plugin recipe (do not merge)#285

Draft
lwshang wants to merge 1 commit into
mainfrom
lwshang/asset-recipe-plugin
Draft

chore: demo asset-canister sync plugin recipe (do not merge)#285
lwshang wants to merge 1 commit into
mainfrom
lwshang/asset-recipe-plugin

Conversation

@lwshang
Copy link
Copy Markdown
Contributor

@lwshang lwshang commented Jun 2, 2026

Why this branch is forked 3 commits behind main

This demo needs a starting point where icp.yaml still uses the versioned recipe (type: "@dfinity/asset-canister@v2.1.0"), since the whole point is to demonstrate upgrading from that. On current main, #280 already migrated the frontend canister away from the versioned recipe to the fully-expanded build/sync form with the snapshot wasm and sync plugin, so there is no versioned recipe left to upgrade from there.

To reproduce the real upgrade path an existing user would take, this branch is forked from 4d1be64 (3 commits behind main, immediately before #280), where icp.yaml still pins the versioned recipe.

Demo only — do not merge. This PR exists to exercise the new asset-canister sync plugin recipe from dfinity/icp-cli-recipes#28. It is intentionally branched 3 commits behind main, before the assets tooling switch in #280.

What this demonstrates

An existing project pinned to @dfinity/asset-canister@v2.1.0 can upgrade to a recipe version that swaps the sync step from the built-in type: assets mechanism to type: plugin, without changing the canister wasm. The canister stays the legacy assetstorage canister; only the sync mechanism changes. This eases the upgrade path for existing asset-canister users once type: assets sync is dropped in the upcoming icp-cli release.

See dfinity/icp-cli-recipes#28 for the full rationale and the pinned plugin wasm details.

The change

icp.yaml keeps the original versioned recipe line and adds a commented-out URL line pointing at the recipe PR branch:

canisters:
  - name: frontend
    recipe:
      type: "@dfinity/asset-canister@v2.1.0"
      # type: "https://raw.githubusercontent.com/dfinity/icp-cli-recipes/refs/heads/lwshang/asset_plugin/recipes/asset-canister/recipe.hbs"

How to run the demo

  1. Deploy with the old recipe (type: "@dfinity/asset-canister@v2.1.0" active, as committed):

    icp deploy
    

    This deploys the frontend asset canister using the built-in type: assets sync.

  2. Switch to the new recipe by editing icp.yaml:

    • Comment out line 4 (the @dfinity/asset-canister@v2.1.0 line)
    • Uncomment line 5 (the raw GitHub URL line)
  3. Redeploy:

    icp deploy
    

    The same canister wasm is reused and the sync now runs through the plugin. A successful redeploy demonstrates the upgrade is fully compatible.

Add a commented-out recipe URL line pointing at the asset_plugin branch
of icp-cli-recipes so reviewers can switch the frontend canister's sync
mechanism from the built-in assets step to the plugin without changing
the canister wasm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant