Deploy Code

Zip and deploy every linked cartridge to one or many instances, manage code versions and clean them

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

The deploy button zips every linked cartridge and module, uploads them to the chosen code version, unzips them on the server and prints a summary in B2C Sync Log

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

  1. Runs the Tasks before code deployment, if you set any up, see Deployment Configurations
  2. 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
  3. 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
  4. Uploads the archives, the largest first, as many at a time as Concurrent Threads in Settings allows
  5. Unzips each archive on the server and deletes the uploaded zip
  6. 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

  1. Open the arrow next to Deploy Code › Edit Deployment Configurations... and go to the Multi Targets tab
  2. Click + to open Add Multi Target. Enter a Name, for example "NAM-EMEA Staging"
  3. 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
  4. Optionally, on the Tasks tab add run configurations to run Before code deployment and After code deployment
  5. 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...

TabSettingDefaultWhat it does
GeneralFull Cleanup of the Code VersionOffOn: empty the whole code version before every deploy. Off: replace only the cartridges and modules being deployed
TasksTasks before code deploymentNoneRun 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 TargetsNamed instance setsNoneSee 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

ControlWhereWhat it does
Select Code Version Main toolbarShows 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 toolbarReloads the list from the instance
Code VersionConnections SettingsThe same selection, plus Add Code Version
Code versions folderB2C ExplorerOne 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+X on Windows and Linux, Cmd+Shift+X on macOS

Troubleshooting

SymptomWhat to do
Deploy Code is missingThe project has no linked cartridge or no active connection. See Cartridges & Modules
Nothing happens from Tools › Salesforce B2C Commerce › Deploy CodeThat 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 logThe account or WebDAV access key is wrong for this host
The deploy finished but the storefront is unchangedCheck that the deployed version is the active one, and that the site's cartridge path includes your cartridges

On this page