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

Different behaviour when using Mercurial with "Subdirectory" in MultiSCM vs. SCM

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I just found that in jobs (created from Job-DSL code if that matters), the Gradle plugin behaves differently depending on whether a Mercurial checkout using the Subdirectory setting is used with plain SCM vs. MultiSCM. Here's a simplified example:

      job('./MultiSCMTest') {
        multiscm {
          hg(repoUrl) {
            branch('default')
            clean(true)
            installation('Mercurial')
            subdirectory('repo')
          }
        }
        triggers {
          scm('H/15 * * * *')
        }
        steps {
          gradle {
            passAllAsProjectProperties(false)
            passAllAsSystemProperties(false)
            rootBuildScriptDir('repo')
            switches('')
            tasks('clean --no-daemon')
            useWorkspaceAsHome(true)
          }
        }
      }

      Executing the resulting job yields the expected result (the Gradle wrapper contained in the repository is executed successfully, like:

      [Gradle] - Launching build.
      [repo] $ /srv/jenkins/workspace/MultiSCMTest/repo/gradlew clean --no-daemon

      However, if I change "multiscm" to just "scm", the build runs into an error:

      [Gradle] - Launching build.
      FATAL: The Gradle wrapper has not been found in these directories: /srv/jenkins/workspace/MultiSCMTest/repo/repo

      Notice the doubled "/repo" at the end of the path. I'd expect both to behave identically.

        Attachments

          Activity

          Hide
          jglick Jesse Glick added a comment -

          https://plugins.jenkins.io/multiple-scms/ is deprecated. Try Pipeline with checkout wrapped in dir.

          Show
          jglick Jesse Glick added a comment - https://plugins.jenkins.io/multiple-scms/ is deprecated. Try Pipeline with checkout wrapped in dir .
          Hide
          dhs Dirk Heinrichs added a comment -

          Errrh, read again please. The problem is NOT in MultiSCM. This is the one that behaves correctly. An no, I cannot simply change the jobs to Pipeline since we're talking about Mercurial here, and at least Multibranch Pipeline has its problems with that (not considering tags, for example).

          Show
          dhs Dirk Heinrichs added a comment - Errrh, read again please. The problem is NOT in MultiSCM. This is the one that behaves correctly. An no, I cannot simply change the jobs to Pipeline since we're talking about Mercurial here, and at least Multibranch Pipeline has its problems with that (not considering tags, for example).
          Hide
          jglick Jesse Glick added a comment -

          So use a non-multibranch Pipeline job? And run sh 'gradle …' rather than using a Gradle plugin.

          Show
          jglick Jesse Glick added a comment - So use a non -multibranch Pipeline job? And run sh 'gradle …' rather than using a Gradle plugin.

            People

            Assignee:
            wolfs Stefan Wolf
            Reporter:
            dhs Dirk Heinrichs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: