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

Git plugin writing out incorrect settings

    Details

    • Similar Issues:

      Description

      Consider the following excerpt from a job's config.xml:

      <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.3">
      <configVersion>2</configVersion>
      <userRemoteConfigs>
      <hudson.plugins.git.UserRemoteConfig>
      <name>gitlab</name>
      <url>[URL GOES HERE]</url>
      <credentialsId>[CREDENTIAL]</credentialsId>
      </hudson.plugins.git.UserRemoteConfig>
      </userRemoteConfigs>
      <branches>
      <hudson.plugins.git.BranchSpec>
      <name>*/nt-*</name>
      </hudson.plugins.git.BranchSpec>
      <hudson.plugins.git.BranchSpec>
      <name>**/master</name>
      </hudson.plugins.git.BranchSpec>
      <hudson.plugins.git.BranchSpec>
      <name>**/bleeding</name>
      </hudson.plugins.git.BranchSpec>
      [OTHER BRANCH DESIGNATIONS]
      </branches>
      <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
      <submoduleCfg class="list"/>
      <extensions>
      <hudson.plugins.git.extensions.impl.BuildChooserSetting>
      <buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
      </hudson.plugins.git.extensions.impl.BuildChooserSetting>
      <hudson.plugins.git.extensions.impl.BuildChooserSetting>
      <buildChooser class="hudson.plugins.git.util.AncestryBuildChooser">
      <maximumAgeInDays>14</maximumAgeInDays>
      <ancestorCommitSha1></ancestorCommitSha1>
      </buildChooser>
      </hudson.plugins.git.extensions.impl.BuildChooserSetting>
      <hudson.plugins.git.extensions.impl.MessageExclusion>
      <excludedMessage>[REGEX HERE]</excludedMessage>
      </hudson.plugins.git.extensions.impl.MessageExclusion>
      </extensions>
      </scm>

      After reloading configurations from disk, the appropriate settings are displayed in the Additional Behvaiors area of the job's git configuration. However, if I change any of the settings and save the job, the <extensions> element is removed from the XML entirely, and the related configurations are annihilated.

      Additionally, and this may require a new issue, out of these behaviors, only the first one is used: if I move the AncestryBuildChooser to the top of the element, only the commits younger than 14 days are built, but the InverseBuildChooser setting is ignored. If left in the current configuration, only the InverseBuildChooser setting is used, but Jenkins starts builds rapidly to catch up with the untested old commits, the majority of which will fail the build due to various changes over the years.

        Attachments

          Issue Links

            Activity

            zmeggyesi Zalan Meggyesi created issue -
            zmeggyesi Zalan Meggyesi made changes -
            Field Original Value New Value
            Description Consider the following excerpt from a job's config.xml:

            {{<scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.3">
                <configVersion>2</configVersion>
                <userRemoteConfigs>
                  <hudson.plugins.git.UserRemoteConfig>
                    <name>gitlab</name>
                    <url>[URL GOES HERE]</url>
                    <credentialsId>[CREDENTIAL]</credentialsId>
                  </hudson.plugins.git.UserRemoteConfig>
                </userRemoteConfigs>
                <branches>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/nt-**</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/master</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/bleeding</name>
                  </hudson.plugins.git.BranchSpec>
            [OTHER BRANCH DESIGNATIONS]
                  </branches>
                <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
                <submoduleCfg class="list"/>
                <extensions>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.AncestryBuildChooser">
                      <maximumAgeInDays>14</maximumAgeInDays>
                      <ancestorCommitSha1></ancestorCommitSha1>
                    </buildChooser>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.MessageExclusion>
                    <excludedMessage>[REGEX HERE]</excludedMessage>
                  </hudson.plugins.git.extensions.impl.MessageExclusion>
                </extensions>
              </scm>}}

            After reloading configurations from disk, the appropriate settings are displayed in the Additional Behvaiors area of the job's git configuration. However, if I change any of the settings and save the job, the {{<extensions>}} element is removed from the XML entirely, and the related configurations are annihilated.

            Additionally, and this may require a new issue, out of these behaviors, only the first one is used: if I move the {{AncestryBuildChooser}} to the top of the element, only the commits younger than 14 days are built, but the {{InverseBuildChooser}} setting is ignored. If left in the current configuration, only the {{InverseBuildChooser}} setting is used, but Jenkins starts builds rapidly to catch up with the untested old commits, the majority of which will fail the build due to various changes over the years.
            Consider the following excerpt from a job's config.xml:

            {quote}<scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.3">
                <configVersion>2</configVersion>
                <userRemoteConfigs>
                  <hudson.plugins.git.UserRemoteConfig>
                    <name>gitlab</name>
                    <url>[URL GOES HERE]</url>
                    <credentialsId>[CREDENTIAL]</credentialsId>
                  </hudson.plugins.git.UserRemoteConfig>
                </userRemoteConfigs>
                <branches>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/nt-**</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/master</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/bleeding</name>
                  </hudson.plugins.git.BranchSpec>
            [OTHER BRANCH DESIGNATIONS]
                  </branches>
                <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
                <submoduleCfg class="list"/>
                <extensions>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.AncestryBuildChooser">
                      <maximumAgeInDays>14</maximumAgeInDays>
                      <ancestorCommitSha1></ancestorCommitSha1>
                    </buildChooser>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.MessageExclusion>
                    <excludedMessage>[REGEX HERE]</excludedMessage>
                  </hudson.plugins.git.extensions.impl.MessageExclusion>
                </extensions>
              </scm>{quote}

            After reloading configurations from disk, the appropriate settings are displayed in the Additional Behvaiors area of the job's git configuration. However, if I change any of the settings and save the job, the {{<extensions>}} element is removed from the XML entirely, and the related configurations are annihilated.

            Additionally, and this may require a new issue, out of these behaviors, only the first one is used: if I move the {{AncestryBuildChooser}} to the top of the element, only the commits younger than 14 days are built, but the {{InverseBuildChooser}} setting is ignored. If left in the current configuration, only the {{InverseBuildChooser}} setting is used, but Jenkins starts builds rapidly to catch up with the untested old commits, the majority of which will fail the build due to various changes over the years.
            zmeggyesi Zalan Meggyesi made changes -
            Description Consider the following excerpt from a job's config.xml:

            {quote}<scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.3">
                <configVersion>2</configVersion>
                <userRemoteConfigs>
                  <hudson.plugins.git.UserRemoteConfig>
                    <name>gitlab</name>
                    <url>[URL GOES HERE]</url>
                    <credentialsId>[CREDENTIAL]</credentialsId>
                  </hudson.plugins.git.UserRemoteConfig>
                </userRemoteConfigs>
                <branches>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/nt-**</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/master</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/bleeding</name>
                  </hudson.plugins.git.BranchSpec>
            [OTHER BRANCH DESIGNATIONS]
                  </branches>
                <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
                <submoduleCfg class="list"/>
                <extensions>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.AncestryBuildChooser">
                      <maximumAgeInDays>14</maximumAgeInDays>
                      <ancestorCommitSha1></ancestorCommitSha1>
                    </buildChooser>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.MessageExclusion>
                    <excludedMessage>[REGEX HERE]</excludedMessage>
                  </hudson.plugins.git.extensions.impl.MessageExclusion>
                </extensions>
              </scm>{quote}

            After reloading configurations from disk, the appropriate settings are displayed in the Additional Behvaiors area of the job's git configuration. However, if I change any of the settings and save the job, the {{<extensions>}} element is removed from the XML entirely, and the related configurations are annihilated.

            Additionally, and this may require a new issue, out of these behaviors, only the first one is used: if I move the {{AncestryBuildChooser}} to the top of the element, only the commits younger than 14 days are built, but the {{InverseBuildChooser}} setting is ignored. If left in the current configuration, only the {{InverseBuildChooser}} setting is used, but Jenkins starts builds rapidly to catch up with the untested old commits, the majority of which will fail the build due to various changes over the years.
            Consider the following excerpt from a job's config.xml:

            <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.3">
                <configVersion>2</configVersion>
                <userRemoteConfigs>
                  <hudson.plugins.git.UserRemoteConfig>
                    <name>gitlab</name>
                    <url>[URL GOES HERE]</url>
                    <credentialsId>[CREDENTIAL]</credentialsId>
                  </hudson.plugins.git.UserRemoteConfig>
                </userRemoteConfigs>
                <branches>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/nt-**</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/master</name>
                  </hudson.plugins.git.BranchSpec>
                  <hudson.plugins.git.BranchSpec>
                    <name>**/bleeding</name>
                  </hudson.plugins.git.BranchSpec>
            [OTHER BRANCH DESIGNATIONS]
                  </branches>
                <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
                <submoduleCfg class="list"/>
                <extensions>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.InverseBuildChooser"/>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.BuildChooserSetting>
                    <buildChooser class="hudson.plugins.git.util.AncestryBuildChooser">
                      <maximumAgeInDays>14</maximumAgeInDays>
                      <ancestorCommitSha1></ancestorCommitSha1>
                    </buildChooser>
                  </hudson.plugins.git.extensions.impl.BuildChooserSetting>
                  <hudson.plugins.git.extensions.impl.MessageExclusion>
                    <excludedMessage>[REGEX HERE]</excludedMessage>
                  </hudson.plugins.git.extensions.impl.MessageExclusion>
                </extensions>
              </scm>

            After reloading configurations from disk, the appropriate settings are displayed in the Additional Behvaiors area of the job's git configuration. However, if I change any of the settings and save the job, the {{<extensions>}} element is removed from the XML entirely, and the related configurations are annihilated.

            Additionally, and this may require a new issue, out of these behaviors, only the first one is used: if I move the {{AncestryBuildChooser}} to the top of the element, only the commits younger than 14 days are built, but the {{InverseBuildChooser}} setting is ignored. If left in the current configuration, only the {{InverseBuildChooser}} setting is used, but Jenkins starts builds rapidly to catch up with the untested old commits, the majority of which will fail the build due to various changes over the years.
            markewaite Mark Waite made changes -
            Assignee Mark Waite [ markewaite ]
            markewaite Mark Waite made changes -
            Comment [ That's an interesting condition. As far as I understand the build chooser implementation, the implementation expects that you will choose one of them. As far as I can tell, you're correct that it is a bug that the plugin allows the user to write more than 1 build chooser setting to a job definition.

            I don't know what it would mean to have multiple build choosers selected.

            In my collection of 2100+ verification jobs, the 30 which include a BuildChooserSetting all have exactly 1 setting.

            I believe it is intentional that only one of the build chooser setting values is used. ]
            markewaite Mark Waite made changes -
            Assignee Mark Waite [ markewaite ]
            markewaite Mark Waite made changes -
            Link This issue is related to JENKINS-33564 [ JENKINS-33564 ]
            markewaite Mark Waite made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            markewaite Mark Waite made changes -
            Link This issue is related to JENKINS-33811 [ JENKINS-33811 ]
            markewaite Mark Waite made changes -
            Link This issue is related to JENKINS-35248 [ JENKINS-35248 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 169659 ] JNJira + In-Review [ 198656 ]
            markewaite Mark Waite made changes -
            Status Resolved [ 5 ] Closed [ 6 ]

              People

              • Assignee:
                markewaite Mark Waite
                Reporter:
                zmeggyesi Zalan Meggyesi
              • Votes:
                4 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: