Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66286

config.xml gets corrupted after changes and restart

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: ec2-plugin
    • Labels:
      None
    • Environment:
      RHEL 7
      Jenkins 2.289.2/3
      ec2-plugin 1.62/1.63
    • Similar Issues:

      Description

      When we define Environment Variables for an EC2-Cloud the reference-value of comparator class="hudson.util.CaseInsensitiveComparator" of Views and GlobalNodeProperties-EnvironmentVariables is changed
      from reference="../../../../../../views/listView/jobNames/comparator"/ respectively reference="../../../listView/jobNames/comparator"/> into
      something like "../../../../../../../../../hudson.plugins.ec2.EC2Cloud..."

       
      config.xml before setting Environment Variables

       

      ...
      <listView>
            <owner class="hudson" reference="../../.."/>
            <name>Kai</name>
            <filterExecutors>false</filterExecutors>
            <filterQueue>false</filterQueue>
            <properties class="hudson.model.View$PropertyList"/>
            <jobNames>
              <comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../listView/jobNames/comparator"/>
            </jobNames>
      ...
      <globalNodeProperties>
          <hudson.slaves.EnvironmentVariablesNodeProperty>
            <envVars serialization="custom">
              <unserializable-parents/>
              <tree-map>
                <default>
                  <comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../../../../views/listView/jobNames/comparator"/>
                </default>
      		  
      ...
      

      config.xml after setting Environment Variables

      ...
      <clouds>
      ...
      <nodeProperties>
                  <hudson.slaves.EnvironmentVariablesNodeProperty>
                    <envVars serialization="custom">
                      <unserializable-parents/>
                      <tree-map>
                        <default>
                          <comparator class="hudson.util.CaseInsensitiveComparator"/>
      					OR SOMETIMES <comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../../../../../../../hudson.plugins.ec2.EC2Cloud/templates/hudson.plugins.ec2.SlaveTemplate[2]/nodeProperties/hudson.slaves.EnvironmentVariablesNodeProperty/envVars/tree-map/default/comparator"/>                  </default>
                        <int>1</int>
                        <string>DUMMY</string>
                        <string>dummy</string>
                      </tree-map>
                    </envVars>
      ...
      <listView>
            <owner class="hudson" reference="../../.."/>
            <name>Tommy</name>
            <filterExecutors>false</filterExecutors>
            <filterQueue>false</filterQueue>
            <properties class="hudson.model.View$PropertyList"/>
            <jobNames>
              <comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../../clouds/hudson.plugins.ec2.EC2Cloud/templates/hudson.plugins.ec2.SlaveTemplate[2]/nodeProperties/hudson.slaves.EnvironmentVariablesNodeProperty/envVars/tree-map/default/comparator"/>
            </jobNames>
      ...
      <globalNodeProperties>
          <hudson.slaves.EnvironmentVariablesNodeProperty>
            <envVars serialization="custom">
              <unserializable-parents/>
              <tree-map>
                <default>
                  <comparator class="hudson.util.CaseInsensitiveComparator" reference="../../../../../../clouds/hudson.plugins.ec2.EC2Cloud/templates/hudson.plugins.ec2.SlaveTemplate[2]/nodeProperties/hudson.slaves.EnvironmentVariablesNodeProperty/envVars/tree-map/default/comparator"/>
      </default>
      ...
      

      As long as the config.xml isn't touched this is no problem, even after restart Jenkins. When we make changes in the config.xml and jenkins has to sort it at a restart, it gets corrupted...<views> and <clouds> are missing.
      E.g. a config.xml of 45 KB results in 11 KB.
      When we make changes to the config.xml and delete all reference="../../../../../../clouds/hudson.plugins.ec2.EC2Cloud/templates/hudson.plugins.ec2.SlaveTemplate everything works fine.

      Seems a bit similiar to the solved JENKINS-24938

       

        Attachments

          Activity

          Hide
          raihaan Raihaan Shouhell added a comment -

          Is it not possible to use the UI for this?

          Show
          raihaan Raihaan Shouhell added a comment - Is it not possible to use the UI for this?
          Hide
          torstenboelting Torsten Boelting added a comment -

          No, changes in our configs are made automatically with scripts on all our servers.
          And even if we use the UI, the changing of the reference parameter of all comparator-class tags would be still an issue.

          Show
          torstenboelting Torsten Boelting added a comment - No, changes in our configs are made automatically with scripts on all our servers. And even if we use the UI, the changing of the reference parameter of all comparator-class tags would be still an issue.
          Hide
          raihaan Raihaan Shouhell added a comment -

          Ok, so this is not an issue of ec2-plugin. Technically I'm not sure if this is an issue at all.
          The reference field is actually set by xstream which is the serialization core uses.

          How was the config change exactly made? Does the script edit the xml by hand? Why not use Configuration as code?

          Show
          raihaan Raihaan Shouhell added a comment - Ok, so this is not an issue of ec2-plugin. Technically I'm not sure if this is an issue at all. The reference field is actually set by xstream which is the serialization core uses. How was the config change exactly made? Does the script edit the xml by hand? Why not use Configuration as code?
          Hide
          torstenboelting Torsten Boelting added a comment -

          Config-Change: The script deletes the cloud-section of the config.xml, builds a new cloud-section and appends it to the config.xml. After Jenkins starts, the config.xml is in the right order again, but only when there is no reference="../../../../clouds/hudson.plugins.ec2.EC2Cloud...
          As a workaround we delete the Reference-Attributes by script before we start Jenkins.

          Using of Configuration as code is planned.

          Show
          torstenboelting Torsten Boelting added a comment - Config-Change: The script deletes the cloud-section of the config.xml, builds a new cloud-section and appends it to the config.xml. After Jenkins starts, the config.xml is in the right order again, but only when there is no reference="../../../../clouds/hudson.plugins.ec2.EC2Cloud... As a workaround we delete the Reference-Attributes by script before we start Jenkins. Using of Configuration as code is planned.

            People

            Assignee:
            thoulen FABRIZIO MANFREDI
            Reporter:
            torstenboelting Torsten Boelting
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: