Sitecore CLI 4.1 release is available!

Based on great feedback and engagement from the Sitecore Development community, we just released some great improvements for the Sitecore CLI. I'm excited to announce the release of Sitecore Management Services and Sitecore CLI, versions 4.1.0

As the Sitecore CLI continues to grow in popularity by providing productivity, convenience, automation, and extensibility for development teams and engineers, we continue to look for ways to make the Developer Experience better. Thank you for all the feedback and inspiration that went into these features.

The new release (v 4.1.0) contains feature updates for the base CLI, the Serialization plugin, and the ResourcePackage (Item as Resources) plugin.

New feature - Plugin Initialization

We added a new 'plugin init' sub-command which makes the installation and upgrading process more convenient for developers by installing a default set of plugins from the Sitecore DevEx team.

The command argument structure for this is as follows:

> sitecore plugin init [argument-options]        

Usage examples:

> dotnet sitecore plugin init --version 4.1.0 --overwrite        
No alt text provided for this image

Additionally, the 'plugin init' command has the following supported arguments

No alt text provided for this image

New feature - Module Tagging

We added support for Serialization Module tagging which provides more flexibility in determining which Modules get included and excluded in serialization operations.

To begin using this feature, add a tags list to the Serialization Module.json files.

Note: Tag names cannot contain spaces.

No alt text provided for this image

Once the Serialization Module tag definitions are setup, move over to the Sitecore CLI and begin using these tags in serialization --include and --exclude command arguments. The command argument structure for this is as follows:

ser [command] [sub-command] [--include tags:[tags]] [--exclude tags:[tags]]         

Usage examples:

> dotnet sitecore ser pull --include tags:[TagA,TagB]
> dotnet sitecore ser push --exclude tags:[TagA,TagB]
> dotnet sitecore ser pkg create --include tags:[TagA]
        
No alt text provided for this image

Note: The tags list command argument has a comma delimiter and the list cannot contain spaces between tags, i.e. [TagA, TagB]

New feature - Serialization continue on Item sync failure

We added a new setting for serialization Item sync operations that will allow the serialization process to either exit or continue on the occurrence of a Sitecore Item sync failure. By default the serialization process will exit on Item sync failure (this is how it works in all earlier versions of the CLI).

Within the sitecore.json configuration file there is a new setting called 'continueOnItemFailure' and the value can be true/false.

No alt text provided for this image

Additionally within the serialization Item sync command operations, you can add a --force command argument option flag. This will run the serialization process and convert Item sync errors to warnings and continue on Item failure.

> dotnet sitecore push --force        
No alt text provided for this image

New feature - Item as Resource Cleanup

We added a new 'itemres cleanup' sub-command which performs a Sitecore Database system cleanup by comparing all items that are installed within Item as Resource (IAR) packages on the host Sitecore instance and compares those items to all items within the Sitecore Databases. When comparing items between the IAR file and the Sitecore database, if an item is exact match and duplicate, then the process job removes the Item from the Sitecore Database.

This is useful for teams that are creating and installing Item as Resource files within a Sitecore instance that has those same items already present within a Sitecore Database.

The command argument structure for this is as follows:

> sitecore sitecore itemres cleanup [argument-options]        

Usage examples:

> dotnet sitecore itemres cleanup        
No alt text provided for this image

Additionally, the 'itemres cleanup' command has the following supported arguments

No alt text provided for this image

New feature - List Publishing Targets

We added a new 'publish list-targets' sub-command which reads all publishing targets defined for a given Sitecore environment and lists them out.

The command argument structure for this is as follows:

> sitecore publish list-targets [argument-options]        

Usage examples:

> dotnet sitecore publish list-targets         
No alt text provided for this image

Additionally, the 'publish list-targets' sub-command has the following supported arguments

No alt text provided for this image

Enhanced feature - Role serialization support in item packages

Serialized roles are now included in the existing 'ser package create' command.

To begin using this feature, setup a Serialization Module with a pattern for synchronizing roles.

No alt text provided for this image

Once complete, confirm that this is configured correctly using the following command:

> dotnet sitecore ser info --include Feature.Products -v        
No alt text provided for this image

Then run the package creation command:

> dotnet sitecore ser pkg create --output ProductsPkg --include Feature.Products -v        
No alt text provided for this image

Enhanced feature - Login command support for unsecure connections to authority endpoints

We added support to the existing Sitecore login command with the introduction of an "insecure" setting. This adds the ability for the Sitecore CLI to communicate with a Sitecore instance running within a container cluster.

  • The insecure setting allows for authentication against unsecure (http) authority endpoints.
  • The insecure setting is only supported with a non interactive client login (client credentials flow).
  • The insecure setting not recommended for external facing solutions.

The insecure setting can be toggled on/off with a boolean field in the user.json configuration file or provided directly in the cli with a command argument option flag.

User.json configuration file example:

No alt text provided for this image

CLI usage example:

> dotnet sitecore login --cm https://cm --auth https://id --allow-write true --client-id "SitecoreCLIServer" --client-secret "testsecret" --client-credentials true --insecure        
No alt text provided for this image

Highlighted Fix - Shared to non-shared field data propagation

While working with the Sitecore developer community we discovered that when changing an Item field from shared to non-shared, the required Item propagation changes do not get triggered. The easiest way to describe this is with a scenario like the following:

Developer A creates a shared field
Developer A serializes (ser pull)
Developer A commits and pushes to GIT
Developer B pulls from GIT
Developer B pushes the serialized changes (ser push)
Developer B changes the field to not shared
Developer B serializes (ser pull)
Developer B commits and pushes to GIT
Developer A pulls from GIT
Developer A pushes the serialized changes (ser push)
Developer A notices that the field is not shared any more (correct)
Developer A tries to edit the field on an item, but notices that the changes are not persisted after save. 
He sees that the SharedFields still contain the records for the field, but the VersionedFields do as well. 
The value from the SharedFields is used.        

With version 4.1 of the Sitecore CLI Serialization plugin, this has been fixed.

Thank you

Thank you for all the feedback, collaboration, and ideas that went into this release. Please continue to share your ideas with the Sitecore DevEx team, we greatly appreciate this.

Download today

The Sitecore CLI version 4.1.0 is compatible Sitecore 10.1 & 10.2, and requires?Sitecore Management Services 4.1.0?which was just released.

The download is currently available on the Sitecore CLI?downloads page. Make sure to review the?Release Notes?and our Developer Reference documentation.

Maarten Willebrands

Senior Sitecore Developer bij Creates.nl and Sitecore MVP 2022/2023

3 年

Awesome, looking forward to using this version!

回复

要查看或添加评论,请登录

Justin Vogt的更多文章

社区洞察

其他会员也浏览了