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

config.xml gets corrupted after changes and restart

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • core
    • None
    • RHEL 7
      Jenkins 2.289.2/3
      ec2-plugin 1.62/1.63

    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

          Is it not possible to use the UI for this?

          raihaan Raihaan Shouhell added a comment - Is it not possible to use the UI for this?

          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.

          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.

          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?

          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?

          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.

          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.
          jglick Jesse Glick added a comment - While there may be problems in the ec2 plugin, the quoted XML sections clearly indicate core bugs: https://github.com/jenkinsci/jenkins/blob/165d559469c7a58af581931bd1b89e5b9ed4a9af/core/src/main/java/hudson/model/ListView.java#L84 and https://github.com/jenkinsci/jenkins/blob/165d559469c7a58af581931bd1b89e5b9ed4a9af/core/src/main/java/hudson/slaves/EnvironmentVariablesNodeProperty.java#L54 use inappropriate types for serialized fields.

          People

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

            Dates

              Created:
              Updated: