Expand my Community achievements bar.

SOLVED

Always deploy specific content from source control?

Avatar

Level 5

I have a section of my content tree which I want to manage under source control and always deploy changes to this section from source control. This is an area that the developers are using to build out samples of content and work through styling design variations, etc- and it's our way of quickly sanity checking that the system is working correctly.

In my filter.xml, I have it defined as so:

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/conf/mysite" />
    <filter root="/content/mysite" mode="merge"/>

    <!-- How do we always push pattern library from source control? -->
    <filter root="/content/mysite/pattern-library" mode="update" />

    <filter root="/content/dam/mysite/pattern-library" mode="merge" />
    <filter root="/content/dam/mysite/_template" mode="merge" />
    <filter root="/content/experience-fragments/mysite" mode="merge"/>
</workspaceFilter>

The /content/mysite/pattern-library contains child pages that I want to always deploy and update from source control. I am noticing, however, that the pages under this path do not get overwritten on a deployment to my cloud environments.

How do I force /content/mysite/pattern-library and all of it's child pages to always deploy and update themselves based on what has been checked into source? For example- we have an older version of /content/mysite/pattern-library/teasers sitting in Integration and stage, but we're noticing updates applied to this page in source control are not being deployed.

mode="update" and mode="merge" don't appear to update existing content. I have also tried removing the mode completely. None of these options seem to achieve the effect I am looking for. Do I need to include child paths somehow?

1 Accepted Solution

Avatar

Correct answer by
Level 5

Quick update:

The solution was related to the ordering of the entries in the filter.xml file. This worked:

<filter root="/content/mysite/pattern-library" mode="replace" />
<filter root="/content/mysite" mode="merge">
    <exclude pattern-="/content/mysite/pattern-library" />
</filter>

View solution in original post

5 Replies

Avatar

Community Advisor

@dylanmccurry mode="replace" (the normal behavior when the mode is not specified with filter root) replaces the existing content entirely with the imported content, i.e. is overridden or deleted accordingly.

Interestingly, you mentioned that content is not replaced from the source code when the mode is not specified in the filter root. Please check the generated content package during the build phase has the full content for the filter root - /content/mysite/pattern-library.

Here is the documentation on filter elements - https://jackrabbit.apache.org/filevault/filter.html#filter-elements

Avatar

Level 5

Yea, I was noticing that existing content was not getting updated from source. I will check that package which is generated.

On a secondary note- does the order of the entries in filter.xml matter?

Avatar

Community Advisor

Oh yes, that's a good point. Order might be causing the problem. You can try the following :

<filter root="/content/mysite" mode="merge">
       <exclude pattern="/content/mysite/pattern-library"/>
</filter>

<filter root="/content/mysite/pattern-library" mode="replace"/>

Avatar

Level 5

Just tried this against my local environment with `-PautoInstallSinglePackage`, and it still did not work as exptected. Content from source is not overwriting content in my sandbox. Still investigating...

Avatar

Correct answer by
Level 5

Quick update:

The solution was related to the ordering of the entries in the filter.xml file. This worked:

<filter root="/content/mysite/pattern-library" mode="replace" />
<filter root="/content/mysite" mode="merge">
    <exclude pattern-="/content/mysite/pattern-library" />
</filter>