-
Bug
-
Resolution: Unresolved
-
Major
-
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)
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)
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)]) } } } }