jenkinsci / jenkinsci/ssh-credentials-plugin

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

Open
#312 3 comments 0 reactions 0 assignees View on GitHub
component:ssh-credentials-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
25
Forks
69
PR merge metrics
No merged PRs in 30d

Description

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)])
}
}
}
}

 

---
Originally reported by jxy_joss, imported from: Pipeline build succeeded but the file was not sent to the ssh target host


  • assignee: jvz
  • status: Open
  • priority: Major
  • component(s): ssh-credentials-plugin
  • label(s): ssh
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20251215-193512

Raw content of original issue

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)])
}
}
}
}


 

environment

```
    Centos 7.4

    Docker jenkinsci/blueocean:latest

    Code is in git (gogs)

    Chrome

    Nginx (docker by latest)

    My jenkins_home is mounted to the host under /data/docker/jenkins/jenkins_home

    Jenkins docker run user root

    The tool Publish over SSH is used under jenkins (if you don't use this method, please tell me which methods are simpler)

    The host and the target host have implemented ssh secret login (even after I did the ssh secret configuration after the docker exec -it jenkins bash, the same is not possible)

```

1 attachment

- [image-2019-06-02-09-23-06-711.png](https://issues.jenkins.io/secure/attachment/47556/image-2019-06-02-09-23-06-711.png)
> ![image-2019-06-02-09-23-06-711.png](https://issues.jenkins.io/secure/attachment/47556/image-2019-06-02-09-23-06-711.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.