Deploy Code sends the whole project to an instance in one go. It zips every linked cartridge and module, uploads the archives to the selected code version and unzips them on the server, which is much faster than uploading thousands of files one by one. Use it for the first sync of a new code version, after switching branches, or to update several instances at once with Multi Targets
Deploy to the selected instance
Pick the target
Choose the instance with Select Connection and the code version with Select Code Version in the main toolbar
Start the deploy
Click the Deploy Code button , or press Cmd+Ctrl+Z on macOS (Ctrl+Meta+Z elsewhere, see Keyboard shortcuts). The arrow next to the button opens the same action under Deploy to Selected Instance
Confirm
The Deploy Code to dialog shows the host, how many cartridges, B2C modules and global modules will be deployed, and a Confirm Code Version list with the version that is active on the instance marked. Check the version and click Deploy
Follow the progress
B2C Sync Log prints every step on the connection's tab. While a deploy runs, the button reads "Wait for..." and other WebDAV jobs wait
Deploying doesn't activate the code version. If the storefront should run it, activate it in B2C Explorer, see OCAPI & Jobs, or in Business Manager
What a deploy does
- Runs the Tasks before code deployment, if you set any up, see Deployment Configurations
- Finds the linked cartridges and modules ("Found 12 cartridges and modules to upload") and zips each one separately, printing every archive with its size and the total
- Removes the old copies from the code version. By default only the cartridges and modules being deployed are removed, everything else in the version stays. With Full Cleanup of the Code Version on, the whole version is emptied first
- Uploads the archives, the largest first, as many at a time as Concurrent Threads in Settings allows
- Unzips each archive on the server and deletes the uploaded zip
- Prints a summary with the instance, code version, number of uploaded items, total zipped size and duration
When something fails, the summary reads "CODE DEPLOYMENT COMPLETED WITH ERRORS", lists the failed cartridges and asks you to run the deploy again
Deploy to several instances
Multi Targets deploy the same code to a named set of instances at the same time, each with its own code version. Typical sets are all staging instances of a region, or every developer sandbox of a team
- Open the arrow next to Deploy Code › Edit Deployment Configurations... and go to the Multi Targets tab
- Click + to open Add Multi Target. Enter a Name, for example "NAM-EMEA Staging"
- On the Instances tab, add at least two instances with Add Instance and click a Code Version cell to choose its version. Sync Instances Code Versions reloads the versions from all instances
- Optionally, on the Tasks tab add run configurations to run Before code deployment and After code deployment
- Save. The target now appears under Deploy to Multiple Instances in the Deploy Code popup
Choosing a target asks you to confirm the list of instances, then deploys to all of them in parallel. If a connection in a target was changed or removed, the plugin warns that the target needs to be updated
Deployment Configurations
Open it from the arrow next to Deploy Code › Edit Deployment Configurations...
| Tab | Setting | Default | What it does |
|---|---|---|---|
| General | Full Cleanup of the Code Version | Off | On: empty the whole code version before every deploy. Off: replace only the cartridges and modules being deployed |
| Tasks | Tasks before code deployment | None | Run configurations from the IDE, for example an npm build, that run before a deploy to the selected instance. Edit limits a task to some instances (include or exclude). Reorder them with the arrows |
| Multi Targets | Named instance sets | None | See Deploy to several instances |
A task that fails stops the deploy with "[SFCC] ... task failed with an error". Fix it and deploy again. Renaming a run configuration removes it from the task list, so add it again after a rename
Code versions
The plugin uploads to the selected code version of the active connection. That is a local choice. The active code version is the one the instance runs, and it changes only when you activate one
| Control | Where | What it does |
|---|---|---|
| Select Code Version | Main toolbar | Shows the selected version. The popup lists all versions, marks the active one "[Active on instance]", and has Add Code Version at the top |
| Refresh Code Versions | Main toolbar | Reloads the list from the instance |
| Code Version | Connections Settings | The same selection, plus Add Code Version |
| Code versions folder | B2C Explorer | One folder per version, with Select Code Version, and with OCAPI on Activate Code Version and Activate and Select Code Version |
Clean a code version
Clean active code version removes every file from a code version. It asks you to confirm the host and the version first, so you can clean a version other than the selected one
- Tools › Salesforce B2C Commerce › Clean active code version
- More › Instance › Clean active code version
Ctrl+Shift+Xon Windows and Linux,Cmd+Shift+Xon macOS
Troubleshooting
| Symptom | What to do |
|---|---|
| Deploy Code is missing | The project has no linked cartridge or no active connection. See Cartridges & Modules |
| Nothing happens from Tools › Salesforce B2C Commerce › Deploy Code | That menu entry doesn't start a deploy. Use the toolbar button or Cmd+Ctrl+Z |
| "Please merge your duplicate cartridges into one or exclude any of them" | Two linked folders have the same cartridge name. Unlink or exclude one of them |
| "Failed to get code versions. Unable to connect to instance." | The connection fails. Use Edit Connection and run Test Connection |
[401] Invalid credentials in the log | The account or WebDAV access key is wrong for this host |
| The deploy finished but the storefront is unchanged | Check that the deployed version is the active one, and that the site's cartridge path includes your cartridges |