• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cvs-plugin
    • windows 2003 server, jenkins 1.482, maven 3, maven-release-plugin 2.1

      I have a problem when I use maven to generate a release from a cvs branch on jenkins.

      Here is the my environment :

      OS windows 2003 server
      jenkins 1.482
      jenkins cvs plugin 2.5
      maven 3
      maven-release-plugin 2.1
      cvs.exe native windows client 1.11.22 from http://cvs.nongnu.org (quite old, I know)

      The project is a maven project, in jenkins I configured it to use a cvs branch as the code source location. The project can be compiled without any issue on jenkins, but when I try to perform a maven release, the compilation crashes. More exactly, it stops when it tries to commit the modified pom.xml to cvs server.

      Here is the error message :

      [INFO] [INFO] BUILD SUCCESS
      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] [INFO] Total time: 1:40.298s
      [INFO] [INFO] Finished at: Thu Jan 10 15:58:36 CET 2013
      [INFO] [INFO] Final Memory: 38M/247M
      [INFO] [INFO] ------------------------------------------------------------------------
      [INFO] Checking in modified POMs...
      [INFO] Executing: cmd.exe /X /C "cvs -z3 -f -q commit -R -F C:\DOCUME~1\lsa_web\LOCALS~1\Temp\scm-commit-message2086459184030940886.txt pom.xml"
      
      [INFO] Working directory: D:\xxxxx
      mojoFailed org.apache.maven.plugins:maven-release-plugin:2.1(default-cli)
      projectFailed xxx:xxx:1.0.4-SNAPSHOT
      sessionEnded
      ...
      message : Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project xxx: Unable to commit files
      
      Provider message:
      The cvs command failed.
      Command output:
      cvs commit: Up-to-date check failed for `pom.xml'
      cvs [commit aborted]: correct above errors first!
      
      cause : Unable to commit files
      Provider message:
      The cvs command failed.
      Command output:
      cvs commit: Up-to-date check failed for `pom.xml'
      cvs [commit aborted]: correct above errors first!
      

      Then I looked into the code of the cvs plugin and found that it strips out the sticky date tags after cvs check out.
      https://github.com/jenkinsci/cvs-plugin/blob/master/src/main/java/hudson/scm/AbstractCvs.java#L694

      Without the sticky tag (branch), the cvs.exe launched by maven during release tries to commit the modified pom.xml to HEAD which can obviously not work.

      C:\TEMP\workspace>cvs.exe status pom.xml
      ===================================================================
      File: pom.xml           Status: Needs Merge
         Working revision:    1.18.4.12
         Repository revision: 1.35    /APPLICATIONS/CVS01D/xxxx/cvsrepository/xxx/pom.xml,v
         Commit Identifier:   JtFwavfT373XqEzw
         Sticky Tag:          (none)
         Sticky Date:         (none)
         Sticky Options:      (none)
      

      Should the plugin removes the sticky branch tag when the code is checked out from a branch ?

          [JENKINS-16314] cvs plugin removes sticky branch tag

          xdu xdu created issue -
          xdu xdu made changes -
          Labels New: cvs maven plugin release windows

          CVS plugin actually only does the cleanup if we're on HEAD, but a bug in the cleanup code meant it didn't select the right folder to clean the tags on if workspace was flattened

          Michael Clarke added a comment - CVS plugin actually only does the cleanup if we're on HEAD, but a bug in the cleanup code meant it didn't select the right folder to clean the tags on if workspace was flattened
          Michael Clarke made changes -
          Assignee New: Michael Clarke [ mc1arke ]
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          James Morgan added a comment -

          Hi,

          I've upgraded to v2.8 this morning and trying to release from a branch. The plugin is stripping the Tbranch info still.

          cvs checkout -P -r RC_repServer2_6 -d test repServer

          /api-base.cfg/1.3/Wed Apr 18 11:55:58 2012//
          /build.xml/1.3/Thu Feb 07 09:55:32 2013//
          /changeLog/1.7/Mon Dec 19 15:25:41 2011//
          /pom.xml/1.7.2.6/Fri Feb 22 11:38:24 2013//
          /schema-base.cfg/1.3/Tue Jan 31 14:02:16 2012//
          /server-base.cfg/1.5/Wed Feb 06 17:39:30 2013//
          D/db////
          D/doc////
          D/dtd////
          D/tcl////
          

          And handrolling the cvs checkout instead of using the plugin gives

          + cvs co -r RC_repServer2_6 -d test repServer

          /api-base.cfg/1.3/Wed Apr 18 11:55:58 2012//TRC_repServer2_6
          /build.xml/1.3/Thu Feb  7 09:55:32 2013//TRC_repServer2_6
          /changeLog/1.7/Mon Dec 19 15:25:41 2011//TRC_repServer2_6
          /schema-base.cfg/1.3/Tue Jan 31 14:02:16 2012//TRC_repServer2_6
          /server-base.cfg/1.5/Wed Feb  6 17:39:30 2013//TRC_repServer2_6
          D/db////
          D/doc////
          D/dtd////
          D/tcl////
          /pom.xml/1.7.2.6/Fri Feb 22 11:38:24 2013//TRC_repServer2_6
          

          Is this same issue? If not i'll raise it as a new defect.

          Many thanks

          James

          James Morgan added a comment - Hi, I've upgraded to v2.8 this morning and trying to release from a branch. The plugin is stripping the Tbranch info still. cvs checkout -P -r RC_repServer2_6 -d test repServer /api-base.cfg/1.3/Wed Apr 18 11:55:58 2012 // /build.xml/1.3/Thu Feb 07 09:55:32 2013 // /changeLog/1.7/Mon Dec 19 15:25:41 2011 // /pom.xml/1.7.2.6/Fri Feb 22 11:38:24 2013 // /schema-base.cfg/1.3/Tue Jan 31 14:02:16 2012 // /server-base.cfg/1.5/Wed Feb 06 17:39:30 2013 // D/db //// D/doc //// D/dtd //// D/tcl //// And handrolling the cvs checkout instead of using the plugin gives + cvs co -r RC_repServer2_6 -d test repServer /api-base.cfg/1.3/Wed Apr 18 11:55:58 2012 //TRC_repServer2_6 /build.xml/1.3/Thu Feb 7 09:55:32 2013 //TRC_repServer2_6 /changeLog/1.7/Mon Dec 19 15:25:41 2011 //TRC_repServer2_6 /schema-base.cfg/1.3/Tue Jan 31 14:02:16 2012 //TRC_repServer2_6 /server-base.cfg/1.5/Wed Feb 6 17:39:30 2013 //TRC_repServer2_6 D/db //// D/doc //// D/dtd //// D/tcl //// /pom.xml/1.7.2.6/Fri Feb 22 11:38:24 2013 //TRC_repServer2_6 Is this same issue? If not i'll raise it as a new defect. Many thanks James

          James Morgan added a comment -

          Just to add the error this is causing is

          Provider message:
          The cvs command failed.
          Command output:
          cvs commit: Up-to-date check failed for `pom.xml'
          cvs [commit aborted]: correct above errors first!
          

          James Morgan added a comment - Just to add the error this is causing is Provider message: The cvs command failed. Command output: cvs commit: Up-to-date check failed for `pom.xml' cvs [commit aborted]: correct above errors first!

          Could you attach the XML config for this job please?

          Michael Clarke added a comment - Could you attach the XML config for this job please?

          Hi Michael, following is the xml for the job mentioned by James. Thanks for looking at.

          <?xml version='1.0' encoding='UTF-8'?>
          <maven2-moduleset plugin="maven-plugin@1.499">
            <actions/>
            <description>server branch build</description>
            <keepDependencies>false</keepDependencies>
            <properties>
              <de.pellepelster.jenkins.walldisplay.WallDisplayJobProperty plugin="jenkinswalldisplay@0.6.15"/>
            </properties>
            <scm class="hudson.scm.CVSSCM" plugin="cvs@2.8">
              <flatten>true</flatten>
              <repositoryBrowser class="hudson.scm.browsers.ViewCVS">
                <url>https://viewvc/cgi-bin/viewvc.cgi/server/?root=root</url>
              </repositoryBrowser>
              <repositories>
                <hudson.scm.CvsRepository>
                  <cvsRoot>:pserver:builder@pserver:/cvsroot-root</cvsRoot>
                  <repositoryItems>
                    <hudson.scm.CvsRepositoryItem>
                      <modules>
                        <hudson.scm.CvsModule>
                          <localName></localName>
                          <remoteName>Component/services/server</remoteName>
                        </hudson.scm.CvsModule>
                      </modules>
                      <location class="hudson.scm.CvsRepositoryLocation$BranchRepositoryLocation">
                        <locationType>BRANCH</locationType>
                        <locationName>RC_repServer2_6</locationName>
                        <useHeadIfNotFound>false</useHeadIfNotFound>
                      </location>
                    </hudson.scm.CvsRepositoryItem>
                  </repositoryItems>
                  <compressionLevel>-1</compressionLevel>
                  <excludedRegions>
                    <hudson.scm.ExcludedRegion>
                      <pattern></pattern>
                    </hudson.scm.ExcludedRegion>
                  </excludedRegions>
                  <password>B5SEyM3MM3X7KWpcw=</password>
                  <passwordRequired>true</passwordRequired>
                </hudson.scm.CvsRepository>
              </repositories>
              <canUseUpdate>false</canUseUpdate>
              <skipChangeLog>false</skipChangeLog>
              <pruneEmptyDirectories>true</pruneEmptyDirectories>
              <disableCvsQuiet>true</disableCvsQuiet>
              <cleanOnFailedUpdate>false</cleanOnFailedUpdate>
              <forceCleanCopy>true</forceCleanCopy>
            </scm>
            <assignedNode>dev02</assignedNode>
            <canRoam>false</canRoam>
            <disabled>false</disabled>
            <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
            <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
            <jdk>sun_jdk_7</jdk>
            <triggers class="vector">
              <hudson.triggers.SCMTrigger>
                <spec># every 10 mins
          */10 * * * *</spec>
                <ignorePostCommitHooks>false</ignorePostCommitHooks>
              </hudson.triggers.SCMTrigger>
            </triggers>
            <concurrentBuild>false</concurrentBuild>
            <rootModule>
              <groupId>com.components.server</groupId>
              <artifactId>server</artifactId>
            </rootModule>
            <goals>-U -DskipITs=false clean install -e</goals>
            <mavenOpts>-Xmx512M -Dm3plugin.lib=/space/jenkins_slave/main/workspace/artifactory-plugin/2.1.3</mavenOpts>
            <aggregatorStyleBuild>true</aggregatorStyleBuild>
            <incrementalBuild>false</incrementalBuild>
            <perModuleEmail>true</perModuleEmail>
            <ignoreUpstremChanges>false</ignoreUpstremChanges>
            <archivingDisabled>false</archivingDisabled>
            <resolveDependencies>false</resolveDependencies>
            <processPlugins>false</processPlugins>
            <mavenValidationLevel>-1</mavenValidationLevel>
            <runHeadless>false</runHeadless>
            <disableTriggerDownstreamProjects>false</disableTriggerDownstreamProjects>
            <settings class="jenkins.mvn.DefaultSettingsProvider"/>
            <globalSettings class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
            <reporters>
              <hudson.maven.reporters.MavenMailer>
                <recipients>dev@mail.com</recipients>
                <dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
                <sendToIndividuals>true</sendToIndividuals>
                <perModuleEmail>true</perModuleEmail>
              </hudson.maven.reporters.MavenMailer>
            </reporters>
            <publishers/>
            <buildWrappers>
              <org.jvnet.hudson.plugins.m2release.M2ReleaseBuildWrapper plugin="m2release@0.9.1">
                <scmUserEnvVar></scmUserEnvVar>
                <scmPasswordEnvVar></scmPasswordEnvVar>
                <releaseEnvVar>IS_M2RELEASEBUILD</releaseEnvVar>
                <releaseGoals>-Dresume=false release:prepare release:perform -Dmaven.scm.provider.cvs.implementation=cvs_native -X</releaseGoals>
                <dryRunGoals>-X -Dresume=false -DdryRun=true release:prepare -Dmaven.scm.provider.cvs.implementation=cvs_native -e</dryRunGoals>
                <selectCustomScmCommentPrefix>false</selectCustomScmCommentPrefix>
                <selectAppendHudsonUsername>false</selectAppendHudsonUsername>
                <selectScmCredentials>false</selectScmCredentials>
              </org.jvnet.hudson.plugins.m2release.M2ReleaseBuildWrapper>
              <org.jfrog.hudson.maven3.ArtifactoryMaven3NativeConfigurator plugin="artifactory@2.1.3">
                <details>
                  <artifactoryUrl>http://artifactory/artifactory</artifactoryUrl>
                  <artifactoryName>http://artifactory/artifactory</artifactoryName>
                  <downloadRepositoryKey>repository</downloadRepositoryKey>
                </details>
              </org.jfrog.hudson.maven3.ArtifactoryMaven3NativeConfigurator>
            </buildWrappers>
            <prebuilders>
              <hudson.tasks.Shell>
                <command></command>
              </hudson.tasks.Shell>
            </prebuilders>
            <postbuilders/>
            <runPostStepsIfResult>
              <name>SUCCESS</name>
              <ordinal>0</ordinal>
              <color>BLUE</color>
            </runPostStepsIfResult>
          </maven2-moduleset>
          

          Adriano Andrulis added a comment - Hi Michael, following is the xml for the job mentioned by James. Thanks for looking at. <?xml version= '1.0' encoding= 'UTF-8' ?> <maven2-moduleset plugin= "maven-plugin@1.499" > <actions/> <description>server branch build</description> <keepDependencies> false </keepDependencies> <properties> <de.pellepelster.jenkins.walldisplay.WallDisplayJobProperty plugin= "jenkinswalldisplay@0.6.15" /> </properties> <scm class= "hudson.scm.CVSSCM" plugin= "cvs@2.8" > <flatten> true </flatten> <repositoryBrowser class= "hudson.scm.browsers.ViewCVS" > <url>https: //viewvc/cgi-bin/viewvc.cgi/server/?root=root</url> </repositoryBrowser> <repositories> <hudson.scm.CvsRepository> <cvsRoot>:pserver:builder@pserver:/cvsroot-root</cvsRoot> <repositoryItems> <hudson.scm.CvsRepositoryItem> <modules> <hudson.scm.CvsModule> <localName></localName> <remoteName>Component/services/server</remoteName> </hudson.scm.CvsModule> </modules> <location class= "hudson.scm.CvsRepositoryLocation$BranchRepositoryLocation" > <locationType>BRANCH</locationType> <locationName>RC_repServer2_6</locationName> <useHeadIfNotFound> false </useHeadIfNotFound> </location> </hudson.scm.CvsRepositoryItem> </repositoryItems> <compressionLevel>-1</compressionLevel> <excludedRegions> <hudson.scm.ExcludedRegion> <pattern></pattern> </hudson.scm.ExcludedRegion> </excludedRegions> <password>B5SEyM3MM3X7KWpcw=</password> <passwordRequired> true </passwordRequired> </hudson.scm.CvsRepository> </repositories> <canUseUpdate> false </canUseUpdate> <skipChangeLog> false </skipChangeLog> <pruneEmptyDirectories> true </pruneEmptyDirectories> <disableCvsQuiet> true </disableCvsQuiet> <cleanOnFailedUpdate> false </cleanOnFailedUpdate> <forceCleanCopy> true </forceCleanCopy> </scm> <assignedNode>dev02</assignedNode> <canRoam> false </canRoam> <disabled> false </disabled> <blockBuildWhenDownstreamBuilding> false </blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding> false </blockBuildWhenUpstreamBuilding> <jdk>sun_jdk_7</jdk> <triggers class= "vector" > <hudson.triggers.SCMTrigger> <spec># every 10 mins */10 * * * *</spec> <ignorePostCommitHooks> false </ignorePostCommitHooks> </hudson.triggers.SCMTrigger> </triggers> <concurrentBuild> false </concurrentBuild> <rootModule> <groupId>com.components.server</groupId> <artifactId>server</artifactId> </rootModule> <goals>-U -DskipITs= false clean install -e</goals> <mavenOpts>-Xmx512M -Dm3plugin.lib=/space/jenkins_slave/main/workspace/artifactory-plugin/2.1.3</mavenOpts> <aggregatorStyleBuild> true </aggregatorStyleBuild> <incrementalBuild> false </incrementalBuild> <perModuleEmail> true </perModuleEmail> <ignoreUpstremChanges> false </ignoreUpstremChanges> <archivingDisabled> false </archivingDisabled> <resolveDependencies> false </resolveDependencies> <processPlugins> false </processPlugins> <mavenValidationLevel>-1</mavenValidationLevel> <runHeadless> false </runHeadless> <disableTriggerDownstreamProjects> false </disableTriggerDownstreamProjects> <settings class= "jenkins.mvn.DefaultSettingsProvider" /> <globalSettings class= "jenkins.mvn.DefaultGlobalSettingsProvider" /> <reporters> <hudson.maven.reporters.MavenMailer> <recipients>dev@mail.com</recipients> <dontNotifyEveryUnstableBuild> false </dontNotifyEveryUnstableBuild> <sendToIndividuals> true </sendToIndividuals> <perModuleEmail> true </perModuleEmail> </hudson.maven.reporters.MavenMailer> </reporters> <publishers/> <buildWrappers> <org.jvnet.hudson.plugins.m2release.M2ReleaseBuildWrapper plugin= "m2release@0.9.1" > <scmUserEnvVar></scmUserEnvVar> <scmPasswordEnvVar></scmPasswordEnvVar> <releaseEnvVar>IS_M2RELEASEBUILD</releaseEnvVar> <releaseGoals>-Dresume= false release:prepare release:perform -Dmaven.scm.provider.cvs.implementation=cvs_native -X</releaseGoals> <dryRunGoals>-X -Dresume= false -DdryRun= true release:prepare -Dmaven.scm.provider.cvs.implementation=cvs_native -e</dryRunGoals> <selectCustomScmCommentPrefix> false </selectCustomScmCommentPrefix> <selectAppendHudsonUsername> false </selectAppendHudsonUsername> <selectScmCredentials> false </selectScmCredentials> </org.jvnet.hudson.plugins.m2release.M2ReleaseBuildWrapper> <org.jfrog.hudson.maven3.ArtifactoryMaven3NativeConfigurator plugin= "artifactory@2.1.3" > <details> <artifactoryUrl>http: //artifactory/artifactory</artifactoryUrl> <artifactoryName>http: //artifactory/artifactory</artifactoryName> <downloadRepositoryKey>repository</downloadRepositoryKey> </details> </org.jfrog.hudson.maven3.ArtifactoryMaven3NativeConfigurator> </buildWrappers> <prebuilders> <hudson.tasks.Shell> <command></command> </hudson.tasks.Shell> </prebuilders> <postbuilders/> <runPostStepsIfResult> <name>SUCCESS</name> <ordinal>0</ordinal> <color>BLUE</color> </runPostStepsIfResult> </maven2-moduleset>

          Hi Michael, while debugging the code I found the problem is in the cleanout method on the FileCallable inner class on the AbstractCVS.java line 695.
          It call entry.setDate(null) that also removes the tag entry as it's stated on its javadoc "Set the sticky date information. Note that setting this will remove any tag information that is currently set."

          private void cleanup(File directory, AdminHandler adminHandler) throws IOException {
                                      for (File file : adminHandler.getAllFiles(directory)) {
                                          Entry entry = adminHandler.getEntry(file);
                                          String savedTag = entry.getTag();
                                          entry.setDate(null); 
                                          
                                          adminHandler.setEntry(file, entry);
                                      }
          
          I hope that helps your analysis. 
          As a quick fix I've changed my AbstractCVS code as below but I'm not fully sure of the consequences.
          

          entry.setDate(null);

          to 
          

          String savedTag = entry.getTag();
          entry.setDate(null);
          if(savedTag != null)

          { entry.setTag(savedTag); }
          
          

          Thanks and Regards.

          Adriano Andrulis added a comment - Hi Michael, while debugging the code I found the problem is in the cleanout method on the FileCallable inner class on the AbstractCVS.java line 695. It call entry.setDate(null) that also removes the tag entry as it's stated on its javadoc "Set the sticky date information. Note that setting this will remove any tag information that is currently set." private void cleanup(File directory, AdminHandler adminHandler) throws IOException { for (File file : adminHandler.getAllFiles(directory)) { Entry entry = adminHandler.getEntry(file); String savedTag = entry.getTag(); entry.setDate( null ); adminHandler.setEntry(file, entry); } I hope that helps your analysis. As a quick fix I 've changed my AbstractCVS code as below but I' m not fully sure of the consequences. entry.setDate(null); to String savedTag = entry.getTag(); entry.setDate(null); if(savedTag != null) { entry.setTag(savedTag); } Thanks and Regards.

          Re-opening given latest comments

          Michael Clarke added a comment - Re-opening given latest comments

            mc1arke Michael Clarke
            xdu xdu xdu
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: