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

Nodejs plugin installs wrong platform package when using parallel pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • nodejs-plugin
    • None
    • Jenkins 2.162
      NodeJS plugin 1.2.7
      Latest pipeline plugins as of 04/02/2019

      Jenkins Tool config:
      NodeJs version 8.15.0 - Install automatically - Global packages = "yarn"

      Hey,

      We have a Pipeline job that runs steps in parallel across three nodes - one Ubuntu, one Mac, one Windows. Some time recently (we're not exactly sure when), it started downloading the wrong node package to the machines, e.g. downloading "node-v8.15.0-darwin-x64.tar.gz" to the Windows machine.

      Even when it does (randomly?) select the correct package, we're unable to build, since the windows logic in NodeJSInstaller doesn't fire, so it uses an incorrect command.

      I've cut everything down to a minimal Jenkinsfile that reproduces the issue for us. See screenshots for the console output.

       

      nodeLinux = 'ubuntu64-normal-amazon-1'
      nodeWin = 'windows-office-devops'
      nodeMac = 'devops-osx-slave'
      
      nodejsInstallation = 'node8'
      
      pipeline {
          agent { label 'master' }
          stages {
              stage('Test') {
                  parallel {
                      stage('Linux') {
                          agent { label nodeLinux }
                          steps {
                              nodejs(nodeJSInstallationName: nodejsInstallation) {
                                  sh 'yarn install'
                              }
                          }
                      }
                      stage('Win') {
                          agent { label nodeWin }
                          steps {
                              nodejs(nodeJSInstallationName: nodejsInstallation) {
                                  bat 'yarn install'
                              }
                          }
                      }
                      stage('MacOS') {
                          agent { label nodeMac }
                          steps {
                              nodejs(nodeJSInstallationName: nodejsInstallation) {
                                  sh 'yarn install'
                              }
                          }
                      }
                  }
              }
          }
      }

       
      It works fine if not run in parallel. I've also tried the OS detection logic in the Jenkins console and it works fine there, too:

       

      import jenkins.plugins.nodejs.tools.*;
      
      println('Linux:')
      println(ToolsUtils.getPlatform(Jenkins.instance.getNode('ubuntu64-normal-amazon-1')));
      println('Mac:')
      println(ToolsUtils.getPlatform(Jenkins.instance.getNode('devops-osx-slave')));
      println('Windows:')
      println(ToolsUtils.getPlatform(Jenkins.instance.getNode('windows-office-devops')));
      
      ---
      
      Linux:
      LINUX
      Mac:
      OSX
      Windows:
      WINDOWS
      

        1. darwin_on_windows.jpg
          115 kB
          Philip Adams
        2. linux_on_mac_and_windows.jpg
          181 kB
          Philip Adams
        3. windows_no_cmd.jpg
          28 kB
          Philip Adams

            nfalco Nikolas Falco
            adaphi Philip Adams
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: