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

SCM Plugin: wrong sequence of output of checkout scm

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      We have noticed buffering issues for checkout scm command.

      This is our workflow

      ...   
       checkout changelog: false, poll: false, scm: [
            $class: 'GitSCM',
            branches: [[name: param.CORE_BRANCH]],
            doGenerateSubmoduleConfigurations: false,
            extensions: [[$class: 'CheckoutOption', timeout: 10],
              [$class: 'CloneOption', noTags: true, reference: '', shallow: true, timeout: 10],
              [$class: 'IgnoreNotifyCommit'],
              [$class: 'WipeWorkspace'],
              [$class: 'SubmoduleOption', disableSubmodules: true],
              [$class: 'RelativeTargetDirectory', relativeTargetDir: 'dirname']
            ],
            userRemoteConfigs: [[
              credentialsId: param.GIT_CRED_ID,
              url: param.CORE_URL
            ]]
          ]
      
          try {
            dir('dirname') {
              rc = invoke {
                println("Building java modules")
                sh "${mvn} package > ${param.ARTIFACTS}/maven.build.log 2>&1"
              }
            }
          } catch (e) {
            throw e
          }
      ...

      The expected output would be

      [06:46:13]  [Pipeline] checkout
      [06:46:13]  The recommended git tool is: NONE
      [06:46:13]  using credential xxxxxxxxxx
      [06:46:13]  Wiping out workspace first.
      [06:46:13]  Cloning the remote Git repository
      [06:46:13]  Using shallow clone with depth 1
      [06:46:13]  Avoid fetching tags
      [06:46:14]  Avoid second fetch
      [06:46:14]  Checking out Revision yyyyyyyyyyy
      [06:46:13]  Cloning repository someurl.git
      [06:46:13]   > git init fullPath # timeout=10
      [06:46:13]  Fetching upstream changes from someurl.git
      [06:46:13]   > git --version # timeout=10
      [06:46:13]   > git --version # 'git version 2.17.1'
      [06:46:13]  using GIT_ASKPASS to set credentials xx read token for yyyy
      [06:46:13]   > git fetch --no-tags --progress --depth=1 -- someurl.git +refs/heads/*:refs/remotes/origin/* # timeout=10
      [06:46:14]   > git config remote.origin.url someurl.git # timeout=10
      [06:46:14]   > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
      [06:46:14]   > git rev-parse origin/master^{commit} # timeout=10
      [06:46:14]   > git config sparsecheckout # timeout=10
      [06:46:14]   > git checkout -f zzzzzzzzzzz # timeout=10
      [06:46:14]  Commit message: "someCommitMsg"
      [06:46:14]  [Pipeline] dir
      [06:46:14]  Running in fullPathtoDir
      [06:46:14]  [Pipeline] {
      [06:46:14]  [Pipeline] echo (hide)
      [06:46:14]  Building java modules
      [06:46:14]  [Pipeline] sh
      [06:46:15]  + javaCommand
      [06:46:15]  + oneMoreCommand
      [06:50:52]  [Pipeline] }
      [06:50:52]  [Pipeline] // dir
      

      But seems that the checkout command's output is slower than the execution of the next command and we experience buffering issues when both commands' output is messed up.

      And we get something like this

      [06:46:13]  [Pipeline] checkout
      [06:46:13]  The recommended git tool is: NONE
      [06:46:13]  using credential xxxxxxxxx
      [06:46:13]  Wiping out workspace first.
      [06:46:13]  Cloning the remote Git repository
      [06:46:13]  Using shallow clone with depth 1
      [06:46:13]  Avoid fetching tags
      [06:46:14]  Avoid second fetch
      [06:46:13]  Cloning repository someurl.git
      [06:46:13]   > git init /fullpath # timeout=10
      [06:46:13]  Fetching upstream changes from someurl.git
      [06:46:13]   > git --version # timeout=10
      [06:46:13]   > git --version # 'git version 2.17.1'
      [06:46:13]  using GIT_ASKPASS to set credentials zz read token for yyy
      [06:46:13]   > git fetch --no-tags --progress --depth=1 -- someurl.git +refs/heads/*:refs/remotes/origin/* # timeout=10
      [06:46:14]   > git config remote.origin.url someurl.git # timeout=10
      [06:46:14]   > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
      [06:46:14]   > git rev-parse origin/master^{commit} # timeout=10
      [06:46:14]  Checking out Revision zzzzzzzzzzzzzz (origin/master)
      [06:46:14]  Commit message: "someCoomitMsg"
      [06:46:14]  [Pipeline] dir
      [06:46:14]  Running in /fullPathToDir
      [06:46:14]  [Pipeline] {
      [06:46:14]  [Pipeline] echo
      [06:46:14]  Building java modules
      [06:46:14]  [Pipeline] sh
      [06:46:14]  + javaCommand
      [06:46:14]  + oneMoreCommand
      [06:46:14]   > git config sparsecheckout # timeout=10
      [06:46:14]   > git checkout -f zzzzzzzzzzzzzzz # timeout=10
      [06:51:06]  [Pipeline] }
      [06:51:06]  [Pipeline] // dir
      

      As you can see, a part of checkout output got into sh step.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            vikkim Victoria
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: