Managing Code Versions

A code version is a folder that contains custom cartridges. An instance uses the currently active code version. You can upload additional code versions to the server via WebDAV or UX Studio. These can be new code versions that will be activated later, or previous ones to allow for code rollbacks.

A compatibility mode can be assigned to each code version; and is activated when the code version is activated. Code versions that have not been explicitly assigned to a compatibility mode are marked with an asterisk (*), and assume the current active compatibility mode. Selectable compatibility modes are those that are newer than the active compatibility mode, in addition to the previously active compatibility mode. You can't select a compatibility mode that is older than the previously active one.

Salesforce B2C Commerce automatically and asynchronously removes the oldest code versions on all instance types. The active code version and the previously active code version are not included in this process. You can configure the number of retained code versions (see below).

  1. Select Administration > Sites > Manage Sites. You must assign custom cartridges to sites.
  2. Select Administration > Site Development > Code Deployment, you can manage code versions.
  3. On the Manage Code Versions page, there are two timestamp columns:
    • Modification time: Ddate and time the code was created or last updated on the instance.
    • Activation time: Date and time of the last code activation.

      The timestamp changes after an activation, roll back (for the new active version), or replication. Code versions that were not activated don't show an activation time, for example, a new code version.

      If you upload code changes without creating a new cartridge, activation time represents the date and time the code initially went live on a Production instance.

  4. Click a link in the Code Version column.
    The Version Summary page opens, where you can drill down into the code via WebDAV.
  5. Click a compatibility mode link to view a list of available compatibility modes.

    The Compatibility Mode page opens with a list of available compatibility modes.

    • The currently active compatibility mode
    • The previously active compatibility mode
    • Any new compatibility modes that you can select
    Each compatibility mode provides a Change Docs link that provides a summary of applicable changes and a Documentation link to the respective API documentation.
  6. Click Back to return to the Manage Code Versions page.
  7. To rename a code version, click Rename beside a code version in the list.
    Renaming a code version also changes the respective entries in the version file.
  8. To activate a code version, click Activate beside a code version in the list.

    It isn't possible to select a compatibility mode older than the previously active one.

    A code version is activated by adding its folder to the list of folders in which the server looks up resources. At the same time, the folder of the previous active code version is removed from the list.

    The features included in the new code version are immediately available. Cached items (which might be dependent on a change to the compatibility mode) are cleared after activating a new code version.

  9. Click Rollback to automatically activate the previous code version, if this code version is still installed.
    If the previous code version is no longer available (it has been deleted), the rollback fails. The action also activates the compatibility mode associated with the previous code version.
  10. Select one or more inactive code versions and click Delete to delete them. You can't delete the active code version.
  11. Click Add to create a new empty code version. The new code version will be set to the currently active compatibility mode.
    To protect B2C Commerce against directory traversal attempts when creating or renaming a custom code version, an exception is thrown on any attempts to access a parent directory or sub-directory. For example, you can't pass my/new/version when creating or renaming a custom code version. The effective version name is the end of the expression, in this case, version. This type of input results in an error.
  12. To configure the number of retained code versions:
    Specifies the number of code versions to retain. The system will automatically and asynchronously remove the oldest code versions. The active code version and the previously active code version are never removed automatically. Provide a value between 3 and 20.
    1. Select Administration > Site Development > Code Deployment (admin user only).
    2. In the Code Version Retention section, enter the number of retained code versions (3 to 20, the default is 10).
      The initial value for existing customers is 0, which means that the feature is disabled. If you activate this feature (by setting a value other than 0) only Commerce Cloud Support can reset it to 0. All newly provisioned instances have a default of 10.
    3. Click Apply.
  13. To work with a single version:
    1. Click the code version name link.

      The Code Version Summary page opens.

      This page provides a detail view of the code version. The top section provides summary information, while the bottom section provides a paged list view of resources that are part of the code version. The list view shows files regardless of where they are located within the code version (that is, regardless of cartridge and subdirectory).

    2. Click Activate to activate this code version.
    3. Click Download in the top section to download the entire code version, or click Download beside an individual file to download that file.
    4. Use the File Filter to search for a file or set of files.