npx netlify-cli deploy \
--dir=build \
--functions=src/functions/build \
--site="$NETLIFY_PROD_SITE_ID" \
--alias="canary" \
--message="Branch deploy: canary@<commit-sha>"
-
We use the above command on our CI/CD runners to deploy our
canarybranch. -
This creates a branch deploy (not a production deploy) on the production Netlify site (xyz.netlify.app), accessible at the alias URL
canary--xyz.netlify.app. The edge function in split-test.ts is what routes traffic to this branch deploy based on the cookie. -
Our
masterbranch is set as Production deploy -
We have custom logic to route our users to the canary branch deploy when they visit our production site
-
Whenever a new deploy is published to the canary alias, the actual endpoint
canary--xyz.netlify.appstill points to the permalink from the previous deployid in netlify and we have to manually delete the old deployment for the url to point to the latest permalinkFor context:
We were previously using the split test functionality to enable canary testing between the master and the canary branches
