jenkins 通过Jenkin中的Execute shell移动文件时收到错误

alen0pnh  于 2023-03-29  发布在  Jenkins
关注(0)|答案(1)|浏览(252)

我在Ubuntu 20.04中安装了Jenkin,并将其与GIThub集成。GIThub与Jenkin配合良好。我想做的是,当构建成功执行时,文件应该从Jenkin服务器移动到托管在AWS上的远程服务器。
我正在通过执行shell移动文件。我收到以下错误。

20:30:35 Started by user administrator
20:30:35 Running as SYSTEM
20:30:35 Building in workspace /var/lib/jenkins/workspace/axxxxxxg.co.uk
20:30:35 The recommended git tool is: NONE
20:30:35 No credentials specified
20:30:35  > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/axxxxxg.co.uk/.git # timeout=10
20:30:35 Fetching changes from the remote Git repository
20:30:35  > git config remote.origin.url https://ghp_TGxxxxxxxxxxxxr8@github.com/sxxxxxxxg/acxxxxxxg.co.uk.git # timeout=10
20:30:35 Fetching upstream changes from https://ghp_TGxxxxxxxxxxxxxr8@github.com/stxxxxxxg/acxxxxxxg.co.uk.git
20:30:35  > git --version # timeout=10
20:30:35  > git --version # 'git version 2.25.1'
20:30:35  > git fetch --tags --force --progress -- https://ghp_Txxxxxxxxxxxxtr8@github.com/sxxxxxxg/axxxxxxg.co.uk.git +refs/heads/*:refs/remotes/origin/* # timeout=10
20:30:35  > git rev-parse refs/remotes/origin/main^{commit} # timeout=10
20:30:35 Checking out Revision 58fac7a25a9a0c32abf620d521888f517eec76ac (refs/remotes/origin/main)
20:30:35  > git config core.sparsecheckout # timeout=10
20:30:35  > git checkout -f 58fac7a25a9a0c32abf620d521888f517eec76ac # timeout=10
20:30:35 Commit message: "first commit"
20:30:35  > git rev-list --no-walk 58fac7a25a9a0c32abf620d521888f517eec76ac # timeout=10
20:30:35 [acxxxxxxg.co.uk] $ /bin/sh -xe /tmp/jenkins10370085014864703303.sh
20:30:35 + /home/accxxxxk.sh
20:30:36 Host key verification failed.
20:30:36 rsync: connection unexpectedly closed (0 bytes received so far) [sender]
20:30:36 rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.3]
20:30:36 Build step 'Execute shell' marked build as failure
20:30:36 Finished: FAILURE

我会很高兴如果有人帮助。

  • 我已经检查了远程服务器上authorized_keys文件的权限,它是600。我已经重新创建了私有和公共,但没有成功。此外,我能够从Jenken服务器的终端执行相同的脚本。
7xzttuei

7xzttuei1#

我认为您的ssh连接有问题,您可以尝试以下操作:
1.首先检查ssh,检查连接设置是否正确(ip地址,端口号,用户名,私钥路径).
1.检查您的远程服务器配置、sshd_config文件,并确保AllowUsersAllowGroups包括Jenkins用户。
1.请确保Jenkins使用的私钥文件具有正确的权限,它应该是-rw-------,并由Jenkins用户拥有。
你也可以手动测试ssh连接,检查防火墙,ssh代理设置,希望对大家有帮助

相关问题