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

Subversion : environment variables work only partially (got broken in 2.3 or prior, after 1.44)

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • subversion-plugin
    • None
    • RHEL6

      With upgrade of Subversion plugin from 1.44 to 2.3, environment variable behavior changed for the worse. I did not find any similar report in search although there are tons of reports concerning environment variables in various scenarios.

      Details:

      I have tons of jobs that all use a handful of branches. I need to "bump up" these jobs to use updated branch names on a regular basis, so the branch names live in global properties as environment variables, for example as below. (This is extremely convenient for managing a large number of jobs for me and hence important).

      name: BASE_INTEGRATION_BRANCH
      value: http://repo.company.net/svn/branches/release/Base.14.04

      Then, each job that needs to use this has its Subversion config as:

      Repository: ${BASE_INTEGRATION_BRANCH}

      In Subversion plugin 1.44, both polling and checkout worked flawlessly. After upgrade to 2.3, checkouts still work but polling always fails as below. (I have tried both ticking and unticking the "Validate repository URLs up to the first variable name" checkbox in global Subversion plugin config to no effect).

      Started on 2014-maj-08 14:37:16
      ERROR: Failed to check repository revision for ${BASE_INTEGRATION_BRANCH}
      org.tmatesoft.svn.core.SVNException: svn: E125002: Malformed URL '${BASE_INTEGRATION_BRANCH}'
      at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64)
      at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51)
      at org.tmatesoft.svn.core.SVNURL.<init>(SVNURL.java:233)
      at org.tmatesoft.svn.core.SVNURL.parseURIEncoded(SVNURL.java:127)
      at hudson.scm.SubversionSCM$ModuleLocation.getSVNURL(SubversionSCM.java:2700)
      at hudson.scm.SubversionSCM.compareRemoteRevisionWith(SubversionSCM.java:1442)
      at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:357)
      at hudson.scm.SCM.poll(SCM.java:374)
      at hudson.model.AbstractProject._poll(AbstractProject.java:1427)
      at hudson.model.AbstractProject.poll(AbstractProject.java:1330)
      at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:466)
      at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:495)
      at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
      Caused by: svn: E125002: Malformed URL '${BASE_INTEGRATION_BRANCH}'
      at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:171)
      at org.tmatesoft.svn.core.SVNErrorMessage.create(SVNErrorMessage.java:126)
      at org.tmatesoft.svn.core.SVNURL.<init>(SVNURL.java:232)
      ... 15 more
      Done. Took 11 ms
      Changes found

          [JENKINS-22922] Subversion : environment variables work only partially (got broken in 2.3 or prior, after 1.44)

          Tim Bradt added a comment -

          This is still a problem in Subversion plug-in 2.5...

          Started on Apr 10, 2015 3:42:02 PM
          ERROR: Failed to check repository revision for ${SVN_URL_ROOT}30-Dev/DatabaseBuild
          org.tmatesoft.svn.core.SVNException: svn: E125002: Malformed URL '${SVN_URL_ROOT}30-Dev/DatabaseBuild'

          ${SVN_URL_ROOT} is defined in global properties, and I do not have/need any credentials on this repo to do an update.

          Tim Bradt added a comment - This is still a problem in Subversion plug-in 2.5... Started on Apr 10, 2015 3:42:02 PM ERROR: Failed to check repository revision for ${SVN_URL_ROOT}30-Dev/DatabaseBuild org.tmatesoft.svn.core.SVNException: svn: E125002: Malformed URL '${SVN_URL_ROOT}30-Dev/DatabaseBuild' ${SVN_URL_ROOT} is defined in global properties, and I do not have/need any credentials on this repo to do an update.

          Lionel Trebuchon added a comment - - edited

          Hello!

          I also use the svn plugin 2.5.
          For me, the passing of environment variables defined on folder level (or on jenkins level, whatever you use) works well when I am building on... linux (debian)!
          The ${PATH_TO_MY_SOFTWARE} expands like a charme into the true link.

          On Windows however, ${PATH_TO_MY_SOFTWARE} and %PATH_TO_MY_COMPILERS% that same mistake "ERROR: Failed to check out %SVN_PERIPHERALS-P2_LATEST%/fdoot_mpd
          org.tmatesoft.svn.core.SVNException: svn: E125002: Malformed URL "

          I don't know if this piece of information helps anyone. I am still waiting for the Windows solution, the Linux solution seems to work (I really didn't have to tweak anything)
          Friendly Greetings, and have a wonderful day!
          Lionel

          Lionel Trebuchon added a comment - - edited Hello! I also use the svn plugin 2.5. For me, the passing of environment variables defined on folder level (or on jenkins level, whatever you use) works well when I am building on... linux (debian) ! The ${PATH_TO_MY_SOFTWARE} expands like a charme into the true link. On Windows however, ${PATH_TO_MY_SOFTWARE} and %PATH_TO_MY_COMPILERS% that same mistake "ERROR: Failed to check out %SVN_PERIPHERALS-P2_LATEST%/fdoot_mpd org.tmatesoft.svn.core.SVNException: svn: E125002: Malformed URL " I don't know if this piece of information helps anyone. I am still waiting for the Windows solution, the Linux solution seems to work (I really didn't have to tweak anything) Friendly Greetings, and have a wonderful day! Lionel

          Tim Bradt added a comment -

          Using %Var% in the URL is not valid syntax. You must use ${SVN_PERIPHERALS-P2_LATEST}. The only place you can use standard Windows syntax (%) is inside a Windows batch command build step. Everywhere else it requires Java syntax.

          With that, you should be able to do a check out. It's just SCM Polling that fails.

          Tim Bradt added a comment - Using %Var% in the URL is not valid syntax. You must use ${SVN_PERIPHERALS-P2_LATEST}. The only place you can use standard Windows syntax (%) is inside a Windows batch command build step. Everywhere else it requires Java syntax. With that, you should be able to do a check out. It's just SCM Polling that fails.

          Lionel Trebuchon added a comment - - edited

          Hello Tim!

          Thanks a lot for the response.
          I think I made the wrong assumption that it works only on linux because as a matter of luck, my linux projects that had already been checked out once continued to work.
          But now, I have the problem on both Linux and Windows build server and it seems to be a plugin issue in the version 2.5 .
          For instance, they seem to have a similar problem here: https://issues.jenkins-ci.org/browse/JENKINS-22542

          Friendly greetings,
          Lionel Trébuchon

          Lionel Trebuchon added a comment - - edited Hello Tim! Thanks a lot for the response. I think I made the wrong assumption that it works only on linux because as a matter of luck, my linux projects that had already been checked out once continued to work. But now, I have the problem on both Linux and Windows build server and it seems to be a plugin issue in the version 2.5 . For instance, they seem to have a similar problem here: https://issues.jenkins-ci.org/browse/JENKINS-22542 Friendly greetings, Lionel Trébuchon

          paweldefee, Hi. Could you try if this bug is present on Subversion Plugin 2.5.1 (latest release)?

          Manuel Recena Soto added a comment - paweldefee , Hi. Could you try if this bug is present on Subversion Plugin 2.5.1 (latest release)?

          Ralf Mühle added a comment - - edited

          Yes, Bug exists in SVN Plugin 2.5.1 and Jenkins 1.619

          Location 'http://xxxx/${RELEASE_BRANCH}/xxxx' does not exist

          Ralf Mühle added a comment - - edited Yes, Bug exists in SVN Plugin 2.5.1 and Jenkins 1.619 Location 'http://xxxx/${RELEASE_BRANCH}/xxxx' does not exist

          Manuel Recena Soto added a comment - - edited

          ralf_muehle, it seems we have a very similar (maybe the same) bug here: https://issues.jenkins-ci.org/browse/JENKINS-29340

          Please, review these two comments: first and second. The last includes a screencast.

          Manuel Recena Soto added a comment - - edited ralf_muehle , it seems we have a very similar (maybe the same) bug here: https://issues.jenkins-ci.org/browse/JENKINS-29340 Please, review these two comments: first and second . The last includes a screencast.

          ralf_muehle, you should use the variables in the way: https://hostname/svn/$REPO/trunk

          Manuel Recena Soto added a comment - ralf_muehle , you should use the variables in the way: https://hostname/svn/$REPO/trunk

          Tim Bradt added a comment -

          Manuel, are you saying we are supposed to use $REPO as opposed to ${REPO}. I've always used ${envvar} for the SCM URL, but the 2 formats appear to be interchangeable. They both work for the actual build when triggered manually. However, neither works for SCM polling.

          Tim Bradt added a comment - Manuel, are you saying we are supposed to use $REPO as opposed to ${REPO}. I've always used ${envvar} for the SCM URL, but the 2 formats appear to be interchangeable. They both work for the actual build when triggered manually. However, neither works for SCM polling.

          tpbradt, Both ways work fine. The problem related to SCM Polling is being solved here: JENKINS-29340. I found the bugs and I sent a PR but I don't like my proposal. I'm working on a different solution.

          Manuel Recena Soto added a comment - tpbradt , Both ways work fine. The problem related to SCM Polling is being solved here: JENKINS-29340 . I found the bugs and I sent a PR but I don't like my proposal. I'm working on a different solution.

          Kevin Leung added a comment -

          recena, I think that tpbradt means the environment variable does not work when SCM polling. However, -https://issues.jenkins-ci.org/browse/JENKINS-29340 - is about authentication, not the environment variable. They are two problems.

          I have this environment variables problem that doesn't work when SVN poll.

          Kevin Leung added a comment - recena , I think that tpbradt means the environment variable does not work when SCM polling. However, -https://issues.jenkins-ci.org/browse/JENKINS-29340 - is about authentication, not the environment variable. They are two problems. I have this environment variables problem that doesn't work when SVN poll.

          micatlkw, Both are the same problem. The result here JENKINS-29340 is an authentication problem but the root cause is that some env vars are not available.

          We are working to cut a release of Subversion Plugin soon.

          Manuel Recena Soto added a comment - micatlkw , Both are the same problem. The result here JENKINS-29340 is an authentication problem but the root cause is that some env vars are not available. We are working to cut a release of Subversion Plugin soon.

          micatlkw, tpbradt,

          You can find more information about this bug here: JENKINS-29340. And there is a user confirming that the problem is solved.

          Manuel Recena Soto added a comment - micatlkw , tpbradt , You can find more information about this bug here: JENKINS-29340 . And there is a user confirming that the problem is solved.

          Tim Bradt added a comment -

          Thanks much for the update. I just updated to 2.5.2 and confirmed that polling with a variable URL works!

          Tim Bradt added a comment - Thanks much for the update. I just updated to 2.5.2 and confirmed that polling with a variable URL works!

          tpbradt, Thanks so much for your feedback.

          Manuel Recena Soto added a comment - tpbradt , Thanks so much for your feedback.

          paweldefee, Hello. Some users have confirmed the bug is solved. What do you thing about it?

          Manuel Recena Soto added a comment - paweldefee , Hello. Some users have confirmed the bug is solved. What do you thing about it?

          In my opinion, this bug is solved.

          Manuel Recena Soto added a comment - In my opinion, this bug is solved.

            recena Manuel Recena Soto
            paweldefee Pawel Defee
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: