SitecoreUnicorn / Unicorn

A Sitecore utility designed to simplify deployment of Sitecore items across environments automatically
MIT License
269 stars 116 forks source link

Bug: Serialize item on item not controlled by Unicorn, does not serialize #219

Closed JamesSkemp closed 7 years ago

JamesSkemp commented 7 years ago

Do you want to request a feature or report a bug?

Possible bug.

What is the current behavior?

We were having trouble serializing individual items in Sitecore and further digging suggests this might be related to Unicorn (in App_Config\Include\Unicornl\Unicorn.UI.config) patching over itemsync:dumpitem.

/sitecore/content, for example, isn't in any of our Unicorn config files (included or excluded) but if we try to "Serialize item" on /sitecore/content/home we get absolutely nothing (as detailed in the SE question above). If I comment out the following from the Unicorn.UI.config:

<command name="itemsync:dumpitem">
    <patch:attribute name="type">Unicorn.UI.Commands.UnicornDumpItemCommand, Unicorn</patch:attribute>
</command>

I'm once again able to serialize as expected.

The inline documentation states (emphasis my own):

With these installed, if you serialize, load, or revert trees or items in the context of items that are included in Unicorn, regular Sitecore serialization will be replaced with Unicorn reserialization or Unicorn syncing of that item (or tree) instead.

Is this a possible bug, where the Serialize item button isn't passing back into Sitecore? Or do I potentially have a config issue?

We're trying to follow the Helix guidelines and are setting up Foundation, Project, and Feature items. Those do use Unicorn (such as for layout and templates items) and serialize properly.

If the current behavior is a bug, please provide the steps to reproduce.

See above.

What is the expected behavior?

Per the comment documentation, pressing Developer > Serialize item on an item that is not controlled by Unicorn should pass this to the standard Sitecore functionality.

Please mention your Sitecore version and Unicorn version.

kamsar commented 7 years ago

This seems like possibly a config issue of some sort.

I tried Serialize Item and Serialize Tree with the current Unicorn 4 prerelease and on non-included paths (/sitecore/layout/Devices, /sitecore/layout/Controllers) they did cause .item files to be written under $(dataFolder)/serialization.

If you review this code you can see that the base command is fallen back to if the item in question is not part of a Unicorn config.

JamesSkemp commented 7 years ago

Sorry, we've been doing an upgrade to Sitecore 8.2 Update-3 so I pushed further testing to the back burner. :( This week I'll try pulling down the current code to see if that does anything before I check configs against the docs again.

Thanks!

JamesSkemp commented 7 years ago

Crikey, it really took me a month to finish up with this? :(

I updated to the current prerelease versions of Unicorn (4.0.0-pre09) and Rainbow (2.0.0-pre08) and the issue is now resolved.

So, fixed in 4.0?

I also went in and updated the configuration names to match pure-Helix style (Foundation.Serialization) instead of prefixing with short company name (Wsb.Foundation.Serialization) and updated the physical path accordingly (<patch:attribute name="physicalRootPath">$(dataFolder)\src\$(layer)\$(module)\serialization</patch:attribute>), but none of those seem like they would have impacted it. Shrug.

Sorry for the delay on testing out the prerelease verison!