Is it possible to deploy updater scripts

Currently we create our scripts directly in the CMS updater editor. Is it possible to create our groovy scripts externally, in a seperate file and deploy these so they appear in the list of scripts under the registry folder? This would be better instead of having to create the script directly on each environment

Yes, you can bootstrap groovy scripts just like any other piece of configuration! The location is:

/hippo:configuration/hippo:update

The registry node is where your scripts are saved. The queue is scripts that will be executed.

see also:

Also checkout this nice community groovy updater plugin that makes it really nice to work with them: https://github.com/openweb-nl/hippo-groovy-updater

Thanks for your reply. I can see under /hippo:configuration/hippo:update in our workspace project there is a registry.xml file representing the hippo:registry node in the console. Inside this xml I can see some properties related to each script and also the code of the script itself. We cannot develop our groovy scripts inside this XML file so where do we place our groovy files in our project structure in order for the registry.xml to automatically add any new scripts we create?

If you are on version 11 or earlier you have to maintain it in xml unfortunately, but then check out the plugin from openweb (I have no experience with it). From 12 you are using yaml not xml. In the yaml format you can specify external files as resources so then you can maintain the groovy separately.

We are on version 10. Thanks for your help.

Actually there is a little underdocumented feature using esv:file with the (v10/v11) xml bootstrap, see [1],
which will allow you to use a separate groovy file for your script to get it bootstrapped.
And example of that within our product can be found at [2]. That is for v11, but v10 works the same.

Note: there is a tradeoff: this will not work together with auto-export, and it knows. So once you setup such an initialize item, auto-export will refuse/disable working on that path.
But generally that isn’t a problem because otherwise if you develop your script from within the updater editor (in local development) with auto-export enabled it gets written out in XML format, which you want to prevent.

HTH, Ate

[1] https://documentation.bloomreach.com/10/library/concepts/content-repository/enhanced-xml-import.html
[2] https://code.onehippo.org/cms-community/hippo-repository/tree/hippo-repository-3.2.15/scripts/src/main/resources

2 Likes