【发布时间】:2021-03-07 22:28:56
【问题描述】:
我在 jenkins 中尝试了多种解决方案来复制远程文件,即 AWS 上的 EC2 窗口服务器,
-
通过 ssh 发布:提供了密钥、主机名、用户名和密码,但每次都连接失败
-
管道脚本:
管道{ 代理任何
stages { stage('SCP') { steps { bat '"C:\\Program Files\\Git\\usr\\bin\\scp.exe" -i "C:\\Live" C:\\Windows\\System32\\config\\systemprofile\\AppData\\Local\\Jenkins\\.jenkins\\workspace\\MSDeploy\\abc.txt abc.txt' bat '"c:\\Program Files\\Git\\usr\\bin\\ssh.exe" -i "C:\\Live" tom@xy.xyz.xy.xz ls -ltr' } } } }
其中 C:\Live 是远程服务器目录,C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\MSDeploy\abc.txt 是本地目录但抛出错误:显示没有找到这样的文件或目录
3。 管道{ 代理任何 阶段('部署'){ 脚步 { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'var', credentialsId: 'credid', secretKeyVariable: 'seckey']]) { writeFile 文件:'groovy1.txt',文本:'ls' bat 'ls -l groovy1.txt' 蝙蝠'猫 groovy1.txt' } } } } 它确实使用文本创建文件,但不起作用。没有一个解决方案对我有用。
请告诉我我错过了什么?另外请告诉我哪个插件最适合连接远程窗口服务器并复制文件?
【问题讨论】:
-
它被标记为可能不安全使用(并准备采用),但你看过publish over cifs吗?是publish over ssh的表弟
标签: jenkins remote-desktop file-copying window-server