Content Hub Tip #14: Shared scripts in Multi stage environments

 

Content Hub Tips logo

As mentioned in the previous tip, the Content Hub v4.x have some issues with the import/export process. During our daily work, we discovered a new issue regarding this process. As our client uses a multistage environment also known as the DTAP. Where the D = Development, T = Test, A = Acceptance and P = production. Because of these environments, changes are made at development and the export/import process starts to upgrade the other environments. This process is already complicated enough, but adding shared scripts in the mix simply blocks the process.

Which versions are affected?
All Content Hub v4.0 and higher. Sitecore has created a fix from v4.1.11 and higher. 
MONE-31135 Fixed an issue with failing to import shared scripts.

Is a workaround available?
If you're not able to upgrade, the only thing you can do is ditch the shared script and embed the code in the calling script. Unfortunately, this will give some duplication of the code.

Opinion
The shared script really look like a good idea, but now that I've more experience working with them, I would suggest staying away from the functionality. At first sight, when you start using a shared script, everything looks fine. Then you realize you need a change in the shared script. You think that's easy because it's shared. But then the problems begin to arise.

Your shared script might be upgraded, re-compiled and published, but all scripts that reference this shared script, need to be re-compiled and published as well! So the more scripts that reference your shared script, the bigger your problem will become. This will be a problem to maintain all the scripts in this way.