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

Constant builds when svn url contains parameter

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I see a wierd bug when using global libraries on pipeline.

      We have a groovy class with static defines, which lives in a legacy place in subversion and can't be moved.

      I've worked around that by configuring a global library:

          <org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>
            <name>mylib</name>
            <retriever class="org.jenkinsci.plugins.workflow.libs.SCMRetriever">
              <scm class="hudson.scm.SubversionSCM" plugin="subversion@2.7.1">
                <locations>
                  <hudson.scm.SubversionSCM_-ModuleLocation>
                    <remote>https://svn/project/data${library.ladok3.version}/legacy/path/mylib</remote>
                    <credentialsId>xxx</credentialsId>
                    <local>src/mylib</local>
                    <depthOption>infinity</depthOption>
                    <ignoreExternalsOption>true</ignoreExternalsOption>
                  </hudson.scm.SubversionSCM_-ModuleLocation>
                </locations>
                <excludedRegions>/.*</excludedRegions>
                <includedRegions></includedRegions>
                <excludedUsers></excludedUsers>
                <excludedRevprop></excludedRevprop>
                <excludedCommitMessages></excludedCommitMessages>
                <workspaceUpdater class="hudson.scm.subversion.UpdateUpdater"/>
                <ignoreDirPropChanges>false</ignoreDirPropChanges>
                <filterChangelog>false</filterChangelog>
              </scm>
            </retriever>
            <defaultVersion>/trunk</defaultVersion>
            <implicit>false</implicit>
            <allowVersionOverride>true</allowVersionOverride>
          </org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>
      

      Every scm poll call finishes like:
      Workspace doesn't contain https://svn/project/data${library.mylib.version}/legacy/path/mylib. Need a new build.

      Everything loads just file when i use:
      @Library("mylib@/trunk")
      import mylib

      but the polling bug makes it re-build every poll call.

      I started out using the Legacy SCM api to declare the lib, because the modern scm dropdown is empty, and due to the nice workaround checking out the library to src/library i can't easily switch to the modern SCM api.

      The library is checked out just fine in workspace/pipeline@libs/src/mylib , but it looks like the polling is confused due to this.

        Attachments

          Issue Links

            Activity

            Hide
            glance Anton Lundin added a comment - - edited

            Subversion Polling Log

            Started on Oct 27, 2016 5:05:23 PM
            Received SCM poll call on master for pipeline-trunk on Oct 27, 2016 5:05:23 PM
            https://svn/project/data/pipeline-job is at revision 654
            Workspace doesn't contain https://svn/global-library-repo\$\{library.ladok3.version}/legacy/path/mylib. Need a new build.
            Received SCM poll call on master for pipeline-trunk on Oct 27, 2016 5:05:23 PM
            https://svn/project is at revision 877
            Ignored revision 877: Found no included paths
            Done. Took 0.2 sec
            Changes found

            So, pipeline code haven't changed, The code haven't changed, but because it can't find the library in the workspace, it triggers a build.

            Show
            glance Anton Lundin added a comment - - edited Subversion Polling Log Started on Oct 27, 2016 5:05:23 PM Received SCM poll call on master for pipeline-trunk on Oct 27, 2016 5:05:23 PM https://svn/project/data/pipeline-job is at revision 654 Workspace doesn't contain https://svn/global-library-repo\$\ {library.ladok3.version}/legacy/path/mylib. Need a new build. Received SCM poll call on master for pipeline-trunk on Oct 27, 2016 5:05:23 PM https://svn/project is at revision 877 Ignored revision 877: Found no included paths Done. Took 0.2 sec Changes found So, pipeline code haven't changed, The code haven't changed, but because it can't find the library in the workspace, it triggers a build.
            Hide
            jglick Jesse Glick added a comment -

            Dunno, will have to see if it is reproducible in a functional test when I have some time.

            Show
            jglick Jesse Glick added a comment - Dunno, will have to see if it is reproducible in a functional test when I have some time.
            Hide
            bmarwell Ben M added a comment -

            The problem is actually that the variable does not get resolved when checking for existence. This is still an issue.

            Show
            bmarwell Ben M added a comment - The problem is actually that the variable does not get resolved when checking for existence. This is still an issue.
            Hide
            bmarwell Ben M added a comment -

            Problematic code is in SubversionSCM.java.

            Lines 1435 following:

             

                            try {
                                url = loc.getSVNURL().toDecodedString();
                            } catch (SVNException ex) {
                                listener.error(Messages.SubversionSCM_pollChanges_exception(loc.getURL()));
                                return BUILD_NOW;
                            }
                            if (!baseline.revisions.containsKey(url)) {
                                listener.getLogger().println(Messages.SubversionSCM_pollChanges_locationNotInWorkspace(url));
                                return BUILD_NOW;
                            }
            

            The if checks on the variable url, when it is not yet expanded.

            Shouldn't be too hard to fix?

             

             

            Show
            bmarwell Ben M added a comment - Problematic code is in  SubversionSCM.java . Lines 1435 following:   try { url = loc.getSVNURL().toDecodedString(); } catch (SVNException ex) { listener.error(Messages.SubversionSCM_pollChanges_exception(loc.getURL())); return BUILD_NOW; } if (!baseline.revisions.containsKey(url)) { listener.getLogger().println(Messages.SubversionSCM_pollChanges_locationNotInWorkspace(url)); return BUILD_NOW; } The if checks on the variable url , when it is not yet expanded. Shouldn't be too hard to fix?    
            Hide
            mortenbreum_dk Morten Breum added a comment -

            I observe the same issue, and I agree with Ben M's comment.

            My polling log continuously says (base URL replaced)

            Started on Mar 30, 2020 5:38:00 PM
            Workspace doesn't contain https://<base_url>/products/product_a/${CODE_REPO_SUB_LOC}. Need a new build.
            Workspace doesn't contain https://<base_url>/products/product_a/${CODE_REPO_SUB_LOC}. Need a new build.
            Done. Took 0 ms
            Changes found
            

            My svn repository contains products/product_a/trunk/ and products/product_a/trunk/tags/1.0.0. There is no difference between building trunk and a tag, so there is one job, Build_ProductA, to do that. That job is invoked from either:

            • job Release_ProductA
              with the parameter CODE_REPO_SUB_LOC set to /tags/1.0.0
              And the build output is uploaded to a public nexus server
            • job Snapshot_ProductA
              with the parameter CODE_REPO_SUB_LOC set to /trunk
              And the build output is uploaded to a private stash
            • SCM polling
              with the parameter set to /trunk (from default)

            Because of this bug, I have to have an extra separate job to avoid building when there are no changes.

            Show
            mortenbreum_dk Morten Breum added a comment - I observe the same issue, and I agree with Ben M's comment . My polling log continuously says (base URL replaced) Started on Mar 30, 2020 5:38:00 PM Workspace doesn't contain https://<base_url>/products/product_a/${CODE_REPO_SUB_LOC}. Need a new build. Workspace doesn't contain https://<base_url>/products/product_a/${CODE_REPO_SUB_LOC}. Need a new build. Done. Took 0 ms Changes found My svn repository contains products/product_a/trunk/ and products/product_a/trunk/tags/1.0.0 . There is no difference between building trunk and a tag, so there is one job, Build_ProductA , to do that. That job is invoked from either: job Release_ProductA with the parameter CODE_REPO_SUB_LOC set to /tags/1.0.0 And the build output is uploaded to a public nexus server job Snapshot_ProductA with the parameter CODE_REPO_SUB_LOC set to /trunk And the build output is uploaded to a private stash SCM polling with the parameter set to /trunk (from default) Because of this bug, I have to have an extra separate job to avoid building when there are no changes.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              glance Anton Lundin
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated: