The XM Cloud build configuration
The XM Cloud build configuration for an environment is defined in the xmcloud.build.json
file. The file contains configurations for editing hosts, build targets, serialization modules to deploy to the XM instance for that environment, and more.
You can consult the PLAY! Summit project repository for a working example of the xmcloud.build.json
file.
The XM Cloud build configuration object has the following structure:
{
"deployItems": {
"modules": []
},
"buildTargets": [],
"renderingHosts": {
"<key>": <value>
},
"transforms": [],
"postActions": {
"actions": {
"<key>": <value>
}
}
}
The following table shows the properties of the XM Cloud build configuration object:
Name |
Description |
---|---|
|
Allows you to define what serialization item modules you want to deploy. It is similar to the serialization configuration defined in the All modules defined here are converted into an Items as Resources (IAR) file. It does not support roles. If you need to deploy roles, use the SCS module deployment action. For example: RequestResponse
|
|
Allows you to define which projects and solutions to build. For example: RequestResponse
This configuration affects how you pass arguments to the RequestResponse
|
|
Allows you to configure the location for the rendering hosts and the sites they map to. It consists of key-value pairs where the key is a unique site name , and the value contains information about the site. |
|
An array of items mapping an XDT path to a target path. Allows you to specify fully qualified paths with wildcards to the location where you want to process XDT transforms. |
|
Operations to perform following the deployment stage of an XM Cloud deployment process. |
Configuration options for rendering hosts
You can define rendering hosts in the XM Cloud build configuration file. Each definition maps a unique site name to information about the site.
For example:
"renderingHosts": {
"xmcloudpreview": {
"path": "./src/rendering",
"nodeVersion": "16.3.19",
"jssDeploymentSecret": "super-secret-value",
"enabled": true,
"type": "sxa",
"buildCommand": "build",
"runCommand": "next:start"
}
}
The following table describes the properties you use to configure the site information:
Name |
Type |
Description |
---|---|---|
|
|
The relative path from the |
|
|
Specific Node.js version for rendering host. |
|
|
A randomly generated string of 32 or more characters. The deployment secret is a shared secret that authorizes the application to deploy items to the Sitecore instance. It populates the value for |
|
|
Enables the site. Default: |
|
|
Type of rendering host. Allowed values: Default: Note An SXA site is created from an SXA template and uses item-based configuration. A JSS site is created from a JSS template and uses file-based configuration. |
|
|
Build command from the Default: |
|
|
Run command from the Default: |
startCommand
has been deprecated and is ignored. Use buildCommand
and runCommand
instead.
XDT transformations
To support XDT transforms, you must specify the fully qualified paths to a folder or an XDT source file and configuration destination files.
Transformations occur on the fully built solution.
The paths must be relative to the web root of the built code. For example, assuming your XDT source files are located in the src/platform/xdts
folder, you can configure transform paths as follows:
"transforms": [
{
"xdtPath": "/xdts/<some-transforms>/",
"targetPath": "/<somewhere>/"
},
{
"xdtPath": "/xdts/<trasforms-at-the-root>/",
"targetPath": "/"
},
{
"xdtPath": "/xdts/web.config.xdt",
"targetPath": "/web.config"
}
]
The value of the xdtPath
property for each transform depends on how you organize your project files. In this example, we assume your project is based on a foundation template provided by Sitecore and that your transformations are in the /src/platform/xdts/
folder. For information on how to define XDT files, consult the documentation for web.config transformations.
Post-deployment actions
You can configure various operations, called post actions, that run after the deployment stage of an XM Cloud deployment process.
The XM Cloud build configuration includes default actions you can customize to fit your requirements. They are defined using the actions
property of the postActions
object and include:
-
CM warm-up.
-
Deploying SCS modules.
-
Schema population.
-
Reindexing.
-
Publishing.
Post actions run one after the other, in the order which they appear in the configuration file. Therefore, when configuring your post actions, we highly recommend that you do not change the order of the actions.
The order shown in the following example ensures that if you deploy SCS modules, they will be published. And that the indexes are populated before reindexing.
The post actions configuration has the following structure:
"postActions": {
"actions":{
"warmUpCm": {
"urls": []
},
"scsModules": {
"modules": []
},
"populateSchema": {
"indexNames": []
},
"reindex": {
"indexNames": []
},
"publish": {
"path": "",
"languages": [],
"itemIds": [],
"targets": [],
"republish": true,
"publishSubItems": true
}
}
}
The CM warm-up action
You can warm up various Sitecore XM Cloud pages by defining an array of relative URLs in the urls
property of the warmUpCm
action.
For example:
"warmUpCm": {
"urls": [
"/sitecore/shell",
"/sitecore/shell/Applications/Content%20Editor.aspx?sc_bw=1",
"/sitecore/client/Applications/Launchpad",
"/sitecore/client/Applications/ControlPanel.aspx?sc_bw=1"
]
}
The SCS module deployment action
You can deploy Sitecore Content Serialization (SCS) modules to the Sitecore instance using the scsModules
action.
The structure of the scsModules
action is:
"scsModules": {
"modules": ["Module1","Module2"]
}
The schema population action
You can restrict the managed schema population to specific indexes by defining a list of index names in the indexNames
property of the populateSchema
action.
An empty array results in the population of all available indexes.
For example:
"populateSchema": {
"indexNames": []
}
The reindexing action
You can restrict reindexing to specific indexes by defining a list of index names in the indexNames
property of the reindex
action.
An empty array results in the reindexing of all available indexes.
For example:
"reindex": {
"indexNames": []
}
The publishing action
You can configure publishing operations using the publish
action.
The structure of the publish
action is:
"publish": {
"path": "",
"languages": [],
"itemIds": [],
"targets": "",
"republish": true,
"publishSubItems": true
}
When using the publish
action to publish an item, you can control the publishing of its subitems by defining the publishSubItems
property within the publish action. If this property is not included, subitems will be published by default.
Allowed values:
-
true
- subitems will be published. -
false
- subitems will not be published.
The following example does not publish the subitems of /sitecore/content/Home:
"publish": {
"path": "/sitecore/content/Home",
"languages": [],
"itemIds": [],
"targets": [],
"republish": true,
"publishSubItems": false
}
Change the post action timeout
The default timeout for each post action is 30 minutes. In some cases, you might need to override the default timeout, for example if there is a large number of items to reindex.
You can change the default timeout by defining the taskTimeOut
property in the post actions structure.
The following example changes the post action timeout to 45 minutes:
"postActions": {
"actions":{
...
},
"taskTimeOut": "00:45:00"
}