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

Pipeline build succeeded but the file was not sent to the ssh target host

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • ssh-credentials-plugin

      I am learning jenkins, there is a problem that has not been resolved for several weeks, as follows:
      My environment

      Note: My configuration is basically configured with reference to the contents of jenkins.io/doc, so I found that the latest file does not have a lot of configuration parameters configured, basically solved with pipeline syntax.
      Host: docker in host: 192.168.9.16 (node: master)
      Target host host:192.168.9.23(lable: prod.9.23)
      task:
          Use nodejs npm build (has been successful, success will generate dist/* under path)
          Send the successful result to the specified path /data/www/mytest on the target host
          
      problem:
          The display is successful, but the target host does not get the file.
          How to execute the host command in the docker environment, or execute the remote host command?

       

      my jenkinsfile:

      pipeline {
          agent {
              docker {
                  image 'node_cnpm:8.0.1'
                  args '-p 3000:3000'
              }
          }
          environment {
              CI = 'true'
          }
          stages {
              stage('Build') {
                  steps {
                      sh 'node -v'
                      sh 'npm -v'
                      sh 'cnpm -v'
                      sh 'pwd'
                      sh 'ls'
                      sh 'chmod -R 777 ./'
                      sh 'rm -rf node_modules/'
                      sh 'ls'
                      sh 'npm cache clean -f'
                      sh 'cnpm install '
                      sh 'npm run test'
                  }
              }
             stage('deploy') {
                  steps {
                      sshPublisher(publishers: [sshPublisherDesc(configName: 'prod.9.23', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/data/www/test.erp.ui.pc', remoteDirectorySDF: false, removePrefix: 'dist', sourceFiles: 'dist/*.*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
                  }
              }
          }
      }
      

       

          [JENKINS-57810] Pipeline build succeeded but the file was not sent to the ssh target host

          joss.ji joss created issue -
          joss.ji joss made changes -
          Description Original: I am learning jenkins, there is a problem that has not been resolved for several weeks, as follows:
          My environment

          Note: My configuration is basically configured with reference to the contents of jenkins.io/doc, so I found that the latest file does not have a lot of configuration parameters configured, basically solved with pipeline syntax.
          Host: docker in host: 192.168.9.16 (node: master)
          Target host host:192.168.9.23
          task:
              Use nodejs npm build (has been successful, success will generate dist/* under path)
              Send the successful result to the specified path /data/www/mytest on the target host
              
          problem:
              The display is successful, but the target host does not get the file.
              How to execute the host command in the docker environment, or execute the remote host command?
          New: I am learning jenkins, there is a problem that has not been resolved for several weeks, as follows:
           My environment

          Note: My configuration is basically configured with reference to the contents of jenkins.io/doc, so I found that the latest file does not have a lot of configuration parameters configured, basically solved with pipeline syntax.
           Host: docker in host: 192.168.9.16 (node: master)
           Target host host:192.168.9.23(lable: prod.9.23)
           task:
               Use nodejs npm build (has been successful, success will generate dist/* under path)
               Send the successful result to the specified path /data/www/mytest on the target host
               
           problem:
               The display is successful, but the target host does not get the file.
               How to execute the host command in the docker environment, or execute the remote host command?

           

          my jenkinsfile:
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'node_cnpm:8.0.1'
                      args '-p 3000:3000'
                  }
              }
              environment {
                  CI = 'true'
              }
              stages {
                  stage('Build') {
                      steps {
                          sh 'node -v'
                          sh 'npm -v'
                          sh 'cnpm -v'
                          sh 'pwd'
                          sh 'ls'
                          sh 'chmod -R 777 ./'
                          sh 'rm -rf node_modules/'
                          sh 'ls'
                          sh 'npm cache clean -f'
                          sh 'cnpm install '
                          sh 'npm run test'
                      }
                  }
                 stage('deploy') {
                      steps {
                          sshPublisher(publishers: [sshPublisherDesc(configName: 'prod.9.23', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/data/www/test.erp.ui.pc', remoteDirectorySDF: false, removePrefix: 'dist', sourceFiles: 'dist/*.*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
                      }
                  }
              }
          }
          {code}
           
          joss.ji joss made changes -
          Attachment New: image-2019-06-02-09-23-06-711.png [ 47556 ]

            jvz Matt Sicker
            jxy_joss joss.ji joss
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: