Exclude objects from CI/CD

Continuous Integration and Continuous Deployment allow you to exclude specific types of objects if you do not wish to synchronize or deploy all supported types. You can also exclude individual objects of a type that is otherwise included.

Continuous Integration environments

Always use the same CI repository configuration settings across your entire development environment to maintain consistency. Whenever you make any changes, use your source control system to synchronize the configuration file and the other repository content. When a developer loads a new version of the configuration file from the source control, the new settings apply after restoring objects into the database or manually restarting the application.

All related configuration is defined within a configuration file in the root of the CI/CD repository (repository.config). Use the following process if you need to make changes:

  1. Edit the repository configuration file.

  2. Adjust the configuration according to your object filtering requirements. See the following sections for details:

  3. Save the file.

  4. Run the store command for all objects to bring your repository into the required state.

Excluding objects in the configuration file affects both store and restore actions for CI/CD.

Object removal due to dependencies

Objects excluded in the configuration file may still be deleted when restoring data from the repository due to parent-child relationships and other dependencies. For example, even if you have setting keys excluded, the system still deletes setting keys that belong within a given setting category if you “restore” the deletion of the category.

Exclude object types

By editing your repository configuration file, you can configure the system to ignore certain object types within CI/CD:

  1. Add <ObjectType> elements into one of the following sections of the config file:

    • <IncludedObjectTypes> – defines an allowlist of object types. If you specify one or more object types, only objects of the given type are processed. No restrictions apply if the allowlist is empty.
    • <ExcludedObjectTypes> – defines a denylist of object types. All included object types are processed except for the listed types.
  2. Set the values of individual <ObjectType>elements to the names of object types supported by CI/CD.

    To find the ObjectType values, check the names of the corresponding folders in the repository folder.

The system uses the following rules to automatically exclude child and binding objects:

  • Child object types follow the configuration of their parent object type.
  • Binding object types are excluded if all object types within the given relationship are excluded.

The <IncludedObjectTypes> allowlist only allows you to specify the main object types (i.e. not child types or bindings).

In the <ExcludedObjectTypes> denylist, you can exclude both the main object types and specific binding or child object types.

Example


<?xml version="1.0" encoding="utf-8"?>
<RepositoryConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <!-- Only includes email channel objects. However, sender addresses under email channels are excluded. -->
    <IncludedObjectTypes>
        <ObjectType>cms.channel</ObjectType>
        <ObjectType>emaillibrary.emailchannel</ObjectType>  
    </IncludedObjectTypes>
    <ExcludedObjectTypes>
        <ObjectType>emaillibrary.emailchannelsender</ObjectType>
    </ExcludedObjectTypes>
</RepositoryConfiguration>

Exclude individual objects

You can exclude individual objects from CI/CD by editing your repository configuration file. The system combines the filtering rules for individual objects with existing rules for entire object types.

  1. Add the following elements into the <ObjectFilters> section:

    • <IncludedCodeNames> – defines an allowlist of objects. If you specify one or more object code names, only matching objects are processed. No restrictions apply if the allowlist is empty.
    • <ExcludedCodeNames> – defines a denylist of objects. Adds further filtering for the set of included objects. Objects that match the specified code names are excluded from processing.
  2. Specify the type of objects that you wish to exclude for each <IncludedCodeNames> and <ExcludedCodeNames> element:

    • If you do not set the ObjectType attribute for the element, it applies to objects of ALL types.

    • To apply the filtering rule to a specific object type, set the element’s ObjectType attribute to the given object type name.

      • You can use both main object types and child types (that are included in your CI/CD configuration).
      • Binding types typically do not have a code name field, so they cannot be used.
      • Rules for specific object types override rules for all object types. You can disable rules for all object types by adding empty <IncludedCodeNames> or <ExcludedCodeNames> elements for individual object types.
      • Do not add multiple elements for the same object type. Instead, use multiple values separated by semicolons and/or wildcards.
  3. Within the content of each <IncludedCodeNames> and <ExcludedCodeNames> element, list the code names of objects to exclude or include.

    • Add the % wildcard to the end or start of the code name entry to cover multiple objects with a shared code name prefix or suffix. Using only the % wildcard as the value represents all objects of the given type.
    • You can add multiple code name entries for a single object type, separated by semicolons.
    • The code name values are case insensitive.

When you exclude an object using either the allowlist or denylist, the system automatically excludes dependent objects according to the following rules:

  • Child objects – all child objects are excluded together with their parent. For example, excluding a country object excludes all states under the given country.

  • Binding objects – binding objects are automatically excluded if at least one of the related objects is excluded.

  • Channel objects – excluding a channel automatically excludes all channel-specific objects belonging to the given channel. When excluding channels, exclude based on the cms.channel object type, not the specific channel configuration objects emaillibrary.emailchannel or cms.websitechannel.

    • Objects that are only connected to channels through bindings are not excluded.

Notes

  • It is not possible to exclude objects without a code name field.
  • The object exclusion rules apply globally across all objects and channels.
  • It is not possible to exclude web pages based on their page path. However, you can use code name exclusion with a predetermined code name prefix or suffix to achieve the same result.
Example


<?xml version="1.0" encoding="utf-8"?>
<RepositoryConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:x="http://www.w3.org/2001/XMLSchema-instance">
    <!-- Includes all supported object types -->
    <IncludedObjectTypes>
    </IncludedObjectTypes>
    <ExcludedObjectTypes>
    </ExcludedObjectTypes>
    <ObjectFilters>
        <!-- Excludes all content items (reusable, pages, emails) whose code name starts with 'Banner'.
             Always use the 'cms.contentitem' object type to filter content items. 
             Filtering based on other entities that compose content items can lead to 
             repository inconsistencies and incorrect behavior. -->
        <ExcludedCodeNames ObjectType="cms.contentitem">Banner%</ExcludedCodeNames>

        <!-- Excludes all objects of any type whose code name starts with the "test" prefix, except for users -->
        <ExcludedCodeNames>test%</ExcludedCodeNames>
        <ExcludedCodeNames ObjectType="cms.user"></ExcludedCodeNames>  

        <!-- Includes only the "birthdaysuccessgroup" and "recentbuyers" contact groups --> 
        <IncludedCodeNames ObjectType="om.contactgroup">birthdaysuccessgroup;recentbuyers</IncludedCodeNames> 

        <!-- Excludes the "articles" and "graphics" media libararies -->
        <ExcludedCodeNames ObjectType="media.library">articles;graphics</ExcludedCodeNames> 
    </ObjectFilters>
</RepositoryConfiguration>

CD restore mode

For Continuous Deployment, the repository configuration file must contain the <RestoreMode> element. The restore mode specifies which types of object operations are performed in the target database when restoring the repository. The restore mode provides restrictive options that allow you to safely deploy to production environments where you do not wish to delete or overwrite live data.

The following values are possible:

  • Create – only creates new objects. Never deletes or modifies existing objects.
  • CreateUpdate – creates new objects and updates existing objects. Never deletes objects. This is the default option for newly generated CD repository configuration files.
  • Full – creates new objects, updates existing objects, and deletes objects that do not exist in the repository.


<?xml version="1.0" encoding="utf-8"?>
<RepositoryConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    ...
    <RestoreMode>CreateUpdate</RestoreMode>
</RepositoryConfiguration>

<RestoreMode> only affects restore operations. The limitations do not apply if you run the store command to deploy object data to an existing CD repository (including updates and removal of the object XML files).