CI module logs everything in the staging module

Francis Venne asked on September 15, 2020 17:27

Greetings,

I’m working on a Kentico MVC website with multiple environment; DEV, QA, UAT. The CI module is currently running only on the DEV environment. Content is deployed from DEV to QA and UAT through the Staging module. This setup has been working fine for months.

My current problem is that every time I deploy the site in DEV and execute the CI restore, it creates a bunch of tasks in the staging module. It generates task for stuff that haven’t changed in months (Create page, move page, Delete page, Update, etc.)

I tried to exclude content with a custom initialization function, like I did in the past (thanks to that forum) but it doesn’t seem to work anymore. That leads to my second problem that might be related. I excluded the user info in a custom initialization with this

    private void LogTask_Before(object sender, StagingLogTaskEventArgs e)
    {

        if (e.Object is UserInfo || e.Object is UserSettingsInfo)

        {

            e.Cancel();

        }

    }

But now the user info is once again back in the staging module. That’s why I think that I have an issue with the CI.

In the current workflow, I had to push new Pages and localizations via the staging module and that’s fine since we cannot overwrite the content in UAT. Sadly, the CI just blindly delete stuff that is not already there.

Thanks for your time.

Recent Answers


Juraj Ondrus answered on September 16, 2020 07:18

To disable logging of staging tasks, have you tried the ObjectEvents.LogChange.Before event? something like:

public override void Init()
      {
         // Assign custom handlers to the appropriate events
         ObjectEvents.LogChange.Before += new EventHandler<LogObjectChangeEventArgs>(LogObjectChange_Before);
      }

      void LogObjectChange_Before(object sender, LogObjectChangeEventArgs e)
      {
         // Get current object
         var obj = e.Settings.InfoObj;

         // Object is user with specific user name
         if ((obj.ObjectType == PredefinedObjectType.USER) && (obj.ObjectCodeName == "custom.service"))
         {
             e.Settings.LogStaging = false;
         }
      }
0 votesVote for this answer Mark as a Correct answer

Nicolas Huguet-Latour answered on September 16, 2020 15:18 (last edited on September 16, 2020 15:19)

Hi Jurag, thanks for the answer (I'm a co-worker of Francis)!

Do you have any idea why the CI module would generate a ton of changes in the staging module each time it's run? Right now the CI is configured to sync system tables, page types and localizations, and it's run each night when we are deploying the last version of the code.

At this time, we are doing pretty much no changes in Kentico and it's still generating upwards of 250 tasks each night, including tasks for system tables and roles that haven't changed in weeks if not months.

Thanks!

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 17, 2020 08:47

Could you please describe the issue in more details? There are no mentions about the objects in the CI repository and the staging tasks are created anyway? Could you please provide some examples? Also, how is the deployment done? Deployment of content and data to instances that host live websites is not the primary purpose of the continuous integration solution. Instead, we recommend using the Staging functionality for deployment as described in the docs.

0 votesVote for this answer Mark as a Correct answer

Nicolas Huguet-Latour answered on September 17, 2020 15:10 (last edited on September 17, 2020 15:10)

I will start by describing our pipeline :

  • Each of the developers works on their own database and synchronization between the developers is done through the CI module (we synchronize everything this way).
  • From there, we are automatically deploying a subset of objects with the CI module in an integration environment called "dev". This is NOT the production. Here is the list of what we are synchronizing this way :

    <IncludedObjectTypes>    
    <!-- System object types -->
    <ObjectType>cms.acl</ObjectType>
    <ObjectType>cms.resource</ObjectType>
    <ObjectType>cms.role</ObjectType>
    <ObjectType>cms.settingscategory</ObjectType>    
    <ObjectType>cms.systemtable</ObjectType>
    <ObjectType>cms.workflow</ObjectType>
    <ObjectType>cms.workflowaction</ObjectType>    
    
    <!-- Page types -->
    <ObjectType>cms.documenttype</ObjectType>
    
    <!-- Localizations -->
    <ObjectType>cms.resourcestring</ObjectType>
    <ObjectType>cms.resourcetranslation</ObjectType>
    </IncludedObjectTypes>
    
  • Other changes are either manually done on the integration environment or deployed through the staging module.

  • From this integration environment, we deploy in QA, UAT and Production through the staging module. We are not running the CI in those environments.

From what I understand, we are doing what is recommended in the documentation.

There are no mentions about the objects in the CI repository and the staging tasks are created anyway?

No, these are specified in the repository.config file (see higher). The issue is that staging tasks are created even if the objects didn't change. I feel like it's more an issue with the CI module than the staging module since it take a good 30 minutes for the CI to run and it logs a ton of updates (about 17 000) here is a short sample :

2020-09-17T07:02:17.5438439Z Continuous Integration Console
2020-09-17T07:02:17.5439224Z Kentico Software
2020-09-17T07:02:23.6723541Z Restoring objects...
2020-09-17T07:02:24.2773575Z Object type Module: updating Image Optimizer
2020-09-17T07:02:25.5649070Z Object type Module: Image Optimizer updated
2020-09-17T07:02:25.5844680Z Object type Module: updating A/B testing
2020-09-17T07:02:25.6098629Z Object type Module: A/B testing updated
2020-09-17T07:02:25.6513514Z Object type Module: updating Abuse report
2020-09-17T07:02:25.6758173Z Object type Module: Abuse report updated
2020-09-17T07:02:25.6949142Z Object type Module: updating Activities
2020-09-17T07:02:25.7352857Z Object type Module: Activities updated
2020-09-17T07:02:25.7540123Z Object type Module: updating Badges
2020-09-17T07:02:25.8549762Z Object type Module: Badges updated
2020-09-17T07:02:25.9200949Z Object type Module: updating Bad words
2020-09-17T07:02:26.0113746Z Object type Module: Bad words updated
2020-09-17T07:02:26.0425876Z Object type Module: updating Banned IPs
2020-09-17T07:02:26.1156327Z Object type Module: Banned IPs updated
2020-09-17T07:02:26.1554191Z Object type Module: updating Banner management
2020-09-17T07:02:26.1973881Z Object type Module: Banner management updated
2020-09-17T07:02:26.2186611Z Object type Module: updating Blogs
2020-09-17T07:02:26.2587215Z Object type Module: Blogs updated
2020-09-17T07:02:26.2784610Z Object type Module: updating Categories
2020-09-17T07:02:26.3021205Z Object type Module: Categories updated
2020-09-17T07:02:26.3211368Z Object type Module: updating Chat
2020-09-17T07:02:26.3451074Z Object type Module: Chat updated
2020-09-17T07:02:26.3650034Z Object type Module: updating Community
2020-09-17T07:02:26.3892838Z Object type Module: Community updated
2020-09-17T07:02:26.4093478Z Object type Module: updating Contact management
2020-09-17T07:02:26.5145206Z Object type Module: Contact management updated
2020-09-17T07:02:26.5335841Z Object type Module: updating Content
2020-09-17T07:02:26.5656365Z Object type Module: Content updated
[SNIP]

None of those objects should have changed in months (and there are no traces of changes in the CI files in the source control).

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 17, 2020 15:27

Well, I did not meant objects listed in the config but whether you see the log XML file created for given object type? Also, what are the task data of the sample staging task? Staging is configured one way only or bi-directional? What is the command you are using to run the CI?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.